aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-lib.c
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-08-06 07:23:25 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-08 12:31:08 -0400
commit18edc8eaa68070771bdb2098260e44efe74de722 (patch)
tree989c6560f5e9bf5e7156853fccb9c4e1bb30adaf /block/blk-lib.c
parent3383977fadc4027f20907f6208a9033cd043adab (diff)
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/blk-lib.c')
-rw-r--r--block/blk-lib.c8
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)
145int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, 145int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
146 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags) 146 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags)
147{ 147{
148 int ret = 0; 148 int ret;
149 struct bio *bio; 149 struct bio *bio;
150 struct bio_batch bb; 150 struct bio_batch bb;
151 unsigned int sz, issued = 0; 151 unsigned int sz, issued = 0;
@@ -163,11 +163,14 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
163 return ret; 163 return ret;
164 } 164 }
165submit: 165submit:
166 ret = 0;
166 while (nr_sects != 0) { 167 while (nr_sects != 0) {
167 bio = bio_alloc(gfp_mask, 168 bio = bio_alloc(gfp_mask,
168 min(nr_sects, (sector_t)BIO_MAX_PAGES)); 169 min(nr_sects, (sector_t)BIO_MAX_PAGES));
169 if (!bio) 170 if (!bio) {
171 ret = -ENOMEM;
170 break; 172 break;
173 }
171 174
172 bio->bi_sector = sector; 175 bio->bi_sector = sector;
173 bio->bi_bdev = bdev; 176 bio->bi_bdev = bdev;
@@ -186,6 +189,7 @@ submit:
186 if (ret < (sz << 9)) 189 if (ret < (sz << 9))
187 break; 190 break;
188 } 191 }
192 ret = 0;
189 issued++; 193 issued++;
190 submit_bio(WRITE, bio); 194 submit_bio(WRITE, bio);
191 } 195 }