Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-24 Thread Chandan Rajendra
On Wednesday, April 24, 2019 7:54:23 PM IST Christoph Hellwig wrote:
> On Wed, Apr 24, 2019 at 03:34:17PM +0530, Chandan Rajendra wrote:
> > To clarify, Are you suggesting that a new kconfig option (say
> > CONFIG_FS_READ_CALLBACKS) be provided to the user so that the following 
> > could
> > occur,
> > 
> > 1. User selects CONFIG_FS_ENCRYPTION and/or CONFIG_FS_VERITY and this causes
> > CONFIG_FS_READ_CALLBACKS to be set to 'y'.
> > 2. User selects CONFIG_FS_READ_CALLBACKS explicitly.
> 
> If you don't add a user description to a Kconfig entry it won't be
> visible to users, but only selectable by other options.  That is what
> I suggest.
> 
> 

Thanks for the clarification. I will make the necessary changes.

-- 
chandan





___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-24 Thread Chandan Rajendra
On Wednesday, April 24, 2019 5:36:46 PM IST Jaegeuk Kim wrote:
> On 04/24, Chandan Rajendra wrote:
> > On Wednesday, April 24, 2019 2:01:26 PM IST Jaegeuk Kim wrote:
> > > Hi Chandan,
> > > 
> > > On 04/24, Chandan Rajendra wrote:
> > > > The post read processing code is used by both Ext4 and F2FS. Hence to
> > > > remove duplicity, this commit moves the code into
> > > > include/linux/post_read_process.h and fs/post_read_process.c.
> > > > 
> > > > The corresponding decrypt and verity "work" functions have been moved
> > > > inside fscrypt and fsverity sources. With these in place, the post
> > > > processing code now has to just invoke enqueue functions provided by
> > > > fscrypt and fsverity.
> > > > 
> > > > Signed-off-by: Chandan Rajendra 
> > > > ---
> > > >  fs/Makefile   |   4 +
> > > >  fs/crypto/bio.c   |  23 ++--
> > > >  fs/crypto/crypto.c|  17 +--
> > > >  fs/crypto/fscrypt_private.h   |   3 +
> > > >  fs/ext4/ext4.h|   2 -
> > > >  fs/ext4/readpage.c| 175 --
> > > >  fs/ext4/super.c   |   9 +-
> > > >  fs/f2fs/data.c| 146 -
> > > >  fs/f2fs/super.c   |   9 +-
> > > >  fs/post_read_process.c| 136 +++
> > > >  fs/verity/verify.c|  12 ++
> > > >  include/linux/fscrypt.h   |  20 +---
> > > >  include/linux/post_read_process.h |  21 
> > > >  13 files changed, 240 insertions(+), 337 deletions(-)
> > > >  create mode 100644 fs/post_read_process.c
> > > >  create mode 100644 include/linux/post_read_process.h
> > > > 
> > > > diff --git a/fs/Makefile b/fs/Makefile
> > > > index 9dd2186e74b5..f9abc3f71d3c 100644
> > > > --- a/fs/Makefile
> > > > +++ b/fs/Makefile
> > > > @@ -21,6 +21,10 @@ else
> > > >  obj-y +=   no-block.o
> > > >  endif
> > > >  
> > > > +ifeq (y, $(firstword $(filter y,$(CONFIG_FS_ENCRYPTION) 
> > > > $(CONFIG_FS_VERITY
> > > > +obj-y +=   post_read_process.o
> > > > +endif
> > > > +
> > > >  obj-$(CONFIG_PROC_FS) += proc_namespace.o
> > > >  
> > > >  obj-y  += notify/
> > > > diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
> > > > index 5759bcd018cd..3e40d65ae6a8 100644
> > > > --- a/fs/crypto/bio.c
> > > > +++ b/fs/crypto/bio.c
> > > > @@ -24,6 +24,8 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > > +
> > > >  #include "fscrypt_private.h"
> > > >  
> > > >  static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
> > > > @@ -54,24 +56,15 @@ void fscrypt_decrypt_bio(struct bio *bio)
> > > >  }
> > > >  EXPORT_SYMBOL(fscrypt_decrypt_bio);
> > > >  
> > > > -static void completion_pages(struct work_struct *work)
> > > > +void fscrypt_decrypt_work(struct work_struct *work)
> > > >  {
> > > > -   struct fscrypt_ctx *ctx =
> > > > -   container_of(work, struct fscrypt_ctx, r.work);
> > > > -   struct bio *bio = ctx->r.bio;
> > > > +   struct bio_post_read_ctx *ctx =
> > > > +   container_of(work, struct bio_post_read_ctx, work);
> > > >  
> > > > -   __fscrypt_decrypt_bio(bio, true);
> > > > -   fscrypt_release_ctx(ctx);
> > > > -   bio_put(bio);
> > > > -}
> > > > +   fscrypt_decrypt_bio(ctx->bio);
> > > >  
> > > > -void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, struct bio 
> > > > *bio)
> > > > -{
> > > > -   INIT_WORK(>r.work, completion_pages);
> > > > -   ctx->r.bio = bio;
> > > > -   fscrypt_enqueue_decrypt_work(>r.work);
> > > > +   bio_post_read_processing(ctx);
> > > >  }
> > > > -EXPORT_SYMBOL(fscrypt_enqueue_decrypt_bio);
> > > >  
> > > >  void fscrypt_pullback_bio_page(struct page **page, bool restore)
> > > >  {
> > > > @@ -87,7 +80,7 @@ void fscrypt_pullback_bio_page(struct page **page, 
> > > > bool restore)
> > > > ctx = (struct fscrypt_ctx *)page_private(bounce_page);
> > > >  
> > > > /* restore control page */
> > > > -   *page = ctx->w.control_page;
> > > > +   *page = ctx->control_page;
> > > >  
> > > > if (restore)
> > > > fscrypt_restore_control_page(bounce_page);
> > > > diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
> > > > index 3fc84bf2b1e5..ffa9302a7351 100644
> > > > --- a/fs/crypto/crypto.c
> > > > +++ b/fs/crypto/crypto.c
> > > > @@ -53,6 +53,7 @@ struct kmem_cache *fscrypt_info_cachep;
> > > >  
> > > >  void fscrypt_enqueue_decrypt_work(struct work_struct *work)
> > > >  {
> > > > +   INIT_WORK(work, fscrypt_decrypt_work);
> > > > queue_work(fscrypt_read_workqueue, work);
> > > >  }
> > > >  EXPORT_SYMBOL(fscrypt_enqueue_decrypt_work);
> > > > @@ -70,11 +71,11 @@ void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
> > > >  {
> > > > unsigned long flags;
> > > >  
> > > > -   if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && 
> > > > ctx->w.bounce_page) {
> > > > -   

Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-24 Thread Christoph Hellwig
On Wed, Apr 24, 2019 at 03:34:17PM +0530, Chandan Rajendra wrote:
> To clarify, Are you suggesting that a new kconfig option (say
> CONFIG_FS_READ_CALLBACKS) be provided to the user so that the following could
> occur,
> 
> 1. User selects CONFIG_FS_ENCRYPTION and/or CONFIG_FS_VERITY and this causes
> CONFIG_FS_READ_CALLBACKS to be set to 'y'.
> 2. User selects CONFIG_FS_READ_CALLBACKS explicitly.

If you don't add a user description to a Kconfig entry it won't be
visible to users, but only selectable by other options.  That is what
I suggest.


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-24 Thread Jaegeuk Kim
On 04/24, Chandan Rajendra wrote:
> On Wednesday, April 24, 2019 2:01:26 PM IST Jaegeuk Kim wrote:
> > Hi Chandan,
> > 
> > On 04/24, Chandan Rajendra wrote:
> > > The post read processing code is used by both Ext4 and F2FS. Hence to
> > > remove duplicity, this commit moves the code into
> > > include/linux/post_read_process.h and fs/post_read_process.c.
> > > 
> > > The corresponding decrypt and verity "work" functions have been moved
> > > inside fscrypt and fsverity sources. With these in place, the post
> > > processing code now has to just invoke enqueue functions provided by
> > > fscrypt and fsverity.
> > > 
> > > Signed-off-by: Chandan Rajendra 
> > > ---
> > >  fs/Makefile   |   4 +
> > >  fs/crypto/bio.c   |  23 ++--
> > >  fs/crypto/crypto.c|  17 +--
> > >  fs/crypto/fscrypt_private.h   |   3 +
> > >  fs/ext4/ext4.h|   2 -
> > >  fs/ext4/readpage.c| 175 --
> > >  fs/ext4/super.c   |   9 +-
> > >  fs/f2fs/data.c| 146 -
> > >  fs/f2fs/super.c   |   9 +-
> > >  fs/post_read_process.c| 136 +++
> > >  fs/verity/verify.c|  12 ++
> > >  include/linux/fscrypt.h   |  20 +---
> > >  include/linux/post_read_process.h |  21 
> > >  13 files changed, 240 insertions(+), 337 deletions(-)
> > >  create mode 100644 fs/post_read_process.c
> > >  create mode 100644 include/linux/post_read_process.h
> > > 
> > > diff --git a/fs/Makefile b/fs/Makefile
> > > index 9dd2186e74b5..f9abc3f71d3c 100644
> > > --- a/fs/Makefile
> > > +++ b/fs/Makefile
> > > @@ -21,6 +21,10 @@ else
> > >  obj-y += no-block.o
> > >  endif
> > >  
> > > +ifeq (y, $(firstword $(filter y,$(CONFIG_FS_ENCRYPTION) 
> > > $(CONFIG_FS_VERITY
> > > +obj-y += post_read_process.o
> > > +endif
> > > +
> > >  obj-$(CONFIG_PROC_FS) += proc_namespace.o
> > >  
> > >  obj-y+= notify/
> > > diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
> > > index 5759bcd018cd..3e40d65ae6a8 100644
> > > --- a/fs/crypto/bio.c
> > > +++ b/fs/crypto/bio.c
> > > @@ -24,6 +24,8 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > > +
> > >  #include "fscrypt_private.h"
> > >  
> > >  static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
> > > @@ -54,24 +56,15 @@ void fscrypt_decrypt_bio(struct bio *bio)
> > >  }
> > >  EXPORT_SYMBOL(fscrypt_decrypt_bio);
> > >  
> > > -static void completion_pages(struct work_struct *work)
> > > +void fscrypt_decrypt_work(struct work_struct *work)
> > >  {
> > > - struct fscrypt_ctx *ctx =
> > > - container_of(work, struct fscrypt_ctx, r.work);
> > > - struct bio *bio = ctx->r.bio;
> > > + struct bio_post_read_ctx *ctx =
> > > + container_of(work, struct bio_post_read_ctx, work);
> > >  
> > > - __fscrypt_decrypt_bio(bio, true);
> > > - fscrypt_release_ctx(ctx);
> > > - bio_put(bio);
> > > -}
> > > + fscrypt_decrypt_bio(ctx->bio);
> > >  
> > > -void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, struct bio 
> > > *bio)
> > > -{
> > > - INIT_WORK(>r.work, completion_pages);
> > > - ctx->r.bio = bio;
> > > - fscrypt_enqueue_decrypt_work(>r.work);
> > > + bio_post_read_processing(ctx);
> > >  }
> > > -EXPORT_SYMBOL(fscrypt_enqueue_decrypt_bio);
> > >  
> > >  void fscrypt_pullback_bio_page(struct page **page, bool restore)
> > >  {
> > > @@ -87,7 +80,7 @@ void fscrypt_pullback_bio_page(struct page **page, bool 
> > > restore)
> > >   ctx = (struct fscrypt_ctx *)page_private(bounce_page);
> > >  
> > >   /* restore control page */
> > > - *page = ctx->w.control_page;
> > > + *page = ctx->control_page;
> > >  
> > >   if (restore)
> > >   fscrypt_restore_control_page(bounce_page);
> > > diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
> > > index 3fc84bf2b1e5..ffa9302a7351 100644
> > > --- a/fs/crypto/crypto.c
> > > +++ b/fs/crypto/crypto.c
> > > @@ -53,6 +53,7 @@ struct kmem_cache *fscrypt_info_cachep;
> > >  
> > >  void fscrypt_enqueue_decrypt_work(struct work_struct *work)
> > >  {
> > > + INIT_WORK(work, fscrypt_decrypt_work);
> > >   queue_work(fscrypt_read_workqueue, work);
> > >  }
> > >  EXPORT_SYMBOL(fscrypt_enqueue_decrypt_work);
> > > @@ -70,11 +71,11 @@ void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
> > >  {
> > >   unsigned long flags;
> > >  
> > > - if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && ctx->w.bounce_page) {
> > > - mempool_free(ctx->w.bounce_page, fscrypt_bounce_page_pool);
> > > - ctx->w.bounce_page = NULL;
> > > + if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && ctx->bounce_page) {
> > > + mempool_free(ctx->bounce_page, fscrypt_bounce_page_pool);
> > > + ctx->bounce_page = NULL;
> > >   }
> > > - ctx->w.control_page = NULL;
> > > + ctx->control_page = NULL;
> > >   if (ctx->flags & FS_CTX_REQUIRES_FREE_ENCRYPT_FL) {
> > >   

Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-24 Thread Chandan Rajendra
On Wednesday, April 24, 2019 11:05:44 AM IST Christoph Hellwig wrote:
> On Wed, Apr 24, 2019 at 10:07:18AM +0530, Chandan Rajendra wrote:
> > +ifeq (y, $(firstword $(filter y,$(CONFIG_FS_ENCRYPTION) 
> > $(CONFIG_FS_VERITY
> > +obj-y +=   post_read_process.o
> > +endif
> 
> Please just add a new config option selected by the users.
>

Hi Christoph,

To clarify, Are you suggesting that a new kconfig option (say
CONFIG_FS_READ_CALLBACKS) be provided to the user so that the following could
occur,

1. User selects CONFIG_FS_ENCRYPTION and/or CONFIG_FS_VERITY and this causes
CONFIG_FS_READ_CALLBACKS to be set to 'y'.
2. User selects CONFIG_FS_READ_CALLBACKS explicitly.


> Also I find the file name rather cumbersome.  Maybe just
> read-callbacks.[co] ?
> 

I will do this.

-- 
chandan





___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-24 Thread Jaegeuk Kim
Hi Chandan,

On 04/24, Chandan Rajendra wrote:
> The post read processing code is used by both Ext4 and F2FS. Hence to
> remove duplicity, this commit moves the code into
> include/linux/post_read_process.h and fs/post_read_process.c.
> 
> The corresponding decrypt and verity "work" functions have been moved
> inside fscrypt and fsverity sources. With these in place, the post
> processing code now has to just invoke enqueue functions provided by
> fscrypt and fsverity.
> 
> Signed-off-by: Chandan Rajendra 
> ---
>  fs/Makefile   |   4 +
>  fs/crypto/bio.c   |  23 ++--
>  fs/crypto/crypto.c|  17 +--
>  fs/crypto/fscrypt_private.h   |   3 +
>  fs/ext4/ext4.h|   2 -
>  fs/ext4/readpage.c| 175 --
>  fs/ext4/super.c   |   9 +-
>  fs/f2fs/data.c| 146 -
>  fs/f2fs/super.c   |   9 +-
>  fs/post_read_process.c| 136 +++
>  fs/verity/verify.c|  12 ++
>  include/linux/fscrypt.h   |  20 +---
>  include/linux/post_read_process.h |  21 
>  13 files changed, 240 insertions(+), 337 deletions(-)
>  create mode 100644 fs/post_read_process.c
>  create mode 100644 include/linux/post_read_process.h
> 
> diff --git a/fs/Makefile b/fs/Makefile
> index 9dd2186e74b5..f9abc3f71d3c 100644
> --- a/fs/Makefile
> +++ b/fs/Makefile
> @@ -21,6 +21,10 @@ else
>  obj-y += no-block.o
>  endif
>  
> +ifeq (y, $(firstword $(filter y,$(CONFIG_FS_ENCRYPTION) 
> $(CONFIG_FS_VERITY
> +obj-y += post_read_process.o
> +endif
> +
>  obj-$(CONFIG_PROC_FS) += proc_namespace.o
>  
>  obj-y+= notify/
> diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
> index 5759bcd018cd..3e40d65ae6a8 100644
> --- a/fs/crypto/bio.c
> +++ b/fs/crypto/bio.c
> @@ -24,6 +24,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +
>  #include "fscrypt_private.h"
>  
>  static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
> @@ -54,24 +56,15 @@ void fscrypt_decrypt_bio(struct bio *bio)
>  }
>  EXPORT_SYMBOL(fscrypt_decrypt_bio);
>  
> -static void completion_pages(struct work_struct *work)
> +void fscrypt_decrypt_work(struct work_struct *work)
>  {
> - struct fscrypt_ctx *ctx =
> - container_of(work, struct fscrypt_ctx, r.work);
> - struct bio *bio = ctx->r.bio;
> + struct bio_post_read_ctx *ctx =
> + container_of(work, struct bio_post_read_ctx, work);
>  
> - __fscrypt_decrypt_bio(bio, true);
> - fscrypt_release_ctx(ctx);
> - bio_put(bio);
> -}
> + fscrypt_decrypt_bio(ctx->bio);
>  
> -void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, struct bio *bio)
> -{
> - INIT_WORK(>r.work, completion_pages);
> - ctx->r.bio = bio;
> - fscrypt_enqueue_decrypt_work(>r.work);
> + bio_post_read_processing(ctx);
>  }
> -EXPORT_SYMBOL(fscrypt_enqueue_decrypt_bio);
>  
>  void fscrypt_pullback_bio_page(struct page **page, bool restore)
>  {
> @@ -87,7 +80,7 @@ void fscrypt_pullback_bio_page(struct page **page, bool 
> restore)
>   ctx = (struct fscrypt_ctx *)page_private(bounce_page);
>  
>   /* restore control page */
> - *page = ctx->w.control_page;
> + *page = ctx->control_page;
>  
>   if (restore)
>   fscrypt_restore_control_page(bounce_page);
> diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
> index 3fc84bf2b1e5..ffa9302a7351 100644
> --- a/fs/crypto/crypto.c
> +++ b/fs/crypto/crypto.c
> @@ -53,6 +53,7 @@ struct kmem_cache *fscrypt_info_cachep;
>  
>  void fscrypt_enqueue_decrypt_work(struct work_struct *work)
>  {
> + INIT_WORK(work, fscrypt_decrypt_work);
>   queue_work(fscrypt_read_workqueue, work);
>  }
>  EXPORT_SYMBOL(fscrypt_enqueue_decrypt_work);
> @@ -70,11 +71,11 @@ void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
>  {
>   unsigned long flags;
>  
> - if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && ctx->w.bounce_page) {
> - mempool_free(ctx->w.bounce_page, fscrypt_bounce_page_pool);
> - ctx->w.bounce_page = NULL;
> + if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && ctx->bounce_page) {
> + mempool_free(ctx->bounce_page, fscrypt_bounce_page_pool);
> + ctx->bounce_page = NULL;
>   }
> - ctx->w.control_page = NULL;
> + ctx->control_page = NULL;
>   if (ctx->flags & FS_CTX_REQUIRES_FREE_ENCRYPT_FL) {
>   kmem_cache_free(fscrypt_ctx_cachep, ctx);
>   } else {
> @@ -194,11 +195,11 @@ int fscrypt_do_page_crypto(const struct inode *inode, 
> fscrypt_direction_t rw,
>  struct page *fscrypt_alloc_bounce_page(struct fscrypt_ctx *ctx,
>  gfp_t gfp_flags)
>  {
> - ctx->w.bounce_page = mempool_alloc(fscrypt_bounce_page_pool, gfp_flags);
> - if (ctx->w.bounce_page == NULL)
> + ctx->bounce_page = mempool_alloc(fscrypt_bounce_page_pool, 

Re: [f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-23 Thread Christoph Hellwig
On Wed, Apr 24, 2019 at 10:07:18AM +0530, Chandan Rajendra wrote:
> +ifeq (y, $(firstword $(filter y,$(CONFIG_FS_ENCRYPTION) 
> $(CONFIG_FS_VERITY
> +obj-y += post_read_process.o
> +endif

Please just add a new config option selected by the users.

Also I find the file name rather cumbersome.  Maybe just
read-callbacks.[co] ?


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH V1 02/14] Consolidate "post read processing" into a new file

2019-04-23 Thread Chandan Rajendra
The post read processing code is used by both Ext4 and F2FS. Hence to
remove duplicity, this commit moves the code into
include/linux/post_read_process.h and fs/post_read_process.c.

The corresponding decrypt and verity "work" functions have been moved
inside fscrypt and fsverity sources. With these in place, the post
processing code now has to just invoke enqueue functions provided by
fscrypt and fsverity.

Signed-off-by: Chandan Rajendra 
---
 fs/Makefile   |   4 +
 fs/crypto/bio.c   |  23 ++--
 fs/crypto/crypto.c|  17 +--
 fs/crypto/fscrypt_private.h   |   3 +
 fs/ext4/ext4.h|   2 -
 fs/ext4/readpage.c| 175 --
 fs/ext4/super.c   |   9 +-
 fs/f2fs/data.c| 146 -
 fs/f2fs/super.c   |   9 +-
 fs/post_read_process.c| 136 +++
 fs/verity/verify.c|  12 ++
 include/linux/fscrypt.h   |  20 +---
 include/linux/post_read_process.h |  21 
 13 files changed, 240 insertions(+), 337 deletions(-)
 create mode 100644 fs/post_read_process.c
 create mode 100644 include/linux/post_read_process.h

diff --git a/fs/Makefile b/fs/Makefile
index 9dd2186e74b5..f9abc3f71d3c 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -21,6 +21,10 @@ else
 obj-y +=   no-block.o
 endif
 
+ifeq (y, $(firstword $(filter y,$(CONFIG_FS_ENCRYPTION) $(CONFIG_FS_VERITY
+obj-y +=   post_read_process.o
+endif
+
 obj-$(CONFIG_PROC_FS) += proc_namespace.o
 
 obj-y  += notify/
diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
index 5759bcd018cd..3e40d65ae6a8 100644
--- a/fs/crypto/bio.c
+++ b/fs/crypto/bio.c
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include "fscrypt_private.h"
 
 static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
@@ -54,24 +56,15 @@ void fscrypt_decrypt_bio(struct bio *bio)
 }
 EXPORT_SYMBOL(fscrypt_decrypt_bio);
 
-static void completion_pages(struct work_struct *work)
+void fscrypt_decrypt_work(struct work_struct *work)
 {
-   struct fscrypt_ctx *ctx =
-   container_of(work, struct fscrypt_ctx, r.work);
-   struct bio *bio = ctx->r.bio;
+   struct bio_post_read_ctx *ctx =
+   container_of(work, struct bio_post_read_ctx, work);
 
-   __fscrypt_decrypt_bio(bio, true);
-   fscrypt_release_ctx(ctx);
-   bio_put(bio);
-}
+   fscrypt_decrypt_bio(ctx->bio);
 
-void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, struct bio *bio)
-{
-   INIT_WORK(>r.work, completion_pages);
-   ctx->r.bio = bio;
-   fscrypt_enqueue_decrypt_work(>r.work);
+   bio_post_read_processing(ctx);
 }
-EXPORT_SYMBOL(fscrypt_enqueue_decrypt_bio);
 
 void fscrypt_pullback_bio_page(struct page **page, bool restore)
 {
@@ -87,7 +80,7 @@ void fscrypt_pullback_bio_page(struct page **page, bool 
restore)
ctx = (struct fscrypt_ctx *)page_private(bounce_page);
 
/* restore control page */
-   *page = ctx->w.control_page;
+   *page = ctx->control_page;
 
if (restore)
fscrypt_restore_control_page(bounce_page);
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index 3fc84bf2b1e5..ffa9302a7351 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -53,6 +53,7 @@ struct kmem_cache *fscrypt_info_cachep;
 
 void fscrypt_enqueue_decrypt_work(struct work_struct *work)
 {
+   INIT_WORK(work, fscrypt_decrypt_work);
queue_work(fscrypt_read_workqueue, work);
 }
 EXPORT_SYMBOL(fscrypt_enqueue_decrypt_work);
@@ -70,11 +71,11 @@ void fscrypt_release_ctx(struct fscrypt_ctx *ctx)
 {
unsigned long flags;
 
-   if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && ctx->w.bounce_page) {
-   mempool_free(ctx->w.bounce_page, fscrypt_bounce_page_pool);
-   ctx->w.bounce_page = NULL;
+   if (ctx->flags & FS_CTX_HAS_BOUNCE_BUFFER_FL && ctx->bounce_page) {
+   mempool_free(ctx->bounce_page, fscrypt_bounce_page_pool);
+   ctx->bounce_page = NULL;
}
-   ctx->w.control_page = NULL;
+   ctx->control_page = NULL;
if (ctx->flags & FS_CTX_REQUIRES_FREE_ENCRYPT_FL) {
kmem_cache_free(fscrypt_ctx_cachep, ctx);
} else {
@@ -194,11 +195,11 @@ int fscrypt_do_page_crypto(const struct inode *inode, 
fscrypt_direction_t rw,
 struct page *fscrypt_alloc_bounce_page(struct fscrypt_ctx *ctx,
   gfp_t gfp_flags)
 {
-   ctx->w.bounce_page = mempool_alloc(fscrypt_bounce_page_pool, gfp_flags);
-   if (ctx->w.bounce_page == NULL)
+   ctx->bounce_page = mempool_alloc(fscrypt_bounce_page_pool, gfp_flags);
+   if (ctx->bounce_page == NULL)
return ERR_PTR(-ENOMEM);
ctx->flags |= FS_CTX_HAS_BOUNCE_BUFFER_FL;
-   return ctx->w.bounce_page;
+   return ctx->bounce_page;
 }
 
 /**
@@ -267,7 +268,7 @@