From: Bob Liu <bob.liu@oracle.com>
To: linux-block@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
martin.petersen@oracle.com, shirley.ma@oracle.com,
allison.henderson@oracle.com, david@fromorbit.com,
darrick.wong@oracle.com, hch@infradead.org, adilger@dilger.ca,
axboe@kernel.dk, tytso@mit.edu, Bob Liu <bob.liu@oracle.com>
Subject: [PATCH v3 1/3] block: introduce submit_bio_verify()
Date: Fri, 29 Mar 2019 22:23:44 +0800 [thread overview]
Message-ID: <20190329142346.1677-2-bob.liu@oracle.com> (raw)
In-Reply-To: <20190329142346.1677-1-bob.liu@oracle.com>
This patch adds a function verifier callback to submit_bio. The
filesystem layer can use submit_bio_verify to pass a call back
to the block layer which can then be used to verify if the data
read is correct.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
block/blk-core.c | 13 ++++++++++---
include/linux/bio.h | 2 ++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 6b78ec56a4f2..d265d2924c32 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1156,15 +1156,16 @@ blk_qc_t direct_make_request(struct bio *bio)
EXPORT_SYMBOL_GPL(direct_make_request);
/**
- * submit_bio - submit a bio to the block device layer for I/O
+ * submit_bio_verify - submit a bio to the block device layer for I/O
* @bio: The &struct bio which describes the I/O
*
- * submit_bio() is very similar in purpose to generic_make_request(), and
+ * submit_bio_verify() is very similar in purpose to generic_make_request(), and
* uses that function to do most of the work. Both are fairly rough
* interfaces; @bio must be presetup and ready for I/O.
*
*/
-blk_qc_t submit_bio(struct bio *bio)
+blk_qc_t submit_bio_verify(struct bio *bio,
+ int (*verifier_cb_func)(struct bio *))
{
/*
* If it's a regular read/write or a barrier with data attached,
@@ -1197,6 +1198,12 @@ blk_qc_t submit_bio(struct bio *bio)
return generic_make_request(bio);
}
+EXPORT_SYMBOL(submit_bio_verify);
+
+blk_qc_t submit_bio(struct bio *bio)
+{
+ return submit_bio_verify(bio, NULL);
+}
EXPORT_SYMBOL(submit_bio);
/**
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7380b094dcca..ddaadab74dcf 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -398,6 +398,8 @@ static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs)
return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL);
}
+extern blk_qc_t submit_bio_verify(struct bio *,
+ int (*verifier_cb_func)(struct bio *));
extern blk_qc_t submit_bio(struct bio *);
extern void bio_endio(struct bio *);
--
2.17.1
next prev parent reply other threads:[~2019-03-29 14:24 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 14:23 [RFC PATCH v3 0/3] Block/XFS: Support alternative mirror device retry Bob Liu
2019-03-29 14:23 ` Bob Liu [this message]
2019-03-29 22:22 ` [PATCH v3 1/3] block: introduce submit_bio_verify() Andreas Dilger
2019-03-30 1:43 ` Martin K. Petersen
2019-03-29 14:23 ` [PATCH v3 2/3] block: verify data when endio Bob Liu
2019-03-29 14:28 ` Jens Axboe
2019-03-29 14:34 ` Martin K. Petersen
2019-03-29 14:38 ` Jens Axboe
2019-03-29 14:46 ` Martin K. Petersen
2019-03-29 14:50 ` Jens Axboe
2019-03-29 14:51 ` Martin K. Petersen
2019-03-29 14:52 ` Jens Axboe
2019-03-29 15:00 ` Bob Liu
2019-03-29 15:03 ` Jens Axboe
2019-03-30 2:17 ` Martin K. Petersen
2019-03-31 22:00 ` Dave Chinner
2019-04-01 14:04 ` Martin K. Petersen
2019-04-01 21:21 ` Dave Chinner
2019-04-03 2:45 ` Martin K. Petersen
2019-04-03 22:21 ` Dave Chinner
2019-03-29 14:41 ` Bob Liu
2019-03-29 14:40 ` Bob Liu
2019-03-29 14:47 ` Jens Axboe
2019-03-30 0:20 ` Andreas Dilger
2019-03-29 15:39 ` Ming Lei
2019-03-29 14:23 ` [PATCH v3 3/3] fs: xfs: add read_verifier() function Bob Liu
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=20190329142346.1677-2-bob.liu@oracle.com \
--to=bob.liu@oracle.com \
--cc=adilger@dilger.ca \
--cc=allison.henderson@oracle.com \
--cc=axboe@kernel.dk \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=shirley.ma@oracle.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).