From: "ruansy.fnst@fujitsu.com" <ruansy.fnst@fujitsu.com>
To: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Cc: "darrick.wong@oracle.com" <darrick.wong@oracle.com>,
"willy@infradead.org" <willy@infradead.org>,
"jack@suse.cz" <jack@suse.cz>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>,
"david@fromorbit.com" <david@fromorbit.com>,
"hch@lst.de" <hch@lst.de>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
"rgoldwyn@suse.de" <rgoldwyn@suse.de>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 回复: [PATCH 1/7] fsdax: Output address in dax_iomap_pfn() and rename it
Date: Tue, 23 Feb 2021 01:32:11 +0000 [thread overview]
Message-ID: <OSBPR01MB2920F7474667D6D73A681D98F4809@OSBPR01MB2920.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <cd067457-5aaf-a2a9-06b0-953f49437500@linux.alibaba.com>
> hi,
>
> > Add address output in dax_iomap_pfn() in order to perform a memcpy() in
> > CoW case. Since this function both output address and pfn, rename it to
> > dax_iomap_direct_access().
> >
> > Signed-off-by: Shiyang Ruan <ruansy.fnst@cn.fujitsu.com>
> > ---
> > fs/dax.c | 20 +++++++++++++++-----
> > 1 file changed, 15 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/dax.c b/fs/dax.c
> > index 5b47834f2e1b..b012b2db7ba2 100644
> > --- a/fs/dax.c
> > +++ b/fs/dax.c
> > @@ -998,8 +998,8 @@ static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos)
> > return (iomap->addr + (pos & PAGE_MASK) - iomap->offset) >> 9;
> > }
> >
> > -static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
> > - pfn_t *pfnp)
> > +static int dax_iomap_direct_access(struct iomap *iomap, loff_t pos, size_t size,
> > + void **kaddr, pfn_t *pfnp)
> > {
> > const sector_t sector = dax_iomap_sector(iomap, pos);
> > pgoff_t pgoff;
> > @@ -1011,11 +1011,13 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
> > return rc;
> > id = dax_read_lock();
> > length = dax_direct_access(iomap->dax_dev, pgoff, PHYS_PFN(size),
> > - NULL, pfnp);
> > + kaddr, pfnp);
> > if (length < 0) {
> > rc = length;
> > goto out;
> > }
> > + if (!pfnp)
> Should this be "if (!*pfnp)"?
pfnp may be NULL if we only need a kaddr output.
`dax_iomap_direct_access(iomap, pos, size, &kaddr, NULL);`
So, it's a NULL pointer check here.
--
Thanks,
Ruan Shiyang.
>
> Regards,
> Xiaoguang Wang
> > + goto out_check_addr;
> > rc = -EINVAL;
> > if (PFN_PHYS(length) < size)
> > goto out;
> > @@ -1025,6 +1027,12 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
> > if (length > 1 && !pfn_t_devmap(*pfnp))
> > goto out;
> > rc = 0;
> > +
> > +out_check_addr:
> > + if (!kaddr)
> > + goto out;
> > + if (!*kaddr)
> > + rc = -EFAULT;
> > out:
> > dax_read_unlock(id);
> > return rc;
>
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
next prev parent reply other threads:[~2021-02-23 1:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-07 17:09 [PATCH 0/7] fsdax,xfs: Add reflink&dedupe support for fsdax Shiyang Ruan
2021-02-07 17:09 ` [PATCH 1/7] fsdax: Output address in dax_iomap_pfn() and rename it Shiyang Ruan
2021-02-08 15:11 ` Christoph Hellwig
2021-02-22 7:44 ` Xiaoguang Wang
2021-02-23 1:32 ` ruansy.fnst [this message]
2021-02-07 17:09 ` [PATCH 2/7] fsdax: Introduce dax_copy_edges() for CoW Shiyang Ruan
2021-02-08 15:11 ` Christoph Hellwig
2021-02-07 17:09 ` [PATCH 3/7] fsdax: Copy data before write Shiyang Ruan
2021-02-08 15:14 ` Christoph Hellwig
2021-02-09 1:53 ` Ruan Shiyang
2021-02-07 17:09 ` [PATCH 4/7] fsdax: Replace mmap entry in case of CoW Shiyang Ruan
2021-02-08 15:16 ` Christoph Hellwig
2021-02-16 13:11 ` David Sterba
2021-02-17 3:06 ` Ruan Shiyang
2021-02-07 17:09 ` [PATCH 5/7] fsdax: Dedup file range to use a compare function Shiyang Ruan
2021-02-08 15:19 ` Christoph Hellwig
2021-02-09 9:15 ` Ruan Shiyang
2021-02-09 9:34 ` Christoph Hellwig
2021-02-09 9:46 ` Ruan Shiyang
2021-02-10 13:19 ` Christoph Hellwig
2021-02-17 3:24 ` Ruan Shiyang
2021-02-18 16:20 ` Darrick J. Wong
2021-02-25 7:35 ` Christoph Hellwig
2021-02-07 17:09 ` [PATCH 6/7] fs/xfs: Handle CoW for fsdax write() path Shiyang Ruan
2021-02-08 15:24 ` Christoph Hellwig
2021-02-07 17:09 ` [PATCH 7/7] fs/xfs: Add dedupe support for fsdax Shiyang Ruan
2021-02-08 15:39 ` [PATCH 0/7] fsdax,xfs: Add reflink&dedupe " Jan Kara
2021-02-09 1:50 ` Ruan Shiyang
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=OSBPR01MB2920F7474667D6D73A681D98F4809@OSBPR01MB2920.jpnprd01.prod.outlook.com \
--to=ruansy.fnst@fujitsu.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.com \
--cc=rgoldwyn@suse.de \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=xiaoguang.wang@linux.alibaba.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 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).