From: Lukas Czerner <lczerner@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Lukas Czerner <lczerner@redhat.com>,
Dmitry Monakhov <dmonakhov@openvz.org>,
Jens Axboe <jaxboe@fusionio.com>
Subject: [PATCH 2/3] blkdev: Simple cleanup in blkdev_issue_zeroout()
Date: Mon, 2 May 2011 16:17:20 +0200 [thread overview]
Message-ID: <1304345841-20063-2-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1304345841-20063-1-git-send-email-lczerner@redhat.com>
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>
---
block/blk-lib.c | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 9260cb0..d7a98d3 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -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 @@ submit:
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 @@ submit:
/* 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);
--
1.7.4.4
next prev parent reply other threads:[~2011-05-02 14:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 14:17 [PATCH 1/3] blkdev: Submit discard bio in batches in blkdev_issue_discard() Lukas Czerner
2011-05-02 14:17 ` Lukas Czerner [this message]
2011-05-02 14:17 ` [PATCH 3/3] blkdev: honor discard_granularity " Lukas Czerner
2011-05-02 14:38 ` Martin K. Petersen
2011-05-02 16:10 ` Jeff Moyer
2011-05-02 17:07 ` Martin K. Petersen
2011-05-02 23:21 ` Dave Chinner
2011-05-02 16:23 ` [PATCH 1/3] blkdev: Submit discard bio in batches " Jens Axboe
2011-05-03 9:30 ` Lukas Czerner
2011-05-03 9:30 ` Lukas Czerner
2011-05-03 9:57 ` Christoph Hellwig
2011-05-07 1:23 ` Jens Axboe
2011-05-05 15:20 ` Lukas Czerner
2011-05-05 15:20 ` Lukas Czerner
2011-05-07 1:24 ` Jens Axboe
2011-05-09 14:30 ` Christoph Hellwig
2011-05-05 15:12 ` [PATCH] blkdev: Do not return -EOPNOTSUPP if discard is supported Lukas Czerner
2011-05-07 1:30 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304345841-20063-2-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=dmonakhov@openvz.org \
--cc=jaxboe@fusionio.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.