History

ceph: track primary dentry link

Newer versions of the MDS will flag a dentry as "primary". In later patches, we'll need to consult this info, so track it in di->flags.

Jeff Layton committed 6 years ago

Commit f5e17ae1 parent 3bb48b44 files · +12 −1Browse files

Unified · Split

4 files
  1. fs/ceph/dir.c +1 −0
  2. fs/ceph/inode.c +7 −1
  3. fs/ceph/super.h +1 −0
  4. include/linux/ceph/ceph_fs.h +3 −0
fs/ceph/dir.c+1−0
@@ -1411,6 +1411,7 @@ void ceph_invalidate_dentry_lease(struct dentry *dentry) · 1410 unmodified lines
1411 spin_lock(&dentry->d_lock);1411 spin_lock(&dentry->d_lock);
1412 di->time = jiffies;1412 di->time = jiffies;
1413 di->lease_shared_gen = 0;1413 di->lease_shared_gen = 0;
1414 di->flags &= ~CEPH_DENTRY_PRIMARY_LINK;
1414 __dentry_lease_unlist(di);1415 __dentry_lease_unlist(di);
1415 spin_unlock(&dentry->d_lock);1416 spin_unlock(&dentry->d_lock);
1416}1417}
fs/ceph/inode.c+7−1
@@ -1051,6 +1051,7 @@ static void __update_dentry_lease(struct inode *dir, struct dentry *dentry, · 1050 unmodified lines
1051 struct ceph_mds_session **old_lease_session)1051 struct ceph_mds_session **old_lease_session)
1052{1052{
1053 struct ceph_dentry_info *di = ceph_dentry(dentry);1053 struct ceph_dentry_info *di = ceph_dentry(dentry);
1054 unsigned mask = le16_to_cpu(lease->mask);
1054 long unsigned duration = le32_to_cpu(lease->duration_ms);1055 long unsigned duration = le32_to_cpu(lease->duration_ms);
1055 long unsigned ttl = from_time + (duration * HZ) / 1000;1056 long unsigned ttl = from_time + (duration * HZ) / 1000;
1056 long unsigned half_ttl = from_time + (duration * HZ / 2) / 1000;1057 long unsigned half_ttl = from_time + (duration * HZ / 2) / 1000;
@@ -1062,8 +1063,13 @@ static void __update_dentry_lease(struct inode *dir, struct dentry *dentry, · 5 unmodified lines
1062 if (ceph_snap(dir) != CEPH_NOSNAP)1063 if (ceph_snap(dir) != CEPH_NOSNAP)
1063 return;1064 return;
1064 1065
1066 if (mask & CEPH_LEASE_PRIMARY_LINK)
1067 di->flags |= CEPH_DENTRY_PRIMARY_LINK;
1068 else
1069 di->flags &= ~CEPH_DENTRY_PRIMARY_LINK;
1070
1065 di->lease_shared_gen = atomic_read(&ceph_inode(dir)->i_shared_gen);1071 di->lease_shared_gen = atomic_read(&ceph_inode(dir)->i_shared_gen);
1066 if (duration == 0) {1072 if (!(mask & CEPH_LEASE_VALID)) {
1067 __ceph_dentry_dir_lease_touch(di);1073 __ceph_dentry_dir_lease_touch(di);
1068 return;1074 return;
1069 }1075 }
fs/ceph/super.h+1−0
@@ -284,6 +284,7 @@ struct ceph_dentry_info { · 283 unmodified lines
284#define CEPH_DENTRY_REFERENCED 1284#define CEPH_DENTRY_REFERENCED 1
285#define CEPH_DENTRY_LEASE_LIST 2285#define CEPH_DENTRY_LEASE_LIST 2
286#define CEPH_DENTRY_SHRINK_LIST 4286#define CEPH_DENTRY_SHRINK_LIST 4
287#define CEPH_DENTRY_PRIMARY_LINK 8
287 288
288struct ceph_inode_xattrs_info {289struct ceph_inode_xattrs_info {
289 /*290 /*
include/linux/ceph/ceph_fs.h+3−0
@@ -531,6 +531,9 @@ struct ceph_mds_reply_lease { · 530 unmodified lines
531 __le32 seq;531 __le32 seq;
532} __attribute__ ((packed));532} __attribute__ ((packed));
533 533
534#define CEPH_LEASE_VALID (1 | 2) /* old and new bit values */
535#define CEPH_LEASE_PRIMARY_LINK 4 /* primary linkage */
536
534struct ceph_mds_reply_dirfrag {537struct ceph_mds_reply_dirfrag {
535 __le32 frag; /* fragment */538 __le32 frag; /* fragment */
536 __le32 auth; /* auth mds, if this is a delegation point */539 __le32 auth; /* auth mds, if this is a delegation point */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t