aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-07-26 14:30:02 -0400
committerSage Weil <sage@newdream.net>2011-07-26 14:30:02 -0400
commitdfabbed6fdd509dc2beb89c954bc36014a1bc7cb (patch)
tree34186b6bba311438cccbd572f4f93d8165dce89b /fs/ceph/inode.c
parent029bcbd8b076fd19787b8c73e58dd0a6f2c0caf1 (diff)
ceph: set dir complete frag after adding capability
Curretly ceph_add_cap clears the complete bit if we are newly issued the FILE_SHARED cap, which is normally the case for a newly issue cap on a new directory. That means we clear the just-set bit. Move the check that sets the flag to after the cap is added/updated. Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r--fs/ceph/inode.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index f51e873e966f..2717dc4e443c 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -560,7 +560,8 @@ static int fill_inode(struct inode *inode,
560 struct ceph_mds_reply_inode *info = iinfo->in; 560 struct ceph_mds_reply_inode *info = iinfo->in;
561 struct ceph_inode_info *ci = ceph_inode(inode); 561 struct ceph_inode_info *ci = ceph_inode(inode);
562 int i; 562 int i;
563 int issued, implemented; 563 int issued = 0, implemented;
564 int updating_inode = 0;
564 struct timespec mtime, atime, ctime; 565 struct timespec mtime, atime, ctime;
565 u32 nsplits; 566 u32 nsplits;
566 struct ceph_buffer *xattr_blob = NULL; 567 struct ceph_buffer *xattr_blob = NULL;
@@ -599,7 +600,8 @@ static int fill_inode(struct inode *inode,
599 if (le64_to_cpu(info->version) > 0 && 600 if (le64_to_cpu(info->version) > 0 &&
600 (ci->i_version & ~1) >= le64_to_cpu(info->version)) 601 (ci->i_version & ~1) >= le64_to_cpu(info->version))
601 goto no_change; 602 goto no_change;
602 603
604 updating_inode = 1;
603 issued = __ceph_caps_issued(ci, &implemented); 605 issued = __ceph_caps_issued(ci, &implemented);
604 issued |= implemented | __ceph_caps_dirty(ci); 606 issued |= implemented | __ceph_caps_dirty(ci);
605 607
@@ -707,17 +709,6 @@ static int fill_inode(struct inode *inode,
707 ci->i_rfiles = le64_to_cpu(info->rfiles); 709 ci->i_rfiles = le64_to_cpu(info->rfiles);
708 ci->i_rsubdirs = le64_to_cpu(info->rsubdirs); 710 ci->i_rsubdirs = le64_to_cpu(info->rsubdirs);
709 ceph_decode_timespec(&ci->i_rctime, &info->rctime); 711 ceph_decode_timespec(&ci->i_rctime, &info->rctime);
710
711 /* set dir completion flag? */
712 if (ci->i_files == 0 && ci->i_subdirs == 0 &&
713 ceph_snap(inode) == CEPH_NOSNAP &&
714 (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) &&
715 (issued & CEPH_CAP_FILE_EXCL) == 0 &&
716 (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) {
717 dout(" marking %p complete (empty)\n", inode);
718 /* ci->i_ceph_flags |= CEPH_I_COMPLETE; */
719 ci->i_max_offset = 2;
720 }
721 break; 712 break;
722 default: 713 default:
723 pr_err("fill_inode %llx.%llx BAD mode 0%o\n", 714 pr_err("fill_inode %llx.%llx BAD mode 0%o\n",
@@ -774,6 +765,19 @@ no_change:
774 __ceph_get_fmode(ci, cap_fmode); 765 __ceph_get_fmode(ci, cap_fmode);
775 } 766 }
776 767
768 /* set dir completion flag? */
769 if (S_ISDIR(inode->i_mode) &&
770 updating_inode && /* didn't jump to no_change */
771 ci->i_files == 0 && ci->i_subdirs == 0 &&
772 ceph_snap(inode) == CEPH_NOSNAP &&
773 (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) &&
774 (issued & CEPH_CAP_FILE_EXCL) == 0 &&
775 (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) {
776 dout(" marking %p complete (empty)\n", inode);
777 /* ci->i_ceph_flags |= CEPH_I_COMPLETE; */
778 ci->i_max_offset = 2;
779 }
780
777 /* update delegation info? */ 781 /* update delegation info? */
778 if (dirinfo) 782 if (dirinfo)
779 ceph_fill_dirfrag(inode, dirinfo); 783 ceph_fill_dirfrag(inode, dirinfo);