aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-09-17 13:46:44 -0400
committerSage Weil <sage@newdream.net>2010-10-20 18:38:15 -0400
commit18a38193efcaac1fb3c94ad8fa04bb117850a3c2 (patch)
tree096877dc2a039a991262d9f05fa0a2c2f684cfa8 /fs/ceph/caps.c
parent93afd449aa3c0430ef409c13e1cb2b3f0458fc10 (diff)
ceph: use mapping->nrpages to determine if mapping is empty
This is simpler and faster. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 3c03460f48bd..98ab13e2b71d 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1417,17 +1417,6 @@ static int __mark_caps_flushing(struct inode *inode,
1417/* 1417/*
1418 * try to invalidate mapping pages without blocking. 1418 * try to invalidate mapping pages without blocking.
1419 */ 1419 */
1420static int mapping_is_empty(struct address_space *mapping)
1421{
1422 struct page *page = find_get_page(mapping, 0);
1423
1424 if (!page)
1425 return 1;
1426
1427 put_page(page);
1428 return 0;
1429}
1430
1431static int try_nonblocking_invalidate(struct inode *inode) 1420static int try_nonblocking_invalidate(struct inode *inode)
1432{ 1421{
1433 struct ceph_inode_info *ci = ceph_inode(inode); 1422 struct ceph_inode_info *ci = ceph_inode(inode);
@@ -1437,7 +1426,7 @@ static int try_nonblocking_invalidate(struct inode *inode)
1437 invalidate_mapping_pages(&inode->i_data, 0, -1); 1426 invalidate_mapping_pages(&inode->i_data, 0, -1);
1438 spin_lock(&inode->i_lock); 1427 spin_lock(&inode->i_lock);
1439 1428
1440 if (mapping_is_empty(&inode->i_data) && 1429 if (inode->i_data.nrpages == 0 &&
1441 invalidating_gen == ci->i_rdcache_gen) { 1430 invalidating_gen == ci->i_rdcache_gen) {
1442 /* success. */ 1431 /* success. */
1443 dout("try_nonblocking_invalidate %p success\n", inode); 1432 dout("try_nonblocking_invalidate %p success\n", inode);