diff options
author | Christoph Hellwig <hch@lst.de> | 2017-04-05 13:21:10 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-08 13:25:38 -0400 |
commit | cb365b9675fda026caba4cb5df83292cb7c0811a (patch) | |
tree | fbb1e83537ed759ae63b5e1dc93f741acb30d552 /block/blk-lib.c | |
parent | d928be9f853b9755692d7e9aed402c1809a88e56 (diff) |
block: add a new BLKDEV_ZERO_NOFALLBACK flag
This avoids fallbacks to explicit zeroing in (__)blkdev_issue_zeroout if
the caller doesn't want them.
Also clean up the convoluted check for the return condition that this
new flag is added to.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-lib.c')
-rw-r--r-- | block/blk-lib.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c index 2f6d2cb2e1a2..2f882e22890b 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -281,6 +281,9 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev, | |||
281 | * | 281 | * |
282 | * If a device is using logical block provisioning, the underlying space will | 282 | * If a device is using logical block provisioning, the underlying space will |
283 | * not be released if %flags contains BLKDEV_ZERO_NOUNMAP. | 283 | * not be released if %flags contains BLKDEV_ZERO_NOUNMAP. |
284 | * | ||
285 | * If %flags contains BLKDEV_ZERO_NOFALLBACK, the function will return | ||
286 | * -EOPNOTSUPP if no explicit hardware offload for zeroing is provided. | ||
284 | */ | 287 | */ |
285 | int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | 288 | int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, |
286 | sector_t nr_sects, gfp_t gfp_mask, struct bio **biop, | 289 | sector_t nr_sects, gfp_t gfp_mask, struct bio **biop, |
@@ -298,7 +301,7 @@ int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | |||
298 | 301 | ||
299 | ret = __blkdev_issue_write_zeroes(bdev, sector, nr_sects, gfp_mask, | 302 | ret = __blkdev_issue_write_zeroes(bdev, sector, nr_sects, gfp_mask, |
300 | biop, flags); | 303 | biop, flags); |
301 | if (ret == 0 || (ret && ret != -EOPNOTSUPP)) | 304 | if (ret != -EOPNOTSUPP || (flags & BLKDEV_ZERO_NOFALLBACK)) |
302 | goto out; | 305 | goto out; |
303 | 306 | ||
304 | ret = 0; | 307 | ret = 0; |