blkdev: Simple cleanup in blkdev_issue_zeroout()
In blkdev_issue_zeroout() we are submitting regular WRITE bios, so we do not need to check for -EOPNOTSUPP specifically in case of error. Also there is no need to have label submit: because there is no way to jump out from the while cycle without an error and we really want to exit, rather than try again. And also remove the check for (sz == 0) since at that point sz can never be zero. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Jeff Moyer <jmoyer@redhat.com> CC: Dmitry Monakhov <dmonakhov@openvz.org> CC: Jens Axboe <jaxboe@fusionio.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
parent
5dba3089ed
commit
5baebe5c86
@ -140,7 +140,6 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
|
||||
bb.flags = 1 << BIO_UPTODATE;
|
||||
bb.wait = &wait;
|
||||
|
||||
submit:
|
||||
ret = 0;
|
||||
while (nr_sects != 0) {
|
||||
bio = bio_alloc(gfp_mask,
|
||||
@ -157,9 +156,6 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
|
||||
|
||||
while (nr_sects != 0) {
|
||||
sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
|
||||
if (sz == 0)
|
||||
/* bio has maximum size possible */
|
||||
break;
|
||||
ret = bio_add_page(bio, ZERO_PAGE(0), sz << 9, 0);
|
||||
nr_sects -= ret >> 9;
|
||||
sector += ret >> 9;
|
||||
@ -179,16 +175,6 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
|
||||
/* One of bios in the batch was completed with error.*/
|
||||
ret = -EIO;
|
||||
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (test_bit(BIO_EOPNOTSUPP, &bb.flags)) {
|
||||
ret = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
if (nr_sects != 0)
|
||||
goto submit;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(blkdev_issue_zeroout);
|
||||
|
Loading…
Reference in New Issue
Block a user