diff options
author | Yan, Zheng <zyan@redhat.com> | 2015-10-26 04:08:43 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-11-02 17:36:48 -0500 |
commit | 5e804ac4824302efc3038e086cb21f2e93ab8900 (patch) | |
tree | 6e67ab2be2c56191d96afa4f012bf688ea001828 /fs/ceph | |
parent | 4afb04c0c88e21f37e5ef4776e432907d7b12838 (diff) |
ceph: don't invalidate page cache when inode is no longer used
ceph_check_caps() invalidate page cache when inode is not used
by any open file. This behaviour is not friendly for workload
that repeatly read files.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/caps.c | 5 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 27b566874bc1..349315332040 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1655,9 +1655,8 @@ retry_locked: | |||
1655 | !S_ISDIR(inode->i_mode) && /* ignore readdir cache */ | 1655 | !S_ISDIR(inode->i_mode) && /* ignore readdir cache */ |
1656 | ci->i_wrbuffer_ref == 0 && /* no dirty pages... */ | 1656 | ci->i_wrbuffer_ref == 0 && /* no dirty pages... */ |
1657 | inode->i_data.nrpages && /* have cached pages */ | 1657 | inode->i_data.nrpages && /* have cached pages */ |
1658 | (file_wanted == 0 || /* no open files */ | 1658 | (revoking & (CEPH_CAP_FILE_CACHE| |
1659 | (revoking & (CEPH_CAP_FILE_CACHE| | 1659 | CEPH_CAP_FILE_LAZYIO)) && /* or revoking cache */ |
1660 | CEPH_CAP_FILE_LAZYIO))) && /* or revoking cache */ | ||
1661 | !tried_invalidate) { | 1660 | !tried_invalidate) { |
1662 | dout("check_caps trying to invalidate on %p\n", inode); | 1661 | dout("check_caps trying to invalidate on %p\n", inode); |
1663 | if (try_nonblocking_invalidate(inode) < 0) { | 1662 | if (try_nonblocking_invalidate(inode) < 0) { |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index fe2c982764e7..a7a967abb49e 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1430,6 +1430,13 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
1430 | if ((used | wanted) & CEPH_CAP_ANY_WR) | 1430 | if ((used | wanted) & CEPH_CAP_ANY_WR) |
1431 | goto out; | 1431 | goto out; |
1432 | } | 1432 | } |
1433 | /* The inode has cached pages, but it's no longer used. | ||
1434 | * we can safely drop it */ | ||
1435 | if (wanted == 0 && used == CEPH_CAP_FILE_CACHE && | ||
1436 | !(oissued & CEPH_CAP_FILE_CACHE)) { | ||
1437 | used = 0; | ||
1438 | oissued = 0; | ||
1439 | } | ||
1433 | if ((used | wanted) & ~oissued & mine) | 1440 | if ((used | wanted) & ~oissued & mine) |
1434 | goto out; /* we need these caps */ | 1441 | goto out; /* we need these caps */ |
1435 | 1442 | ||
@@ -1438,7 +1445,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
1438 | /* we aren't the only cap.. just remove us */ | 1445 | /* we aren't the only cap.. just remove us */ |
1439 | __ceph_remove_cap(cap, true); | 1446 | __ceph_remove_cap(cap, true); |
1440 | } else { | 1447 | } else { |
1441 | /* try to drop referring dentries */ | 1448 | /* try dropping referring dentries */ |
1442 | spin_unlock(&ci->i_ceph_lock); | 1449 | spin_unlock(&ci->i_ceph_lock); |
1443 | d_prune_aliases(inode); | 1450 | d_prune_aliases(inode); |
1444 | dout("trim_caps_cb %p cap %p pruned, count now %d\n", | 1451 | dout("trim_caps_cb %p cap %p pruned, count now %d\n", |