public inbox for [email protected]
 help / color / mirror / Atom feed
From: Mikulas Patocka <[email protected]>
To: JeffleXu <[email protected]>,
	Mike Snitzer <[email protected]>,
	Heinz Mauelshagen <[email protected]>,
	[email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected], [email protected]
Cc: Mikulas Patocka <[email protected]>
Subject: [PATCH 1/4] block: introduce a function submit_bio_noacct_mq_direct
Date: Tue, 02 Mar 2021 20:05:14 +0100	[thread overview]
Message-ID: <[email protected]> (raw)

[-- Attachment #1: block-submit-bio-mq-direct.patch --]
[-- Type: text/plain, Size: 1834 bytes --]

Introduce a function that submits bio to a request-based device driver.
The function doesn't offload requests to current->bio_list. It is expected
to be called from device mapper, where current->bio_list is already set
up.

Signed-off-by: Mikulas Patocka <[email protected]>

---
 block/blk-core.c       |   16 ++++++++++++++++
 include/linux/blkdev.h |    1 +
 2 files changed, 17 insertions(+)

Index: linux-2.6/block/blk-core.c
===================================================================
--- linux-2.6.orig/block/blk-core.c	2021-03-01 19:47:27.000000000 +0100
+++ linux-2.6/block/blk-core.c	2021-03-02 10:43:28.000000000 +0100
@@ -992,6 +992,22 @@ static blk_qc_t __submit_bio_noacct(stru
 	return ret;
 }
 
+blk_qc_t submit_bio_noacct_mq_direct(struct bio *bio)
+{
+	struct gendisk *disk = bio->bi_bdev->bd_disk;
+
+	if (unlikely(bio_queue_enter(bio) != 0))
+		return BLK_QC_T_NONE;
+	
+	if (!blk_crypto_bio_prep(&bio)) {
+		blk_queue_exit(disk->queue);
+		return BLK_QC_T_NONE;
+	}
+
+	return blk_mq_submit_bio(bio);
+}
+EXPORT_SYMBOL(submit_bio_noacct_mq_direct);
+
 static blk_qc_t __submit_bio_noacct_mq(struct bio *bio)
 {
 	struct bio_list bio_list[2] = { };
Index: linux-2.6/include/linux/blkdev.h
===================================================================
--- linux-2.6.orig/include/linux/blkdev.h	2021-03-01 19:47:29.000000000 +0100
+++ linux-2.6/include/linux/blkdev.h	2021-03-02 10:44:04.000000000 +0100
@@ -912,6 +912,7 @@ static inline void rq_flush_dcache_pages
 
 extern int blk_register_queue(struct gendisk *disk);
 extern void blk_unregister_queue(struct gendisk *disk);
+blk_qc_t submit_bio_noacct_mq_direct(struct bio *bio);
 blk_qc_t submit_bio_noacct(struct bio *bio);
 extern void blk_rq_init(struct request_queue *q, struct request *rq);
 extern void blk_put_request(struct request *);


             reply	other threads:[~2021-03-03  6:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 19:05 Mikulas Patocka [this message]
2021-03-04  0:37 ` [PATCH 1/4] block: introduce a function submit_bio_noacct_mq_direct Jens Axboe
2021-03-04 10:14   ` Mikulas Patocka
2021-03-05 16:05     ` 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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox