aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2015-02-05 12:14:54 -0500
committerJens Axboe <axboe@fb.com>2015-02-05 12:14:54 -0500
commit9f9ee1f2b2f94f19437ae2def7c0d6636d7fe02e (patch)
tree0f4b843f294f7cc586acdb4558bd6c687205143b /block
parent9124d3fe21b0947b03f4b87bcfb7acd675d6e85b (diff)
block: Quiesce zeroout wrapper
blkdev_issue_zeroout() printed a warning if a device failed a discard or write same request despite advertising support for these. That's fine for SCSI since we'll disable these commands if we get an error back from the disk saying that they are not supported. And consequently the warning only gets printed once. There are other types of block devices that support discard, however, and these may return -EOPNOTSUPP for each command but leave discard enabled in the queue limits. This will cause a warning message for every blkdev_issue_zeroout() invocation. Remove the offending warning messages. Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-lib.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 715e948f58a4..7688ee3f5d72 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -286,7 +286,6 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
286 * @discard: whether to discard the block range 286 * @discard: whether to discard the block range
287 * 287 *
288 * Description: 288 * Description:
289
290 * Zero-fill a block range. If the discard flag is set and the block 289 * Zero-fill a block range. If the discard flag is set and the block
291 * device guarantees that subsequent READ operations to the block range 290 * device guarantees that subsequent READ operations to the block range
292 * in question will return zeroes, the blocks will be discarded. Should 291 * in question will return zeroes, the blocks will be discarded. Should
@@ -303,26 +302,15 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
303 sector_t nr_sects, gfp_t gfp_mask, bool discard) 302 sector_t nr_sects, gfp_t gfp_mask, bool discard)
304{ 303{
305 struct request_queue *q = bdev_get_queue(bdev); 304 struct request_queue *q = bdev_get_queue(bdev);
306 unsigned char bdn[BDEVNAME_SIZE];
307
308 if (discard && blk_queue_discard(q) && q->limits.discard_zeroes_data) {
309 305
310 if (!blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, 0)) 306 if (discard && blk_queue_discard(q) && q->limits.discard_zeroes_data &&
311 return 0; 307 blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, 0) == 0)
312 308 return 0;
313 bdevname(bdev, bdn);
314 pr_warn("%s: DISCARD failed. Manually zeroing.\n", bdn);
315 }
316 309
317 if (bdev_write_same(bdev)) { 310 if (bdev_write_same(bdev) &&
318 311 blkdev_issue_write_same(bdev, sector, nr_sects, gfp_mask,
319 if (!blkdev_issue_write_same(bdev, sector, nr_sects, gfp_mask, 312 ZERO_PAGE(0)) == 0)
320 ZERO_PAGE(0))) 313 return 0;
321 return 0;
322
323 bdevname(bdev, bdn);
324 pr_warn("%s: WRITE SAME failed. Manually zeroing.\n", bdn);
325 }
326 314
327 return __blkdev_issue_zeroout(bdev, sector, nr_sects, gfp_mask); 315 return __blkdev_issue_zeroout(bdev, sector, nr_sects, gfp_mask);
328} 316}