From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
hch@lst.de, david@fromorbit.com,
Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O
Date: Wed, 26 Jun 2019 08:21:48 +0200 [thread overview]
Message-ID: <20190626062148.GB23972@lst.de> (raw)
In-Reply-To: <20190622004624.GC1611011@magnolia>
On Fri, Jun 21, 2019 at 05:46:24PM -0700, Darrick J. Wong wrote:
> On Fri, Jun 21, 2019 at 02:28:23PM -0500, Goldwyn Rodrigues wrote:
> > From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> >
> > Introduces a new type IOMAP_COW, which means the data at offset
> > must be read from a srcmap and copied before performing the
> > write on the offset.
> >
> > The srcmap is used to identify where the read is to be performed
> > from. This is passed to iomap->begin(), which is supposed to
> > put in the details for reading, typically set with type IOMAP_READ.
>
> What is IOMAP_READ ?
The lack of flags. Which reminds me that our IOMAP_* types have
pretty much gotten out of hand in how we use some flags that really
are different types vs others that are modifiers. We'll need to clean
this up a bit eventually.
>
> >
> > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> > ---
> > fs/dax.c | 8 +++++---
> > fs/ext2/inode.c | 2 +-
> > fs/ext4/inode.c | 2 +-
> > fs/gfs2/bmap.c | 3 ++-
> > fs/internal.h | 2 +-
> > fs/iomap.c | 31 ++++++++++++++++---------------
> > fs/xfs/xfs_iomap.c | 9 ++++++---
> > include/linux/iomap.h | 4 +++-
> > 8 files changed, 35 insertions(+), 26 deletions(-)
> >
> > diff --git a/fs/dax.c b/fs/dax.c
> > index 2e48c7ebb973..80b9e2599223 100644
> > --- a/fs/dax.c
> > +++ b/fs/dax.c
> > @@ -1078,7 +1078,7 @@ EXPORT_SYMBOL_GPL(__dax_zero_page_range);
> >
> > static loff_t
> > dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
> > - struct iomap *iomap)
> > + struct iomap *iomap, struct iomap *srcmap)
> > {
> > struct block_device *bdev = iomap->bdev;
> > struct dax_device *dax_dev = iomap->dax_dev;
> > @@ -1236,6 +1236,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
> > unsigned long vaddr = vmf->address;
> > loff_t pos = (loff_t)vmf->pgoff << PAGE_SHIFT;
> > struct iomap iomap = { 0 };
> > + struct iomap srcmap = { 0 };
> > unsigned flags = IOMAP_FAULT;
> > int error, major = 0;
> > bool write = vmf->flags & FAULT_FLAG_WRITE;
> > @@ -1280,7 +1281,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
> > * the file system block size to be equal the page size, which means
> > * that we never have to deal with more than a single extent here.
> > */
> > - error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap);
> > + error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap, &srcmap);
> > if (iomap_errp)
> > *iomap_errp = error;
> > if (error) {
> > @@ -1460,6 +1461,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
> > struct inode *inode = mapping->host;
> > vm_fault_t result = VM_FAULT_FALLBACK;
> > struct iomap iomap = { 0 };
> > + struct iomap srcmap = { 0 };
> > pgoff_t max_pgoff;
> > void *entry;
> > loff_t pos;
> > @@ -1534,7 +1536,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
> > * to look up our filesystem block.
> > */
> > pos = (loff_t)xas.xa_index << PAGE_SHIFT;
> > - error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap);
> > + error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap, &srcmap);
>
> Line too long?
>
> Also, I guess the DAX and directio write paths will just WARN_ON_ONCE if
> someone feeds them an IOMAP_COW type iomap?
>
> Ah, right, I guess the only filesystems that use iomap directio and
> iomap dax don't support COW. :)
? XFS does iomap based cow for direct I/O. But we don't use IOMAP_COW
yey with this series as far as I can tell.
next prev parent reply other threads:[~2019-06-26 6:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 19:28 [PATCH 0/6] Btrfs iomap Goldwyn Rodrigues
2019-06-21 19:28 ` [PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O Goldwyn Rodrigues
2019-06-22 0:46 ` Darrick J. Wong
2019-06-25 19:17 ` Goldwyn Rodrigues
2019-06-26 6:21 ` Christoph Hellwig [this message]
2019-06-24 7:07 ` Christoph Hellwig
2019-06-25 19:14 ` Goldwyn Rodrigues
2019-06-26 1:36 ` Shiyang Ruan
2019-06-26 6:39 ` Christoph Hellwig
2019-06-26 16:10 ` Goldwyn Rodrigues
2019-06-26 17:34 ` Darrick J. Wong
2019-06-26 18:00 ` Darrick J. Wong
2019-06-26 18:42 ` Goldwyn Rodrigues
2019-06-21 19:28 ` [PATCH 2/6] iomap: Read page from srcmap for IOMAP_COW Goldwyn Rodrigues
2019-06-22 0:41 ` Darrick J. Wong
2019-06-21 19:28 ` [PATCH 3/6] iomap: Check iblocksize before transforming page->private Goldwyn Rodrigues
2019-06-22 0:21 ` Darrick J. Wong
2019-06-25 19:22 ` Goldwyn Rodrigues
2019-06-24 7:05 ` Christoph Hellwig
2019-06-25 18:56 ` Goldwyn Rodrigues
2019-06-25 20:04 ` Filipe Manana
2019-06-26 3:03 ` Goldwyn Rodrigues
2019-06-26 6:42 ` Nikolay Borisov
2019-06-26 6:16 ` Christoph Hellwig
2019-06-21 19:28 ` [PATCH 4/6] btrfs: Add a simple buffered iomap write Goldwyn Rodrigues
2019-06-21 19:28 ` [PATCH 5/6] btrfs: Add CoW in iomap based writes Goldwyn Rodrigues
2019-06-21 19:28 ` [PATCH 6/6] btrfs: remove buffered write code made unnecessary Goldwyn Rodrigues
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=20190626062148.GB23972@lst.de \
--to=hch@lst.de \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rgoldwyn@suse.com \
--cc=rgoldwyn@suse.de \
/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.