diff options
-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) | |||
145 | int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | 145 | int 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 | } |
165 | submit: | 165 | submit: |
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 | } |