Il 18/07/2013 15:55, ronnie sahlberg ha scritto: >> > bdrv->write_zeroes will use writesame16 and set the unmap flag only if >> > BDRV_MAY_DISCARD == 1 and BDRV_O_UNMAP == 1 and lbprz == 1. > When you use WRITESAME16 you can ignore the lbprz flag. > Just send a WRITESAME16 command with one block of data that is all set to > zero. > If the unmap flag is set and if unmapped blocks read back the same as > the block you provided (all zero) > then it will unmap those blocks, where possible.
True, so the unmap flag can be set iff BDRV_MAY_DISCARD == 1. block.c can take care of checking BDRV_O_UNMAP. Paolo > All other blocks that can not be unmapped, or where unmapped blocks > will not read back the same, will instead be overwritten by the > provided all-zero block. > >