Why? Did you miss that it is in the condition where __blkdev_issue_zero_pages() is called (i.e. it's not WRITE SAME but WRITE). From what I gathered REQ_PREFLUSH triggers a write back cache (that is on the device; not sure about dirty pages) flush, wouldn't it be a right thing to do after we performed a series of WRITE (which is more or less purposed to get a drive wiped clean). On Sun, 6 Dec 2020 at 19:31, Hannes Reinecke <hare@xxxxxxx> wrote: > > On 12/6/20 6:53 AM, Tom Yan wrote: > > Mimicking blkdev_issue_flush(). Seems like a right thing to do, as > > they are a bunch of REQ_OP_WRITE. > > > > Signed-off-by: Tom Yan <tom.ty89@xxxxxxxxx> > > --- > > block/blk-lib.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/block/blk-lib.c b/block/blk-lib.c > > index 354dcab760c7..5579fdea893d 100644 > > --- a/block/blk-lib.c > > +++ b/block/blk-lib.c > > @@ -422,6 +422,8 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, > > } else if (!(flags & BLKDEV_ZERO_NOFALLBACK)) { > > ret = __blkdev_issue_zero_pages(bdev, sector, nr_sects, > > gfp_mask, &bio); > > + if (bio) > > + bio->bi_opf |= REQ_PREFLUSH; > > } else { > > /* No zeroing offload support */ > > ret = -EOPNOTSUPP; > > > PREFLUSH is for the 'flush' machinery (cf blk-flush.c). Which is okay > for blkdev_issue_flush(), but certainly not for zeroout. > > Cheers, > > Hannes > -- > Dr. Hannes Reinecke Kernel Storage Architect > hare@xxxxxxx +49 911 74053 688 > SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg > HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer