Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315067

Re: [PATCH v2 4/5] dax: fix PMD handling for fsync/msync

From Jan Kara <jack@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH v2 4/5] dax: fix PMD handling for fsync/msync
Date 2016-01-22 16:20 +0100
Message-ID <qTLFf-5N3-9@gated-at.bofh.it> (permalink)
References <qTrwR-9n-1@gated-at.bofh.it> <qTrwR-9n-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 21-01-16 10:46:03, Ross Zwisler wrote:
> Fix the way that DAX PMD radix tree entries are handled.  With this patch
> we now check to see if a PMD entry exists in the radix tree on write, even
> if we are just trying to insert a PTE.  If it exists, we dirty that instead
> of inserting our own PTE entry.
> 
> Fix a bug in the PMD path in dax_writeback_mapping_range() where we were
> previously passing a loff_t into radix_tree_lookup instead of a pgoff_t.

Ah, good catch!

> Account for the fact that multiple fsync/msync operations may be happening
> at the same time and don't flush entries that are beyond end_index.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>

Just one nit below. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

> ---
>  fs/dax.c | 39 +++++++++++++++++++++++++++------------
>  1 file changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 55ae394..afacc30 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
...
> @@ -460,31 +468,33 @@ int dax_writeback_mapping_range(struct address_space *mapping, loff_t start,
>  {
>  	struct inode *inode = mapping->host;
>  	struct block_device *bdev = inode->i_sb->s_bdev;
> +	pgoff_t start_index, end_index, pmd_index;
>  	pgoff_t indices[PAGEVEC_SIZE];
> -	pgoff_t start_page, end_page;
>  	struct pagevec pvec;
> -	void *entry;
> +	bool done = false;
>  	int i, ret = 0;
> +	void *entry;
>  
>  	if (WARN_ON_ONCE(inode->i_blkbits != PAGE_SHIFT))
>  		return -EIO;
>  
> +	start_index = start >> PAGE_CACHE_SHIFT;
> +	end_index = end >> PAGE_CACHE_SHIFT;
> +	pmd_index = DAX_PMD_INDEX(start_index);
> +
>  	rcu_read_lock();
> -	entry = radix_tree_lookup(&mapping->page_tree, start & PMD_MASK);
> +	entry = radix_tree_lookup(&mapping->page_tree, pmd_index);
>  	rcu_read_unlock();
>  
>  	/* see if the start of our range is covered by a PMD entry */
> -	if (entry && RADIX_DAX_TYPE(entry) == RADIX_DAX_PMD)
> -		start &= PMD_MASK;
> -
> -	start_page = start >> PAGE_CACHE_SHIFT;
> -	end_page = end >> PAGE_CACHE_SHIFT;
> +	if (RADIX_DAX_TYPE(entry) == RADIX_DAX_PMD)

Don't you miss a check that entry != NULL? I agree that RADIX_DAX_TYPE(NULL)
is != from RADIX_DAX_PMD so it works as desired but it looks a bit
dangerous.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] DAX fsync/msync fixes Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-21 18:50 +0100
  [PATCH v2 4/5] dax: fix PMD handling for fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-21 18:50 +0100
    Re: [PATCH v2 4/5] dax: fix PMD handling for fsync/msync Jan Kara <jack@suse.cz> - 2016-01-22 16:20 +0100
      Re: [PATCH v2 4/5] dax: fix PMD handling for fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-22 17:10 +0100
  [PATCH v2 3/5] dax: improve documentation for fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-21 18:50 +0100
    Re: [PATCH v2 3/5] dax: improve documentation for fsync/msync Jan Kara <jack@suse.cz> - 2016-01-22 16:10 +0100
      Re: [PATCH v2 3/5] dax: improve documentation for fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-22 17:00 +0100
        RE: [PATCH v2 3/5] dax: improve documentation for fsync/msync "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> - 2016-01-22 17:20 +0100
  [PATCH v2 2/5] dax: clear TOWRITE flag after flush is complete Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-21 18:50 +0100
    Re: [PATCH v2 2/5] dax: clear TOWRITE flag after flush is complete Jan Kara <jack@suse.cz> - 2016-01-22 16:00 +0100
  [PATCH v2 1/5] dax: never rely on bh.b_dev being set by get_block() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-21 18:50 +0100
    Re: [PATCH v2 1/5] dax: never rely on bh.b_dev being set by  get_block() Jan Kara <jack@suse.cz> - 2016-01-22 16:00 +0100
  [PATCH v2 5/5] dax: fix clearing of holes in __dax_pmd_fault() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-21 18:50 +0100
    Re: [PATCH v2 5/5] dax: fix clearing of holes in __dax_pmd_fault() Jan Kara <jack@suse.cz> - 2016-01-22 16:40 +0100
      Re: [PATCH v2 5/5] dax: fix clearing of holes in __dax_pmd_fault() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-01-22 17:20 +0100
        Re: [PATCH v2 5/5] dax: fix clearing of holes in __dax_pmd_fault() Jan Kara <jack@suse.cz> - 2016-01-25 15:50 +0100

csiph-web