diff mbox series

[6/6] iomap: add a page_done callback

Message ID 20180606104033.4947-7-hch@lst.de
State Not Applicable, archived
Headers show
Series [1/6] fs: factor out a __generic_write_end helper | expand

Commit Message

Christoph Hellwig June 6, 2018, 10:40 a.m. UTC
This will be used by gfs2 to attach data to transactions for the journaled
data mode.  But the concept is generic enough that we might be able to
use it for other purposes like encryption/integrity post-processing in the
future.

Based on a patch from Andreas Gruenbacher.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/iomap.c            | 3 +++
 include/linux/iomap.h | 8 ++++++++
 2 files changed, 11 insertions(+)

Comments

Andreas Gruenbacher June 6, 2018, 11:37 a.m. UTC | #1
On 6 June 2018 at 12:40, Christoph Hellwig <hch@lst.de> wrote:
> This will be used by gfs2 to attach data to transactions for the journaled
> data mode.  But the concept is generic enough that we might be able to
> use it for other purposes like encryption/integrity post-processing in the
> future.
>
> Based on a patch from Andreas Gruenbacher.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/iomap.c            | 3 +++
>  include/linux/iomap.h | 8 ++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/fs/iomap.c b/fs/iomap.c
> index f2a491b98b7c..a7ecdd5ddd17 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -201,6 +201,9 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
>                                 copied, page, NULL);
>         }
>
> +       if (iomap->page_done)
> +               iomap->page_done(inode, pos, copied, page, iomap);
> +
>         if (ret < len)
>                 iomap_write_failed(inode, pos, len);
>         return ret;
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 69ef622f650e..474e2255ac6e 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -58,6 +58,14 @@ struct iomap {
>                 struct dax_device   *dax_dev;
>                 void                *inline_data;
>         };
> +
> +       /*
> +        * Called when finished processing a page in the mapping returned in
> +        * thus iomap.  At least for now this is only supported in the buffered

"thus" -> "this"

> +        * write path.
> +        */
> +       void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
> +                       struct page *page, struct iomap *iomap);
>  };
>
>  /*
> --
> 2.14.2
>

Andreas
diff mbox series

Patch

diff --git a/fs/iomap.c b/fs/iomap.c
index f2a491b98b7c..a7ecdd5ddd17 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -201,6 +201,9 @@  iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
 				copied, page, NULL);
 	}
 
+	if (iomap->page_done)
+		iomap->page_done(inode, pos, copied, page, iomap);
+
 	if (ret < len)
 		iomap_write_failed(inode, pos, len);
 	return ret;
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 69ef622f650e..474e2255ac6e 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -58,6 +58,14 @@  struct iomap {
 		struct dax_device   *dax_dev;
 		void		    *inline_data;
 	};
+
+	/*
+	 * Called when finished processing a page in the mapping returned in
+	 * thus iomap.  At least for now this is only supported in the buffered
+	 * write path.
+	 */
+	void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
+			struct page *page, struct iomap *iomap);
 };
 
 /*