From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: akpm@linux-foundation.org, jack@suse.cz,
linux-nvdimm@lists.01.org, david@fromorbit.com, hch@lst.de,
linux-mm@kvack.org, tytso@mit.edu, ross.zwisler@linux.intel.com,
dan.j.williams@intel.com
Subject: Re: [PATCH v3 2/3] mm, dax: make pmd_fault() and friends to be the same as fault()
Date: Thu, 15 Dec 2016 16:23:21 -0700 [thread overview]
Message-ID: <20161215232321.GA10460@linux.intel.com> (raw)
In-Reply-To: <148183506511.96369.3577733318086932161.stgit@djiang5-desk3.ch.intel.com>
On Thu, Dec 15, 2016 at 01:51:05PM -0700, Dave Jiang wrote:
> Instead of passing in multiple parameters in the pmd_fault() handler,
> a vmf can be passed in just like a fault() handler. This will simplify
> code and remove the need for the actual pmd fault handlers to allocate a
> vmf. Related functions are also modified to do the same.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Reviewed-by: Jan Kara <jack@suse.cz>
> ---
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index a3f2bf0..e6cdb78 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -278,22 +278,26 @@ static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> return result;
> }
>
> -static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
> - pmd_t *pmd, unsigned int flags)
> +static int
> +ext4_dax_pmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> {
> int result;
> struct inode *inode = file_inode(vma->vm_file);
> struct super_block *sb = inode->i_sb;
> - bool write = flags & FAULT_FLAG_WRITE;
> + bool write = vmf->flags & FAULT_FLAG_WRITE;
> + gfp_t old_mask;
>
> if (write) {
> sb_start_pagefault(sb);
> file_update_time(vma->vm_file);
> }
> +
> + old_mask = vmf->gfp_mask;
> + vmf->gfp_mask &= ~__GFP_FS;
> down_read(&EXT4_I(inode)->i_mmap_sem);
> - result = dax_iomap_pmd_fault(vma, addr, pmd, flags,
> - &ext4_iomap_ops);
> + result = dax_iomap_pmd_fault(vma, vmf, &ext4_iomap_ops);
> up_read(&EXT4_I(inode)->i_mmap_sem);
> + vmf->gfp_mask = old_mask;
> if (write)
> sb_end_pagefault(sb);
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 52202b4..b1b8524 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -1533,29 +1533,31 @@ xfs_filemap_fault(
> STATIC int
> xfs_filemap_pmd_fault(
> struct vm_area_struct *vma,
> - unsigned long addr,
> - pmd_t *pmd,
> - unsigned int flags)
> + struct vm_fault *vmf)
> {
> struct inode *inode = file_inode(vma->vm_file);
> struct xfs_inode *ip = XFS_I(inode);
> int ret;
> + gfp_t old_mask;
>
> if (!IS_DAX(inode))
> return VM_FAULT_FALLBACK;
>
> trace_xfs_filemap_pmd_fault(ip);
>
> - if (flags & FAULT_FLAG_WRITE) {
> + if (vmf->flags & FAULT_FLAG_WRITE) {
> sb_start_pagefault(inode->i_sb);
> file_update_time(vma->vm_file);
> }
>
> + old_mask = vmf->gfp_mask;
One small nit for both xfs and ext4 - in patch 1 you named your local
'old_gfp' and set it when it was defined, but in this patch it's 'old_mask'
and it's set later. Probably best to keep this patch consistent with the
first one.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-12-15 23:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 20:50 [PATCH v3 1/3] dax: masking off __GFP_FS in fs DAX handlers Dave Jiang
2016-12-15 20:51 ` [PATCH v3 2/3] mm, dax: make pmd_fault() and friends to be the same as fault() Dave Jiang
2016-12-15 23:23 ` Ross Zwisler [this message]
2016-12-15 20:51 ` [PATCH v3 3/3] mm, dax: move pmd_fault() to take only vmf parameter Dave Jiang
2016-12-15 23:23 ` Ross Zwisler
2016-12-16 7:17 ` Jan Kara
2016-12-16 8:34 ` [PATCH v3 1/3] dax: masking off __GFP_FS in fs DAX handlers Michal Hocko
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=20161215232321.GA10460@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=tytso@mit.edu \
/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