]> git.baikalelectronics.ru Git - kernel.git/commit
block: introduce BLKDEV_DISCARD_ZERO to fix zeroout
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Jul 2016 09:23:33 +0000 (11:23 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 20 Jul 2016 23:35:20 +0000 (17:35 -0600)
commit6969c4412a227de45fa31830cabdd7ee8f6ba874
treeeadcf71a0abf034caaab5b019fe8f290df7fbc14
parenta3d782b687af901e343ad462a75da47910549c44
block: introduce BLKDEV_DISCARD_ZERO to fix zeroout

Currently blkdev_issue_zeroout cascades down from discards (if the driver
guarantees that discards zero data), to WRITE SAME and then to a loop
writing zeroes.  Unfortunately we ignore run-time EOPNOTSUPP errors in the
block layer blkdev_issue_discard helper to work around DM volumes that
may have mixed discard support underneath.

This patch intoroduces a new BLKDEV_DISCARD_ZERO flag to
blkdev_issue_discard that indicates we are called for zeroing operation.
This allows both to ignore the EOPNOTSUPP hack and actually consolidating
the discard_zeroes_data check into the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-lib.c
include/linux/blkdev.h