aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorMilosz Tanski <milosz@adfin.com>2013-08-21 17:29:54 -0400
committerMilosz Tanski <milosz@adfin.com>2013-09-06 12:50:11 -0400
commit99ccbd229cf7453206bc858e795ec1f0345ff258 (patch)
tree343ab082d154d7c970d90bf44c9887fdb0251cdb /fs/ceph/inode.c
parentcd0a2df681ec2af45f50c555c2a39dc92a4dff71 (diff)
ceph: use fscache as a local presisent cache
Adding support for fscache to the Ceph filesystem. This would bring it to on par with some of the other network filesystems in Linux (like NFS, AFS, etc...) In order to mount the filesystem with fscache the 'fsc' mount option must be passed. Signed-off-by: Milosz Tanski <milosz@adfin.com> Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r--fs/ceph/inode.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 602ccd8e06b7..eae41cd73276 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -12,6 +12,7 @@
12 12
13#include "super.h" 13#include "super.h"
14#include "mds_client.h" 14#include "mds_client.h"
15#include "cache.h"
15#include <linux/ceph/decode.h> 16#include <linux/ceph/decode.h>
16 17
17/* 18/*
@@ -386,6 +387,8 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
386 387
387 INIT_WORK(&ci->i_vmtruncate_work, ceph_vmtruncate_work); 388 INIT_WORK(&ci->i_vmtruncate_work, ceph_vmtruncate_work);
388 389
390 ceph_fscache_inode_init(ci);
391
389 return &ci->vfs_inode; 392 return &ci->vfs_inode;
390} 393}
391 394
@@ -405,6 +408,8 @@ void ceph_destroy_inode(struct inode *inode)
405 408
406 dout("destroy_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode)); 409 dout("destroy_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode));
407 410
411 ceph_fscache_unregister_inode_cookie(ci);
412
408 ceph_queue_caps_release(inode); 413 ceph_queue_caps_release(inode);
409 414
410 /* 415 /*
@@ -439,7 +444,6 @@ void ceph_destroy_inode(struct inode *inode)
439 call_rcu(&inode->i_rcu, ceph_i_callback); 444 call_rcu(&inode->i_rcu, ceph_i_callback);
440} 445}
441 446
442
443/* 447/*
444 * Helpers to fill in size, ctime, mtime, and atime. We have to be 448 * Helpers to fill in size, ctime, mtime, and atime. We have to be
445 * careful because either the client or MDS may have more up to date 449 * careful because either the client or MDS may have more up to date
@@ -491,6 +495,10 @@ int ceph_fill_file_size(struct inode *inode, int issued,
491 truncate_size); 495 truncate_size);
492 ci->i_truncate_size = truncate_size; 496 ci->i_truncate_size = truncate_size;
493 } 497 }
498
499 if (queue_trunc)
500 ceph_fscache_invalidate(inode);
501
494 return queue_trunc; 502 return queue_trunc;
495} 503}
496 504
@@ -1079,7 +1087,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
1079 * complete. 1087 * complete.
1080 */ 1088 */
1081 ceph_set_dentry_offset(req->r_old_dentry); 1089 ceph_set_dentry_offset(req->r_old_dentry);
1082 dout("dn %p gets new offset %lld\n", req->r_old_dentry, 1090 dout("dn %p gets new offset %lld\n", req->r_old_dentry,
1083 ceph_dentry(req->r_old_dentry)->offset); 1091 ceph_dentry(req->r_old_dentry)->offset);
1084 1092
1085 dn = req->r_old_dentry; /* use old_dentry */ 1093 dn = req->r_old_dentry; /* use old_dentry */
@@ -1494,6 +1502,7 @@ void ceph_queue_vmtruncate(struct inode *inode)
1494 struct ceph_inode_info *ci = ceph_inode(inode); 1502 struct ceph_inode_info *ci = ceph_inode(inode);
1495 1503
1496 ihold(inode); 1504 ihold(inode);
1505
1497 if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq, 1506 if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq,
1498 &ci->i_vmtruncate_work)) { 1507 &ci->i_vmtruncate_work)) {
1499 dout("ceph_queue_vmtruncate %p\n", inode); 1508 dout("ceph_queue_vmtruncate %p\n", inode);
@@ -1565,7 +1574,6 @@ retry:
1565 wake_up_all(&ci->i_cap_wq); 1574 wake_up_all(&ci->i_cap_wq);
1566} 1575}
1567 1576
1568
1569/* 1577/*
1570 * symlinks 1578 * symlinks
1571 */ 1579 */