All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, xfs@oss.sgi.com
Subject: Re: vfs/xfs: directio updates to ease COW handling V2
Date: Wed, 3 Feb 2016 12:01:59 -0800	[thread overview]
Message-ID: <20160203200159.GK20038@birch.djwong.org> (raw)
In-Reply-To: <x49zivhy3zt.fsf@segfault.boston.devel.redhat.com>

On Wed, Feb 03, 2016 at 02:43:02PM -0500, Jeff Moyer wrote:
> Hi, Christoph,
> 
> Can you explain a bit what you mean by easing COW handling?  Whenever I
> see COW referenced near DIO, my mind always turns to g_u_p vs. fork.

Just to clarify, I'm talking about copy on write for disk blocks, not for
memory pages.

Basically, XFS implements (disk block) copy on write for (perfectly block
aligned) directio writes by allocating a set of replacement blocks, mapping the
dio writes to the new blocks, and playing a punch/remap trick to map the new
blocks into the file at the appropriate offset.

If the write fails then we don't want do the remap, so the dio_complete handler
has to know whether or not the IO succeeded, hence the new parameter.
Furthermore, if the write succeeds but the remap fails, we also want to be able
to report that to userspace, hence the change of return value from void to int.

(If the dio write isn't block aligned, we fall back to the page cache.)

Hope that helps,

--D

> 
> Thanks!
> Jeff
> 
> Christoph Hellwig <hch@lst.de> writes:
> 
> > See http://www.infradead.org/rpr.html
> >
> > The first patch ensures ->end_io is always called for direct I/O requests
> > that pass it in, even if there was a zero length write, or if an error
> > occured.  The existing users have been updated to ignore it, but XFS
> > will make use of it in the future, and a comment in ext4 suggests it
> > might be useful for it as well.
> >
> > The other two simplify the XFS direct I/O code.
> >
> > Changes since V1:
> >  - allow ->end_io to return errors
> >  - a comment spelling fix
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>,
	ocfs2-devel@oss.oracle.com, xfs@oss.sgi.com
Subject: Re: vfs/xfs: directio updates to ease COW handling V2
Date: Wed, 3 Feb 2016 12:01:59 -0800	[thread overview]
Message-ID: <20160203200159.GK20038@birch.djwong.org> (raw)
In-Reply-To: <x49zivhy3zt.fsf@segfault.boston.devel.redhat.com>

On Wed, Feb 03, 2016 at 02:43:02PM -0500, Jeff Moyer wrote:
> Hi, Christoph,
> 
> Can you explain a bit what you mean by easing COW handling?  Whenever I
> see COW referenced near DIO, my mind always turns to g_u_p vs. fork.

Just to clarify, I'm talking about copy on write for disk blocks, not for
memory pages.

Basically, XFS implements (disk block) copy on write for (perfectly block
aligned) directio writes by allocating a set of replacement blocks, mapping the
dio writes to the new blocks, and playing a punch/remap trick to map the new
blocks into the file at the appropriate offset.

If the write fails then we don't want do the remap, so the dio_complete handler
has to know whether or not the IO succeeded, hence the new parameter.
Furthermore, if the write succeeds but the remap fails, we also want to be able
to report that to userspace, hence the change of return value from void to int.

(If the dio write isn't block aligned, we fall back to the page cache.)

Hope that helps,

--D

> 
> Thanks!
> Jeff
> 
> Christoph Hellwig <hch@lst.de> writes:
> 
> > See http://www.infradead.org/rpr.html
> >
> > The first patch ensures ->end_io is always called for direct I/O requests
> > that pass it in, even if there was a zero length write, or if an error
> > occured.  The existing users have been updated to ignore it, but XFS
> > will make use of it in the future, and a comment in ext4 suggests it
> > might be useful for it as well.
> >
> > The other two simplify the XFS direct I/O code.
> >
> > Changes since V1:
> >  - allow ->end_io to return errors
> >  - a comment spelling fix
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Darrick J. Wong <darrick.wong@oracle.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, xfs@oss.sgi.com
Subject: [Ocfs2-devel] vfs/xfs: directio updates to ease COW handling V2
Date: Wed, 3 Feb 2016 12:01:59 -0800	[thread overview]
Message-ID: <20160203200159.GK20038@birch.djwong.org> (raw)
In-Reply-To: <x49zivhy3zt.fsf@segfault.boston.devel.redhat.com>

On Wed, Feb 03, 2016 at 02:43:02PM -0500, Jeff Moyer wrote:
> Hi, Christoph,
> 
> Can you explain a bit what you mean by easing COW handling?  Whenever I
> see COW referenced near DIO, my mind always turns to g_u_p vs. fork.

Just to clarify, I'm talking about copy on write for disk blocks, not for
memory pages.

Basically, XFS implements (disk block) copy on write for (perfectly block
aligned) directio writes by allocating a set of replacement blocks, mapping the
dio writes to the new blocks, and playing a punch/remap trick to map the new
blocks into the file at the appropriate offset.

If the write fails then we don't want do the remap, so the dio_complete handler
has to know whether or not the IO succeeded, hence the new parameter.
Furthermore, if the write succeeds but the remap fails, we also want to be able
to report that to userspace, hence the change of return value from void to int.

(If the dio write isn't block aligned, we fall back to the page cache.)

Hope that helps,

--D

> 
> Thanks!
> Jeff
> 
> Christoph Hellwig <hch@lst.de> writes:
> 
> > See http://www.infradead.org/rpr.html
> >
> > The first patch ensures ->end_io is always called for direct I/O requests
> > that pass it in, even if there was a zero length write, or if an error
> > occured.  The existing users have been updated to ignore it, but XFS
> > will make use of it in the future, and a comment in ext4 suggests it
> > might be useful for it as well.
> >
> > The other two simplify the XFS direct I/O code.
> >
> > Changes since V1:
> >  - allow ->end_io to return errors
> >  - a comment spelling fix
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2016-02-03 20:02 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 18:40 vfs/xfs: directio updates to ease COW handling V2 Christoph Hellwig
2016-02-03 18:40 ` [Ocfs2-devel] " Christoph Hellwig
2016-02-03 18:40 ` Christoph Hellwig
2016-02-03 18:40 ` [PATCH 1/3] direct-io: always call ->end_io if non-NULL Christoph Hellwig
2016-02-03 18:40   ` [Ocfs2-devel] " Christoph Hellwig
2016-02-03 18:40   ` Christoph Hellwig
2016-02-03 19:55   ` Darrick J. Wong
2016-02-03 19:55     ` [Ocfs2-devel] " Darrick J. Wong
2016-02-03 19:55     ` Darrick J. Wong
2016-02-04  7:14     ` Christoph Hellwig
2016-02-04  7:14       ` [Ocfs2-devel] " Christoph Hellwig
2016-02-04  7:14       ` Christoph Hellwig
2016-02-04  8:17       ` Darrick J. Wong
2016-02-04  8:17         ` [Ocfs2-devel] " Darrick J. Wong
2016-02-04  8:17         ` Darrick J. Wong
2016-02-03 18:40 ` [PATCH 2/3] xfs: don't use ioends for direct write completions Christoph Hellwig
2016-02-03 18:40   ` [Ocfs2-devel] " Christoph Hellwig
2016-02-03 18:40   ` Christoph Hellwig
2016-02-05 21:57   ` Darrick J. Wong
2016-02-05 21:57     ` [Ocfs2-devel] " Darrick J. Wong
2016-02-05 21:57     ` Darrick J. Wong
2016-02-05 22:36     ` Dave Chinner
2016-02-05 22:36       ` [Ocfs2-devel] " Dave Chinner
2016-02-05 22:36       ` Dave Chinner
2016-02-08  1:00   ` Dave Chinner
2016-02-08  1:00     ` [Ocfs2-devel] " Dave Chinner
2016-02-08  1:00     ` Dave Chinner
2016-02-08  6:17     ` Dave Chinner
2016-02-08  6:17       ` [Ocfs2-devel] " Dave Chinner
2016-02-08  6:17       ` Dave Chinner
2016-02-08  7:31       ` Christoph Hellwig
2016-02-08  7:31         ` [Ocfs2-devel] " Christoph Hellwig
2016-02-08  7:31         ` Christoph Hellwig
2016-02-08  9:16         ` Dave Chinner
2016-02-08  9:16           ` [Ocfs2-devel] " Dave Chinner
2016-02-08  9:16           ` Dave Chinner
2016-02-08  9:22           ` Christoph Hellwig
2016-02-08  9:22             ` [Ocfs2-devel] " Christoph Hellwig
2016-02-08  9:22             ` Christoph Hellwig
2016-02-03 18:40 ` [PATCH 3/3] xfs: fold xfs_vm_do_dio into xfs_vm_direct_IO Christoph Hellwig
2016-02-03 18:40   ` [Ocfs2-devel] " Christoph Hellwig
2016-02-03 18:40   ` Christoph Hellwig
2016-02-03 18:40   ` Christoph Hellwig
2016-02-03 19:43 ` vfs/xfs: directio updates to ease COW handling V2 Jeff Moyer
2016-02-03 19:43   ` [Ocfs2-devel] " Jeff Moyer
2016-02-03 19:43   ` Jeff Moyer
2016-02-03 20:01   ` Darrick J. Wong [this message]
2016-02-03 20:01     ` [Ocfs2-devel] " Darrick J. Wong
2016-02-03 20:01     ` Darrick J. Wong
2016-02-03 21:53     ` Jeff Moyer
2016-02-03 21:53       ` [Ocfs2-devel] " Jeff Moyer
2016-02-03 21:53       ` Jeff Moyer

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=20160203200159.GK20038@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=jmoyer@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.