Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: support getting ceph.dir.pin vxattr

Link: http://tracker.ceph.com/issues/37576
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Yan, Zheng and committed by
Ilya Dryomov
08796873 b37fe1f9

+32 -1
+1
fs/ceph/inode.c
··· 877 877 ci->i_rbytes = le64_to_cpu(info->rbytes); 878 878 ci->i_rfiles = le64_to_cpu(info->rfiles); 879 879 ci->i_rsubdirs = le64_to_cpu(info->rsubdirs); 880 + ci->i_dir_pin = iinfo->dir_pin; 880 881 ceph_decode_timespec64(&ci->i_rctime, &info->rctime); 881 882 } 882 883 }
+9
fs/ceph/mds_client.c
··· 157 157 ceph_decode_64_safe(p, end, change_attr, bad); 158 158 } 159 159 160 + /* dir pin */ 161 + if (struct_v >= 2) { 162 + ceph_decode_32_safe(p, end, info->dir_pin, bad); 163 + } else { 164 + info->dir_pin = -ENODATA; 165 + } 166 + 160 167 *p = end; 161 168 } else { 162 169 if (features & CEPH_FEATURE_MDS_INLINE_DATA) { ··· 194 187 *p += info->pool_ns_len; 195 188 } 196 189 } 190 + 191 + info->dir_pin = -ENODATA; 197 192 } 198 193 return 0; 199 194 bad:
+1
fs/ceph/mds_client.h
··· 68 68 char *pool_ns_data; 69 69 u64 max_bytes; 70 70 u64 max_files; 71 + s32 dir_pin; 71 72 }; 72 73 73 74 struct ceph_mds_reply_dir_entry {
+2
fs/ceph/super.h
··· 318 318 /* quotas */ 319 319 u64 i_max_bytes, i_max_files; 320 320 321 + s32 i_dir_pin; 322 + 321 323 struct rb_root i_fragtree; 322 324 int i_fragtree_nsplits; 323 325 struct mutex i_fragtree_mutex;
+19 -1
fs/ceph/xattr.c
··· 228 228 ci->i_rctime.tv_nsec); 229 229 } 230 230 231 - /* quotas */ 231 + /* dir pin */ 232 + static bool ceph_vxattrcb_dir_pin_exists(struct ceph_inode_info *ci) 233 + { 234 + return ci->i_dir_pin != -ENODATA; 235 + } 232 236 237 + static size_t ceph_vxattrcb_dir_pin(struct ceph_inode_info *ci, char *val, 238 + size_t size) 239 + { 240 + return snprintf(val, size, "%d", (int)ci->i_dir_pin); 241 + } 242 + 243 + /* quotas */ 233 244 static bool ceph_vxattrcb_quota_exists(struct ceph_inode_info *ci) 234 245 { 235 246 bool ret = false; ··· 325 314 XATTR_RSTAT_FIELD(dir, rsubdirs), 326 315 XATTR_RSTAT_FIELD(dir, rbytes), 327 316 XATTR_RSTAT_FIELD(dir, rctime), 317 + { 318 + .name = "ceph.dir.pin", 319 + .name_size = sizeof("ceph.dir_pin"), 320 + .getxattr_cb = ceph_vxattrcb_dir_pin, 321 + .exists_cb = ceph_vxattrcb_dir_pin_exists, 322 + .flags = VXATTR_FLAG_HIDDEN, 323 + }, 328 324 { 329 325 .name = "ceph.quota", 330 326 .name_size = sizeof("ceph.quota"),