diff mbox

[10/10] dax: Remove i_mmap_lock protection

Message ID 1458566575-28063-11-git-send-email-jack@suse.cz (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jan Kara March 21, 2016, 1:22 p.m. UTC
Currently faults are protected against truncate by filesystem specific
i_mmap_sem and page lock in case of hole page. Cow faults are protected
DAX radix tree entry locking. So there's no need for i_mmap_lock in DAX
code. Remove it.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/dax.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Ross Zwisler March 29, 2016, 10:17 p.m. UTC | #1
On Mon, Mar 21, 2016 at 02:22:55PM +0100, Jan Kara wrote:
> Currently faults are protected against truncate by filesystem specific
> i_mmap_sem and page lock in case of hole page. Cow faults are protected
> DAX radix tree entry locking. So there's no need for i_mmap_lock in DAX
> code. Remove it.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>

> ---
>  fs/dax.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 2fcf4e8a17c5..a2a370db59b7 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -795,8 +795,6 @@ static int dax_insert_mapping(struct address_space *mapping,
>  	int error;
>  	void *ret;
>  
> -	i_mmap_lock_read(mapping);
> -
>  	if (dax_map_atomic(bdev, &dax) < 0) {
>  		error = PTR_ERR(dax.addr);
>  		goto out;
> @@ -821,7 +819,6 @@ static int dax_insert_mapping(struct address_space *mapping,
>  
>  	error = vm_insert_mixed(vma, vaddr, dax.pfn);
>   out:
> -	i_mmap_unlock_read(mapping);
>  	put_locked_mapping_entry(mapping, vmf->pgoff, entry);
>  	return error;
>  }
> @@ -1063,8 +1060,6 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
>  		truncate_pagecache_range(inode, lstart, lend);
>  	}
>  
> -	i_mmap_lock_read(mapping);
> -
>  	if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {
>  		spinlock_t *ptl;
>  		pmd_t entry;
> @@ -1162,8 +1157,6 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
>  	}
>  
>   out:
> -	i_mmap_unlock_read(mapping);
> -
>  	return result;
>  
>   fallback:
> -- 
> 2.6.2
>
diff mbox

Patch

diff --git a/fs/dax.c b/fs/dax.c
index 2fcf4e8a17c5..a2a370db59b7 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -795,8 +795,6 @@  static int dax_insert_mapping(struct address_space *mapping,
 	int error;
 	void *ret;
 
-	i_mmap_lock_read(mapping);
-
 	if (dax_map_atomic(bdev, &dax) < 0) {
 		error = PTR_ERR(dax.addr);
 		goto out;
@@ -821,7 +819,6 @@  static int dax_insert_mapping(struct address_space *mapping,
 
 	error = vm_insert_mixed(vma, vaddr, dax.pfn);
  out:
-	i_mmap_unlock_read(mapping);
 	put_locked_mapping_entry(mapping, vmf->pgoff, entry);
 	return error;
 }
@@ -1063,8 +1060,6 @@  int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 		truncate_pagecache_range(inode, lstart, lend);
 	}
 
-	i_mmap_lock_read(mapping);
-
 	if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {
 		spinlock_t *ptl;
 		pmd_t entry;
@@ -1162,8 +1157,6 @@  int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 	}
 
  out:
-	i_mmap_unlock_read(mapping);
-
 	return result;
 
  fallback: