From: Jan Kara <jack@suse.cz>
To: linux-nvdimm@lists.01.org
Cc: Ted Tso <tytso@mit.edu>,
linux-ext4@vger.kernel.org,
Vishal Verma <vishal.l.verma@intel.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH 7/7] dax: Remove i_mmap_lock protection
Date: Thu, 12 May 2016 18:29:20 +0200 [thread overview]
Message-ID: <1463070560-1979-8-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1463070560-1979-1-git-send-email-jack@suse.cz>
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.
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/dax.c | 24 +++++-------------------
mm/memory.c | 2 --
2 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index a09d19f5371e..a07202ab8f61 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -830,29 +830,19 @@ static int dax_insert_mapping(struct address_space *mapping,
.sector = to_sector(bh, mapping->host),
.size = bh->b_size,
};
- int error;
void *ret;
void *entry = *entryp;
- i_mmap_lock_read(mapping);
-
- if (dax_map_atomic(bdev, &dax) < 0) {
- error = PTR_ERR(dax.addr);
- goto out;
- }
+ if (dax_map_atomic(bdev, &dax) < 0)
+ return PTR_ERR(dax.addr);
dax_unmap_atomic(bdev, &dax);
ret = dax_insert_mapping_entry(mapping, vmf, entry, dax.sector);
- if (IS_ERR(ret)) {
- error = PTR_ERR(ret);
- goto out;
- }
+ if (IS_ERR(ret))
+ return PTR_ERR(ret);
*entryp = ret;
- error = vm_insert_mixed(vma, vaddr, dax.pfn);
- out:
- i_mmap_unlock_read(mapping);
- return error;
+ return vm_insert_mixed(vma, vaddr, dax.pfn);
}
/**
@@ -1090,8 +1080,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)) {
spinlock_t *ptl;
pmd_t entry;
@@ -1180,8 +1168,6 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
}
out:
- i_mmap_unlock_read(mapping);
-
return result;
fallback:
diff --git a/mm/memory.c b/mm/memory.c
index 7f063c9ad711..f6f1c15c8682 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2486,8 +2486,6 @@ void unmap_mapping_range(struct address_space *mapping,
if (details.last_index < details.first_index)
details.last_index = ULONG_MAX;
-
- /* DAX uses i_mmap_lock to serialise file truncate vs page fault */
i_mmap_lock_write(mapping);
if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap)))
unmap_mapping_range_tree(&mapping->i_mmap, &details);
--
2.6.6
prev parent reply other threads:[~2016-05-12 16:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 16:29 [PATCH 0/7 v4] DAX page fault locking Jan Kara
2016-05-12 16:29 ` [PATCH 1/7] dax: Fix condition for filling of PMD holes Jan Kara
2016-05-12 19:03 ` Ross Zwisler
2016-05-12 16:29 ` [PATCH 2/7] dax: Make huge page handling depend of CONFIG_BROKEN Jan Kara
2016-05-12 18:59 ` Ross Zwisler
2016-05-12 16:29 ` [PATCH 3/7] dax: Define DAX lock bit for radix tree exceptional entry Jan Kara
2016-05-12 16:29 ` [PATCH 4/7] dax: Allow DAX code to replace exceptional entries Jan Kara
2016-05-12 16:29 ` [PATCH 5/7] dax: New fault locking Jan Kara
2016-05-12 19:36 ` Ross Zwisler
2016-05-19 9:27 ` Jan Kara
2016-05-12 16:29 ` [PATCH 6/7] dax: Use radix tree entry lock to protect cow faults Jan Kara
2016-05-12 16:29 ` Jan Kara [this message]
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=1463070560-1979-8-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=dan.j.williams@intel.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=ross.zwisler@linux.intel.com \
--cc=tytso@mit.edu \
--cc=vishal.l.verma@intel.com \
/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).