Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: cluster-devel@redhat.com, Christoph Hellwig <hch@lst.de>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 08/10] iomap: New iomap_written operation
Date: Fri, 12 Jan 2018 08:53:59 +1100	[thread overview]
Message-ID: <20180111215359.GB27323@dastard> (raw)
In-Reply-To: <20180111211506.328-9-agruenba@redhat.com>

On Thu, Jan 11, 2018 at 10:15:02PM +0100, Andreas Gruenbacher wrote:
> Add a callback to iomap_file_buffered_write that's called whenever
> writing to a page has completed.  This is needed for implementing data
> journaling: in the data journaling case, pages are written into the
> journal before being written back to their proper on-disk locations.
> 
> (So far, the only user of iomap_file_buffered_write is xfs, which
> doesn't do data journaling.)
> 
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  fs/iomap.c            | 21 +++++++++++++++++++--
>  include/linux/iomap.h |  9 +++++++++
>  2 files changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 47d29ccffaef..98903be66c35 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -149,11 +149,21 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
>  	return ret;
>  }
>  
> +struct iomap_write_data {
> +	struct iov_iter *iter;
> +	const struct iomap_ops *ops;
> +};
> +
>  static loff_t
>  iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>  		struct iomap *iomap)
>  {
> -	struct iov_iter *i = data;
> +	struct iomap_write_data *d = data;
> +	struct iov_iter *i = d->iter;
> +	void (*iomap_written)(struct inode *inode, struct page *page,
> +			      unsigned int offset, unsigned int length,
> +			      unsigned int written) =
> +		d->ops->iomap_written;
>  	long status = 0;
>  	ssize_t written = 0;
>  	unsigned int flags = AOP_FLAG_NOFS;
> @@ -198,6 +208,9 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>  
>  		flush_dcache_page(page);
>  
> +		if (iomap_written)
> +			iomap_written(inode, page, offset, bytes, copied);
> +
>  		status = iomap_write_end(inode, pos, bytes, copied, page);
>  		if (unlikely(status < 0))
>  			break;

This looks like it should replace iomap_write_end() as it has
pretty much the same parameters are passed to it.

i.e. it seems to me like a better solution would be to add
->write_begin/->write_end ops to the struct iomap_ops and have
existing implementations set them up as iomap_write_begin()/
iomap_write_end(). Then gfs2 can do it's special little extra bit
and then call iomap_write_end() in the one call...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-01-11 21:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 21:14 [PATCH 00/10] gfs2 iomap buffered write support Andreas Gruenbacher
2018-01-11 21:14 ` [PATCH 01/10] gfs2: Typo fixes Andreas Gruenbacher
2018-01-11 21:14 ` [PATCH 02/10] gfs2: Add gfs2_max_stuffed_size Andreas Gruenbacher
2018-01-11 21:14 ` [PATCH 03/10] gfs2: Minor gfs2_page_add_databufs cleanup Andreas Gruenbacher
2018-01-11 21:14 ` [PATCH 04/10] gfs2: gfs2_stuffed_write_end cleanup Andreas Gruenbacher
2018-01-11 21:14 ` [PATCH 05/10] gfs2: gfs2_stuffed_write_end cleanup (fixup) Andreas Gruenbacher
2018-01-11 21:15 ` [PATCH 06/10] gfs2: Remove ordered write mode handling from gfs2_trans_add_data Andreas Gruenbacher
2018-01-11 21:15 ` [PATCH 07/10] gfs2: Iomap cleanups and improvements Andreas Gruenbacher
2018-01-11 21:15 ` [PATCH 08/10] iomap: New iomap_written operation Andreas Gruenbacher
2018-01-11 21:53   ` Dave Chinner [this message]
2018-01-11 21:15 ` [PATCH 09/10] gfs2: Implement buffered iomap write support (1) Andreas Gruenbacher
2018-01-11 21:19   ` Andreas Grünbacher
2018-01-11 21:15 ` [PATCH 09/10] gfs2: Implement iomap buffered " Andreas Gruenbacher
2018-01-11 21:15 ` [PATCH 10/10] gfs2: Implement buffered iomap write support (2) Andreas Gruenbacher
2018-01-11 21:20   ` Andreas Gruenbacher
2018-01-11 21:15 ` [PATCH 10/10] gfs2: Implement iomap buffered " Andreas Gruenbacher
2018-01-12 10:26 ` [Cluster-devel] [PATCH 00/10] gfs2 iomap buffered write support Steven Whitehouse

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=20180111215359.GB27323@dastard \
    --to=david@fromorbit.com \
    --cc=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --subject='Re: [PATCH 08/10] iomap: New iomap_written operation' \
    /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).