From: Chandan Rajendra <chandan@linux.ibm.com> To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fscrypt@vger.kernel.org Cc: Chandan Rajendra <chandan@linux.ibm.com>, tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, hch@infradead.org, chandanrlinux@gmail.com Subject: [PATCH V5 3/7] fs/mpage.c: Integrate read callbacks Date: Fri, 23 Aug 2019 18:55:38 +0530 [thread overview] Message-ID: <20190823132542.13434-4-chandan@linux.ibm.com> (raw) In-Reply-To: <20190823132542.13434-1-chandan@linux.ibm.com> This commit adds code to make do_mpage_readpage() to be "read callbacks" aware i.e. for files requiring decryption, do_mpage_readpage() now sets up the read callbacks state machine when allocating a bio and later starts execution of the state machine after file data is read from the underlying disk. Signed-off-by: Chandan Rajendra <chandan@linux.ibm.com> --- fs/mpage.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 3f19da75178b..65e7165644e2 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -30,6 +30,7 @@ #include <linux/backing-dev.h> #include <linux/pagevec.h> #include <linux/cleancache.h> +#include <linux/read_callbacks.h> #include "internal.h" /* @@ -44,7 +45,7 @@ * status of that page is hard. See end_buffer_async_read() for the details. * There is no point in duplicating all that complexity. */ -static void mpage_end_io(struct bio *bio) +static void end_bio(struct bio *bio) { struct bio_vec *bv; int i; @@ -52,13 +53,24 @@ static void mpage_end_io(struct bio *bio) bio_for_each_segment_all(bv, bio, i, iter_all) { struct page *page = bv->bv_page; - page_endio(page, bio_op(bio), - blk_status_to_errno(bio->bi_status)); + int err; + + err = blk_status_to_errno(bio->bi_status); + + if (!err && read_callbacks_failed(page)) + err = -EIO; + + page_endio(page, bio_op(bio), err); } bio_put(bio); } +static void mpage_end_io(struct bio *bio) +{ + read_callbacks_endio_bio(bio, end_bio); +} + static struct bio *mpage_bio_submit(int op, int op_flags, struct bio *bio) { bio->bi_end_io = mpage_end_io; @@ -310,6 +322,12 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) gfp); if (args->bio == NULL) goto confused; + + if (read_callbacks_setup_bio(inode, args->bio)) { + bio_put(args->bio); + args->bio = NULL; + goto confused; + } } length = first_hole << blkbits; -- 2.19.1
next prev parent reply other threads:[~2019-08-23 13:24 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-23 13:25 [PATCH V5 0/7] Consolidate FS read I/O callbacks code Chandan Rajendra 2019-08-23 13:25 ` [PATCH V5 1/7] buffer_head: Introduce BH_Read_Cb flag Chandan Rajendra 2019-08-23 13:25 ` [PATCH V5 2/7] FS: Introduce read callbacks Chandan Rajendra 2019-08-23 13:25 ` Chandan Rajendra [this message] 2019-08-23 13:25 ` [PATCH V5 4/7] fs/buffer.c: add decryption support via read_callbacks Chandan Rajendra 2019-08-23 13:25 ` [PATCH V5 5/7] ext4: Wire up ext4_readpage[s] to use mpage_readpage[s] Chandan Rajendra 2019-08-23 13:25 ` [PATCH V5 6/7] ext4: Enable encryption for subpage-sized blocks Chandan Rajendra 2019-08-23 13:25 ` [PATCH V5 7/7] fscrypt: remove struct fscrypt_ctx Chandan Rajendra 2019-09-02 4:38 ` [PATCH V5 0/7] Consolidate FS read I/O callbacks code Chandan Rajendra
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=20190823132542.13434-4-chandan@linux.ibm.com \ --to=chandan@linux.ibm.com \ --cc=adilger.kernel@dilger.ca \ --cc=chandanrlinux@gmail.com \ --cc=ebiggers@kernel.org \ --cc=hch@infradead.org \ --cc=linux-ext4@vger.kernel.org \ --cc=linux-fscrypt@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=tytso@mit.edu \ --subject='Re: [PATCH V5 3/7] fs/mpage.c: Integrate read callbacks' \ /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
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).