From: "ruansy.fnst@fujitsu.com" <ruansy.fnst@fujitsu.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"darrick.wong@oracle.com" <darrick.wong@oracle.com>,
"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>,
"david@fromorbit.com" <david@fromorbit.com>,
"hch@lst.de" <hch@lst.de>, "rgoldwyn@suse.de" <rgoldwyn@suse.de>,
Ritesh Harjani <riteshh@gmail.com>
Subject: RE: [PATCH 1/3] fsdax: Factor helpers to simplify dax fault code
Date: Wed, 7 Apr 2021 12:29:13 +0000 [thread overview]
Message-ID: <OSAPR01MB2913CC6A36BFBBCDCFBE2B9BF4759@OSAPR01MB2913.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20210407111355.GD2531743@casper.infradead.org>
> -----Original Message-----
> From: Matthew Wilcox <willy@infradead.org>
> Sent: Wednesday, April 7, 2021 7:14 PM
> To: Ruan, Shiyang/阮 世阳 <ruansy.fnst@fujitsu.com>
> Cc: linux-kernel@vger.kernel.org; linux-xfs@vger.kernel.org;
> linux-nvdimm@lists.01.org; linux-fsdevel@vger.kernel.org;
> darrick.wong@oracle.com; dan.j.williams@intel.com; jack@suse.cz;
> viro@zeniv.linux.org.uk; linux-btrfs@vger.kernel.org; david@fromorbit.com;
> hch@lst.de; rgoldwyn@suse.de; Ritesh Harjani <riteshh@gmail.com>
> Subject: Re: [PATCH 1/3] fsdax: Factor helpers to simplify dax fault code
>
> On Wed, Apr 07, 2021 at 02:32:05PM +0800, Shiyang Ruan wrote:
> > +static int dax_fault_cow_page(struct vm_fault *vmf, struct iomap *iomap,
> > + loff_t pos, vm_fault_t *ret)
> > +{
> > + int error = 0;
> > + unsigned long vaddr = vmf->address;
> > + sector_t sector = dax_iomap_sector(iomap, pos);
> > +
> > + switch (iomap->type) {
> > + case IOMAP_HOLE:
> > + case IOMAP_UNWRITTEN:
> > + clear_user_highpage(vmf->cow_page, vaddr);
> > + break;
> > + case IOMAP_MAPPED:
> > + error = copy_cow_page_dax(iomap->bdev, iomap->dax_dev,
> > + sector, vmf->cow_page, vaddr);
> > + break;
> > + default:
> > + WARN_ON_ONCE(1);
> > + error = -EIO;
> > + break;
> > + }
> > +
> > + if (error)
> > + return error;
> > +
> > + __SetPageUptodate(vmf->cow_page);
> > + *ret = finish_fault(vmf);
> > + if (!*ret)
> > + *ret = VM_FAULT_DONE_COW;
> > + return 0;
> > +}
> ...
>
> > + error = dax_fault_cow_page(vmf, &iomap, pos, &ret);
> > if (error)
> > + ret = dax_fault_return(error);
> > goto finish_iomap;
>
> This seems unnecessarily complex. Why not return the vm_fault_t instead of
> returning the errno and then converting it?
Yes, I'll fix it.
--
Thanks,
Ruan Shiyang.
_______________________________________________
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-04-07 12:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 6:32 [PATCH 0/3] fsdax: Factor helper functions to simplify the code Shiyang Ruan
2021-04-07 6:32 ` [PATCH 1/3] fsdax: Factor helpers to simplify dax fault code Shiyang Ruan
2021-04-07 10:14 ` riteshh
2021-04-07 11:13 ` Matthew Wilcox
2021-04-07 12:29 ` ruansy.fnst [this message]
2021-04-07 6:32 ` [PATCH 2/3] fsdax: Factor helper: dax_fault_actor() Shiyang Ruan
2021-04-07 10:21 ` riteshh
2021-04-07 6:32 ` [PATCH 3/3] fsdax: Output address in dax_iomap_pfn() and rename it Shiyang Ruan
2021-04-07 10:16 ` riteshh
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=OSAPR01MB2913CC6A36BFBBCDCFBE2B9BF4759@OSAPR01MB2913.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=rgoldwyn@suse.de \
--cc=riteshh@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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).