diff mbox series

[RFC,1/7] block: move submit_bio_checks() into submit_bio_noacct

Message ID 20220111115532.497117-2-ming.lei@redhat.com (mailing list archive)
State New, archived
Headers show
Series block: improve iops limit throttle | expand

Commit Message

Ming Lei Jan. 11, 2022, 11:55 a.m. UTC
It is more clean & readable to check bio when starting to submit it,
instead of just before calling ->submit_bio() or blk_mq_submit_bio().

Also it provides us chance to optimize bio submission without checking
bio.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Christoph Hellwig Jan. 17, 2022, 8:20 a.m. UTC | #1
On Tue, Jan 11, 2022 at 07:55:26PM +0800, Ming Lei wrote:
> It is more clean & readable to check bio when starting to submit it,
> instead of just before calling ->submit_bio() or blk_mq_submit_bio().
> 
> Also it provides us chance to optimize bio submission without checking
> bio.

This looks ok, but I'd just remove submit_bio_checks entirely while
we're at it.
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index fd029c86d6ac..cca7fbe2a43b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -799,9 +799,6 @@  static void __submit_bio(struct bio *bio)
 {
 	struct gendisk *disk = bio->bi_bdev->bd_disk;
 
-	if (unlikely(!submit_bio_checks(bio)))
-		return;
-
 	if (!disk->fops->submit_bio)
 		blk_mq_submit_bio(bio);
 	else
@@ -895,6 +892,9 @@  static void __submit_bio_noacct_mq(struct bio *bio)
  */
 void submit_bio_noacct(struct bio *bio)
 {
+	if (unlikely(!submit_bio_checks(bio)))
+		return;
+
 	/*
 	 * We only want one ->submit_bio to be active at a time, else stack
 	 * usage with stacked devices could be a problem.  Use current->bio_list