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
14111411 spin_lock(&dentry->d_lock);
14121412 di->time = jiffies;
14131413 di->lease_shared_gen = 0;
1414+ di->flags &= ~CEPH_DENTRY_PRIMARY_LINK;
14141415 __dentry_lease_unlist(di);
14151416 spin_unlock(&dentry->d_lock);
14161417 }
fs/ceph/inode.c+7−1
@@ -1051,6 +1051,7 @@ static void __update_dentry_lease(struct inode *dir, struct dentry *dentry, · 1050 unmodified lines
10511051 struct ceph_mds_session **old_lease_session)
10521052 {
10531053 struct ceph_dentry_info *di = ceph_dentry(dentry);
1054+ unsigned mask = le16_to_cpu(lease->mask);
10541055 long unsigned duration = le32_to_cpu(lease->duration_ms);
10551056 long unsigned ttl = from_time + (duration * HZ) / 1000;
10561057 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
10621063 if (ceph_snap(dir) != CEPH_NOSNAP)
10631064 return;
10641065
1066+ if (mask & CEPH_LEASE_PRIMARY_LINK)
1067+ di->flags |= CEPH_DENTRY_PRIMARY_LINK;
1068+ else
1069+ di->flags &= ~CEPH_DENTRY_PRIMARY_LINK;
1070+
10651071 di->lease_shared_gen = atomic_read(&ceph_inode(dir)->i_shared_gen);
1066− if (duration == 0) {
1072+ if (!(mask & CEPH_LEASE_VALID)) {
10671073 __ceph_dentry_dir_lease_touch(di);
10681074 return;
10691075 }
fs/ceph/super.h+1−0
@@ -284,6 +284,7 @@ struct ceph_dentry_info { · 283 unmodified lines
284284 #define CEPH_DENTRY_REFERENCED 1
285285 #define CEPH_DENTRY_LEASE_LIST 2
286286 #define CEPH_DENTRY_SHRINK_LIST 4
287+#define CEPH_DENTRY_PRIMARY_LINK 8
287288
288289 struct ceph_inode_xattrs_info {
289290 /*
include/linux/ceph/ceph_fs.h+3−0
@@ -531,6 +531,9 @@ struct ceph_mds_reply_lease { · 530 unmodified lines
531531 __le32 seq;
532532 } __attribute__ ((packed));
533533
534+#define CEPH_LEASE_VALID (1 | 2) /* old and new bit values */
535+#define CEPH_LEASE_PRIMARY_LINK 4 /* primary linkage */
536+
534537 struct ceph_mds_reply_dirfrag {
535538 __le32 frag; /* fragment */
536539 __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