aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2014-11-14 08:41:55 -0500
committerIlya Dryomov <idryomov@redhat.com>2014-12-17 12:09:52 -0500
commit31c542a199d79f0f402c2f3e04229464510d47ec (patch)
treefa28ee0ee2f288f334cd141146eb79cbd1b693ce /fs/ceph/inode.c
parentfb01d1f8b0343f1b19be878cee89d089f06e9f38 (diff)
ceph: add inline data to pagecache
Request reply and cap message can contain inline data. add inline data to the page cache if there is Fc cap. Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r--fs/ceph/inode.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 72607c17e6fd..feea6a8f88ae 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -387,6 +387,7 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
387 spin_lock_init(&ci->i_ceph_lock); 387 spin_lock_init(&ci->i_ceph_lock);
388 388
389 ci->i_version = 0; 389 ci->i_version = 0;
390 ci->i_inline_version = 0;
390 ci->i_time_warp_seq = 0; 391 ci->i_time_warp_seq = 0;
391 ci->i_ceph_flags = 0; 392 ci->i_ceph_flags = 0;
392 ci->i_ordered_count = 0; 393 ci->i_ordered_count = 0;
@@ -676,6 +677,7 @@ static int fill_inode(struct inode *inode,
676 bool wake = false; 677 bool wake = false;
677 bool queue_trunc = false; 678 bool queue_trunc = false;
678 bool new_version = false; 679 bool new_version = false;
680 bool fill_inline = false;
679 681
680 dout("fill_inode %p ino %llx.%llx v %llu had %llu\n", 682 dout("fill_inode %p ino %llx.%llx v %llu had %llu\n",
681 inode, ceph_vinop(inode), le64_to_cpu(info->version), 683 inode, ceph_vinop(inode), le64_to_cpu(info->version),
@@ -875,8 +877,22 @@ static int fill_inode(struct inode *inode,
875 ceph_vinop(inode)); 877 ceph_vinop(inode));
876 __ceph_get_fmode(ci, cap_fmode); 878 __ceph_get_fmode(ci, cap_fmode);
877 } 879 }
880
881 if (iinfo->inline_version > 0 &&
882 iinfo->inline_version >= ci->i_inline_version) {
883 int cache_caps = CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO;
884 ci->i_inline_version = iinfo->inline_version;
885 if (ci->i_inline_version != CEPH_INLINE_NONE &&
886 (le32_to_cpu(info->cap.caps) & cache_caps))
887 fill_inline = true;
888 }
889
878 spin_unlock(&ci->i_ceph_lock); 890 spin_unlock(&ci->i_ceph_lock);
879 891
892 if (fill_inline)
893 ceph_fill_inline_data(inode, NULL,
894 iinfo->inline_data, iinfo->inline_len);
895
880 if (wake) 896 if (wake)
881 wake_up_all(&ci->i_cap_wq); 897 wake_up_all(&ci->i_cap_wq);
882 898