diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2010-08-06 15:23:25 +0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-08 20:31:08 +0400 |
commit | 18edc8eaa68070771bdb2098260e44efe74de722 (patch) | |
tree | 989c6560f5e9bf5e7156853fccb9c4e1bb30adaf /block | |
parent | 3383977fadc4027f20907f6208a9033cd043adab (diff) | |
download | linux-18edc8eaa68070771bdb2098260e44efe74de722.tar.xz |
blkdev: fix blkdev_issue_zeroout return value
- If function called without barrier option retvalue is incorrect
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-lib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c index 5d793e143f3c..c1fc55a83ba1 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -145,7 +145,7 @@ static void bio_batch_end_io(struct bio *bio, int err) int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask, unsigned long flags) { - int ret = 0; + int ret; struct bio *bio; struct bio_batch bb; unsigned int sz, issued = 0; @@ -163,11 +163,14 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, return ret; } submit: + ret = 0; while (nr_sects != 0) { bio = bio_alloc(gfp_mask, min(nr_sects, (sector_t)BIO_MAX_PAGES)); - if (!bio) + if (!bio) { + ret = -ENOMEM; break; + } bio->bi_sector = sector; bio->bi_bdev = bdev; @@ -186,6 +189,7 @@ submit: if (ret < (sz << 9)) break; } + ret = 0; issued++; submit_bio(WRITE, bio); } |