From: Greg KH <gregkh@linuxfoundation.org>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH v3] staging: lustre: Change return type to vm_fault_t
Date: Mon, 11 Jun 2018 22:50:58 +0200 [thread overview]
Message-ID: <20180611205058.GA30123@kroah.com> (raw)
In-Reply-To: <CAFqt6zamp=+adkyM+_4z405hN-9qOn1CsY_BgVtCrAfscBHhWg@mail.gmail.com>
On Tue, Jun 12, 2018 at 02:00:47AM +0530, Souptick Joarder wrote:
> On Mon, May 21, 2018 at 11:39 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> > Use new return type vm_fault_t for fault handler. For
> > now, this is just documenting that the function returns
> > a VM_FAULT value rather than an errno. Once all instances
> > are converted, vm_fault_t will become a distinct type.
> >
> > Ref-> commit 1c8f422059ae ("mm: change return type to
> > vm_fault_t") was added in 4.17-rc1 to introduce the new
> > typedef vm_fault_t. Currently we are making change to all
> > drivers to return vm_fault_t for page fault handlers. As
> > part of that lustre driver is also getting changed to
> > return vm_fault_t type.
> >
> > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > ---
> > v2: updated the change log
> >
> > v3: updated the change log
> >
> > drivers/staging/lustre/lustre/llite/llite_mmap.c | 35 ++++++++++++------------
> > 1 file changed, 18 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c
> > index c0533bd..5b8fd10 100644
> > --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
> > +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
> > @@ -231,7 +231,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
> > return result;
> > }
> >
> > -static inline int to_fault_error(int result)
> > +static inline vm_fault_t to_fault_error(int result)
> > {
> > switch (result) {
> > case 0:
> > @@ -261,7 +261,7 @@ static inline int to_fault_error(int result)
> > * \retval VM_FAULT_ERROR on general error
> > * \retval NOPAGE_OOM not have memory for allocate new page
> > */
> > -static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
> > +static vm_fault_t ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
> > {
> > struct lu_env *env;
> > struct cl_io *io;
> > @@ -269,16 +269,16 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
> > struct page *vmpage;
> > unsigned long ra_flags;
> > int result = 0;
> > - int fault_ret = 0;
> > + vm_fault_t fault_ret = 0;
> > u16 refcheck;
> >
> > env = cl_env_get(&refcheck);
> > if (IS_ERR(env))
> > - return PTR_ERR(env);
> > + return VM_FAULT_ERROR;
> >
> > io = ll_fault_io_init(env, vma, vmf->pgoff, &ra_flags);
> > if (IS_ERR(io)) {
> > - result = to_fault_error(PTR_ERR(io));
> > + fault_ret = to_fault_error(PTR_ERR(io));
> > goto out;
> > }
> >
> > @@ -319,15 +319,15 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
> > if (result != 0 && !(fault_ret & VM_FAULT_RETRY))
> > fault_ret |= to_fault_error(result);
> >
> > - CDEBUG(D_MMAP, "%s fault %d/%d\n", current->comm, fault_ret, result);
> > + CDEBUG(D_MMAP, "%s fault %x/%d\n", current->comm, fault_ret, result);
> > return fault_ret;
> > }
> >
> > -static int ll_fault(struct vm_fault *vmf)
> > +static vm_fault_t ll_fault(struct vm_fault *vmf)
> > {
> > int count = 0;
> > bool printed = false;
> > - int result;
> > + vm_fault_t result;
> > sigset_t set;
> >
> > /* Only SIGKILL and SIGTERM are allowed for fault/nopage/mkwrite
> > @@ -364,18 +364,19 @@ static int ll_fault(struct vm_fault *vmf)
> > return result;
> > }
> >
> > -static int ll_page_mkwrite(struct vm_fault *vmf)
> > +static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf)
> > {
> > struct vm_area_struct *vma = vmf->vma;
> > int count = 0;
> > bool printed = false;
> > bool retry;
> > - int result;
> > + int err;
> > + vm_fault_t ret;
> >
> > file_update_time(vma->vm_file);
> > do {
> > retry = false;
> > - result = ll_page_mkwrite0(vma, vmf->page, &retry);
> > + err = ll_page_mkwrite0(vma, vmf->page, &retry);
> >
> > if (!printed && ++count > 16) {
> > const struct dentry *de = vma->vm_file->f_path.dentry;
> > @@ -387,25 +388,25 @@ static int ll_page_mkwrite(struct vm_fault *vmf)
> > }
> > } while (retry);
> >
> > - switch (result) {
> > + switch (err) {
> > case 0:
> > LASSERT(PageLocked(vmf->page));
> > - result = VM_FAULT_LOCKED;
> > + ret = VM_FAULT_LOCKED;
> > break;
> > case -ENODATA:
> > case -EAGAIN:
> > case -EFAULT:
> > - result = VM_FAULT_NOPAGE;
> > + ret = VM_FAULT_NOPAGE;
> > break;
> > case -ENOMEM:
> > - result = VM_FAULT_OOM;
> > + ret = VM_FAULT_OOM;
> > break;
> > default:
> > - result = VM_FAULT_SIGBUS;
> > + ret = VM_FAULT_SIGBUS;
> > break;
> > }
> >
> > - return result;
> > + return ret;
> > }
> >
> > /**
> > --
> > 1.9.1
> >
>
> If no further comment, we would like to get this patch in 4.18-rc-X.
Why? Is it a regression fix? That's all that is allowed after -rc1.
And have you tried applying it to Linus's current tree? :)
thanks,
greg k-h
next prev parent reply other threads:[~2018-06-11 20:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 18:09 [lustre-devel] [PATCH v3] staging: lustre: Change return type to vm_fault_t Souptick Joarder
2018-06-11 20:30 ` Souptick Joarder
2018-06-11 20:50 ` Greg KH [this message]
2018-06-11 21:00 ` Souptick Joarder
2018-06-11 21:07 ` Greg KH
2018-06-12 19:11 ` Souptick Joarder
2018-06-14 7:29 ` NeilBrown
2018-06-14 11:13 ` Souptick Joarder
2018-06-15 0:00 ` NeilBrown
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=20180611205058.GA30123@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=lustre-devel@lists.lustre.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 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.