ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: "ruansy.fnst@fujitsu.com" <ruansy.fnst@fujitsu.com>
To: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Cc: "jack@suse.cz" <jack@suse.cz>,
	"darrick.wong@oracle.com" <darrick.wong@oracle.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"david@fromorbit.com" <david@fromorbit.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [Ocfs2-devel]  回复: [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;
> 
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

  reply	other threads:[~2021-02-26 16:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 17:09 [Ocfs2-devel] [PATCH 0/7] fsdax, xfs: Add reflink&dedupe support for fsdax Shiyang Ruan
2021-02-07 17:09 ` [Ocfs2-devel] [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 ` [Ocfs2-devel] [PATCH 2/7] fsdax: Introduce dax_copy_edges() for CoW Shiyang Ruan
2021-02-08 15:11   ` Christoph Hellwig
2021-02-07 17:09 ` [Ocfs2-devel] [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 ` [Ocfs2-devel] [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 ` [Ocfs2-devel] [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 ` [Ocfs2-devel] [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 ` [Ocfs2-devel] [PATCH 7/7] fs/xfs: Add dedupe support for fsdax Shiyang Ruan
2021-02-08 15:39 ` [Ocfs2-devel] [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=dan.j.williams@intel.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --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=viro@zeniv.linux.org.uk \
    --cc=xiaoguang.wang@linux.alibaba.com \
    --subject='Re: [Ocfs2-devel]  回复: [PATCH 1/7] fsdax: Output address in dax_iomap_pfn() and rename it' \
    /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).