All of lore.kernel.org
 help / color / mirror / Atom feed
From: dannyshih <dannyshih@synology.com>
To: axboe@kernel.dk
Cc: agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com,
	song@kernel.org, linux-block@vger.kernel.org,
	linux-raid@vger.kernel.org, Danny Shih <dannyshih@synology.com>
Subject: [PATCH 1/4] block: introduce submit_bio_noacct_add_head
Date: Tue, 29 Dec 2020 17:18:39 +0800	[thread overview]
Message-ID: <1609233522-25837-2-git-send-email-dannyshih@synology.com> (raw)
In-Reply-To: <1609233522-25837-1-git-send-email-dannyshih@synology.com>

From: Danny Shih <dannyshih@synology.com>

Porvide a way for stacking block device to re-submit the bio
which sholud be handled firstly.

Signed-off-by: Danny Shih <dannyshih@synology.com>
Reviewed-by: Allen Peng <allenpeng@synology.com>
Reviewed-by: Alex Wu <alexwu@synology.com>
---
 block/blk-core.c       | 44 +++++++++++++++++++++++++++++++++-----------
 include/linux/blkdev.h |  1 +
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 96e5fcd..693dc83 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1031,16 +1031,7 @@ static blk_qc_t __submit_bio_noacct_mq(struct bio *bio)
 	return ret;
 }
 
-/**
- * submit_bio_noacct - re-submit a bio to the block device layer for I/O
- * @bio:  The bio describing the location in memory and on the device.
- *
- * This is a version of submit_bio() that shall only be used for I/O that is
- * resubmitted to lower level drivers by stacking block drivers.  All file
- * systems and other upper level users of the block layer should use
- * submit_bio() instead.
- */
-blk_qc_t submit_bio_noacct(struct bio *bio)
+static blk_qc_t do_submit_bio_noacct(struct bio *bio, bool add_head)
 {
 	if (!submit_bio_checks(bio))
 		return BLK_QC_T_NONE;
@@ -1052,7 +1043,10 @@ blk_qc_t submit_bio_noacct(struct bio *bio)
 	 * it is active, and then process them after it returned.
 	 */
 	if (current->bio_list) {
-		bio_list_add(&current->bio_list[0], bio);
+		if (add_head)
+			bio_list_add_head(&current->bio_list[0], bio);
+		else
+			bio_list_add(&current->bio_list[0], bio);
 		return BLK_QC_T_NONE;
 	}
 
@@ -1060,9 +1054,37 @@ blk_qc_t submit_bio_noacct(struct bio *bio)
 		return __submit_bio_noacct_mq(bio);
 	return __submit_bio_noacct(bio);
 }
+
+/**
+ * submit_bio_noacct - re-submit a bio to the block device layer for I/O
+ * @bio:  The bio describing the location in memory and on the device.
+ *
+ * This is a version of submit_bio() that shall only be used for I/O that is
+ * resubmitted to lower level drivers by stacking block drivers.  All file
+ * systems and other upper level users of the block layer should use
+ * submit_bio() instead.
+ */
+blk_qc_t submit_bio_noacct(struct bio *bio)
+{
+	return do_submit_bio_noacct(bio, false);
+}
 EXPORT_SYMBOL(submit_bio_noacct);
 
 /**
+ * submit_bio_noacct - re-submit a bio, which needs to be handle firstly,
+ *                     to the block device layer for I/O
+ * @bio:  The bio describing the location in memory and on the device.
+ *
+ * alternative submit_bio_noacct() which add bio to the head of
+ * current->bio_list.
+ */
+blk_qc_t submit_bio_noacct_add_head(struct bio *bio)
+{
+	return do_submit_bio_noacct(bio, true);
+}
+EXPORT_SYMBOL(submit_bio_noacct_add_head);
+
+/**
  * submit_bio - submit a bio to the block device layer for I/O
  * @bio: The &struct bio which describes the I/O
  *
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 070de09..b0080d0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -905,6 +905,7 @@ static inline void rq_flush_dcache_pages(struct request *rq)
 extern int blk_register_queue(struct gendisk *disk);
 extern void blk_unregister_queue(struct gendisk *disk);
 blk_qc_t submit_bio_noacct(struct bio *bio);
+blk_qc_t submit_bio_noacct_add_head(struct bio *bio);
 extern void blk_rq_init(struct request_queue *q, struct request *rq);
 extern void blk_put_request(struct request *);
 extern struct request *blk_get_request(struct request_queue *, unsigned int op,
-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
From: dannyshih <dannyshih@synology.com>
To: axboe@kernel.dk
Cc: linux-raid@vger.kernel.org, snitzer@redhat.com,
	linux-block@vger.kernel.org, song@kernel.org,
	dm-devel@redhat.com, Danny Shih <dannyshih@synology.com>,
	agk@redhat.com
Subject: [dm-devel] [PATCH 1/4] block: introduce submit_bio_noacct_add_head
Date: Tue, 29 Dec 2020 17:18:39 +0800	[thread overview]
Message-ID: <1609233522-25837-2-git-send-email-dannyshih@synology.com> (raw)
In-Reply-To: <1609233522-25837-1-git-send-email-dannyshih@synology.com>

From: Danny Shih <dannyshih@synology.com>

Porvide a way for stacking block device to re-submit the bio
which sholud be handled firstly.

Signed-off-by: Danny Shih <dannyshih@synology.com>
Reviewed-by: Allen Peng <allenpeng@synology.com>
Reviewed-by: Alex Wu <alexwu@synology.com>
---
 block/blk-core.c       | 44 +++++++++++++++++++++++++++++++++-----------
 include/linux/blkdev.h |  1 +
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 96e5fcd..693dc83 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1031,16 +1031,7 @@ static blk_qc_t __submit_bio_noacct_mq(struct bio *bio)
 	return ret;
 }
 
-/**
- * submit_bio_noacct - re-submit a bio to the block device layer for I/O
- * @bio:  The bio describing the location in memory and on the device.
- *
- * This is a version of submit_bio() that shall only be used for I/O that is
- * resubmitted to lower level drivers by stacking block drivers.  All file
- * systems and other upper level users of the block layer should use
- * submit_bio() instead.
- */
-blk_qc_t submit_bio_noacct(struct bio *bio)
+static blk_qc_t do_submit_bio_noacct(struct bio *bio, bool add_head)
 {
 	if (!submit_bio_checks(bio))
 		return BLK_QC_T_NONE;
@@ -1052,7 +1043,10 @@ blk_qc_t submit_bio_noacct(struct bio *bio)
 	 * it is active, and then process them after it returned.
 	 */
 	if (current->bio_list) {
-		bio_list_add(&current->bio_list[0], bio);
+		if (add_head)
+			bio_list_add_head(&current->bio_list[0], bio);
+		else
+			bio_list_add(&current->bio_list[0], bio);
 		return BLK_QC_T_NONE;
 	}
 
@@ -1060,9 +1054,37 @@ blk_qc_t submit_bio_noacct(struct bio *bio)
 		return __submit_bio_noacct_mq(bio);
 	return __submit_bio_noacct(bio);
 }
+
+/**
+ * submit_bio_noacct - re-submit a bio to the block device layer for I/O
+ * @bio:  The bio describing the location in memory and on the device.
+ *
+ * This is a version of submit_bio() that shall only be used for I/O that is
+ * resubmitted to lower level drivers by stacking block drivers.  All file
+ * systems and other upper level users of the block layer should use
+ * submit_bio() instead.
+ */
+blk_qc_t submit_bio_noacct(struct bio *bio)
+{
+	return do_submit_bio_noacct(bio, false);
+}
 EXPORT_SYMBOL(submit_bio_noacct);
 
 /**
+ * submit_bio_noacct - re-submit a bio, which needs to be handle firstly,
+ *                     to the block device layer for I/O
+ * @bio:  The bio describing the location in memory and on the device.
+ *
+ * alternative submit_bio_noacct() which add bio to the head of
+ * current->bio_list.
+ */
+blk_qc_t submit_bio_noacct_add_head(struct bio *bio)
+{
+	return do_submit_bio_noacct(bio, true);
+}
+EXPORT_SYMBOL(submit_bio_noacct_add_head);
+
+/**
  * submit_bio - submit a bio to the block device layer for I/O
  * @bio: The &struct bio which describes the I/O
  *
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 070de09..b0080d0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -905,6 +905,7 @@ static inline void rq_flush_dcache_pages(struct request *rq)
 extern int blk_register_queue(struct gendisk *disk);
 extern void blk_unregister_queue(struct gendisk *disk);
 blk_qc_t submit_bio_noacct(struct bio *bio);
+blk_qc_t submit_bio_noacct_add_head(struct bio *bio);
 extern void blk_rq_init(struct request_queue *q, struct request *rq);
 extern void blk_put_request(struct request *);
 extern struct request *blk_get_request(struct request_queue *, unsigned int op,
-- 
2.7.4

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2020-12-29  9:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29  9:18 [PATCH 0/4] Fix order when split bio and send remaining back to itself dannyshih
2020-12-29  9:18 ` [dm-devel] " dannyshih
2020-12-29  9:18 ` dannyshih [this message]
2020-12-29  9:18   ` [dm-devel] [PATCH 1/4] block: introduce submit_bio_noacct_add_head dannyshih
2020-12-30  0:00   ` John Stoffel
2020-12-30  0:00     ` [dm-devel] " John Stoffel
2020-12-30  9:51     ` Danny Shih
2020-12-30  9:51       ` [dm-devel] " Danny Shih
2020-12-30 17:06       ` John Stoffel
2020-12-30 17:06         ` [dm-devel] " John Stoffel
2020-12-30 17:53         ` antlists
2020-12-30 17:53           ` [dm-devel] " antlists
2020-12-30 11:35     ` antlists
2020-12-30 11:35       ` [dm-devel] " antlists
2020-12-30 16:53       ` John Stoffel
2020-12-30 16:53         ` [dm-devel] " John Stoffel
2020-12-29  9:18 ` [PATCH 2/4] block: use submit_bio_noacct_add_head for split bio sending back dannyshih
2020-12-29  9:18   ` [dm-devel] " dannyshih
2020-12-29  9:18 ` [PATCH 3/4] dm: " dannyshih
2020-12-29  9:18   ` [dm-devel] " dannyshih
2020-12-29  9:18 ` [PATCH 4/4] md: " dannyshih
2020-12-29  9:18   ` [dm-devel] " dannyshih
2020-12-30 23:34 ` [PATCH 0/4] Fix order when split bio and send remaining back to itself Mike Snitzer
2020-12-30 23:34   ` [dm-devel] " Mike Snitzer
2020-12-31  8:28   ` Danny Shih
2020-12-31  8:28     ` [dm-devel] " Danny Shih

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=1609233522-25837-2-git-send-email-dannyshih@synology.com \
    --to=dannyshih@synology.com \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=snitzer@redhat.com \
    --cc=song@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.