diff options
author | Sage Weil <sage@newdream.net> | 2011-11-11 12:48:53 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2012-01-10 11:56:56 -0500 |
commit | 3d8eb7a94e8f25a33362f708974ac7daae9e84f8 (patch) | |
tree | 5392b81331ea8733ac25e7a390ae64dbcd3b382a /fs/ceph | |
parent | 186482560f660b8dbf77ee43aa6489cb45d342cd (diff) |
ceph: remove unnecessary d_fsdata conditional checks
We now set d_fsdata unconditionally on all dentries prior to setting up
the d_ops, so all of these checks are unnecessary.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/dir.c | 48 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 4 |
2 files changed, 22 insertions, 30 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 98954003a8d3..a421555b229d 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -973,7 +973,7 @@ static int dentry_lease_is_valid(struct dentry *dentry) | |||
973 | 973 | ||
974 | spin_lock(&dentry->d_lock); | 974 | spin_lock(&dentry->d_lock); |
975 | di = ceph_dentry(dentry); | 975 | di = ceph_dentry(dentry); |
976 | if (di && di->lease_session) { | 976 | if (di->lease_session) { |
977 | s = di->lease_session; | 977 | s = di->lease_session; |
978 | spin_lock(&s->s_cap_lock); | 978 | spin_lock(&s->s_cap_lock); |
979 | gen = s->s_cap_gen; | 979 | gen = s->s_cap_gen; |
@@ -1072,13 +1072,11 @@ static void ceph_d_release(struct dentry *dentry) | |||
1072 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 1072 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
1073 | 1073 | ||
1074 | dout("d_release %p\n", dentry); | 1074 | dout("d_release %p\n", dentry); |
1075 | if (di) { | 1075 | ceph_dentry_lru_del(dentry); |
1076 | ceph_dentry_lru_del(dentry); | 1076 | if (di->lease_session) |
1077 | if (di->lease_session) | 1077 | ceph_put_mds_session(di->lease_session); |
1078 | ceph_put_mds_session(di->lease_session); | 1078 | kmem_cache_free(ceph_dentry_cachep, di); |
1079 | kmem_cache_free(ceph_dentry_cachep, di); | 1079 | dentry->d_fsdata = NULL; |
1080 | dentry->d_fsdata = NULL; | ||
1081 | } | ||
1082 | } | 1080 | } |
1083 | 1081 | ||
1084 | static int ceph_snapdir_d_revalidate(struct dentry *dentry, | 1082 | static int ceph_snapdir_d_revalidate(struct dentry *dentry, |
@@ -1259,13 +1257,11 @@ void ceph_dentry_lru_add(struct dentry *dn) | |||
1259 | 1257 | ||
1260 | dout("dentry_lru_add %p %p '%.*s'\n", di, dn, | 1258 | dout("dentry_lru_add %p %p '%.*s'\n", di, dn, |
1261 | dn->d_name.len, dn->d_name.name); | 1259 | dn->d_name.len, dn->d_name.name); |
1262 | if (di) { | 1260 | mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; |
1263 | mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; | 1261 | spin_lock(&mdsc->dentry_lru_lock); |
1264 | spin_lock(&mdsc->dentry_lru_lock); | 1262 | list_add_tail(&di->lru, &mdsc->dentry_lru); |
1265 | list_add_tail(&di->lru, &mdsc->dentry_lru); | 1263 | mdsc->num_dentry++; |
1266 | mdsc->num_dentry++; | 1264 | spin_unlock(&mdsc->dentry_lru_lock); |
1267 | spin_unlock(&mdsc->dentry_lru_lock); | ||
1268 | } | ||
1269 | } | 1265 | } |
1270 | 1266 | ||
1271 | void ceph_dentry_lru_touch(struct dentry *dn) | 1267 | void ceph_dentry_lru_touch(struct dentry *dn) |
@@ -1275,12 +1271,10 @@ void ceph_dentry_lru_touch(struct dentry *dn) | |||
1275 | 1271 | ||
1276 | dout("dentry_lru_touch %p %p '%.*s' (offset %lld)\n", di, dn, | 1272 | dout("dentry_lru_touch %p %p '%.*s' (offset %lld)\n", di, dn, |
1277 | dn->d_name.len, dn->d_name.name, di->offset); | 1273 | dn->d_name.len, dn->d_name.name, di->offset); |
1278 | if (di) { | 1274 | mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; |
1279 | mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; | 1275 | spin_lock(&mdsc->dentry_lru_lock); |
1280 | spin_lock(&mdsc->dentry_lru_lock); | 1276 | list_move_tail(&di->lru, &mdsc->dentry_lru); |
1281 | list_move_tail(&di->lru, &mdsc->dentry_lru); | 1277 | spin_unlock(&mdsc->dentry_lru_lock); |
1282 | spin_unlock(&mdsc->dentry_lru_lock); | ||
1283 | } | ||
1284 | } | 1278 | } |
1285 | 1279 | ||
1286 | void ceph_dentry_lru_del(struct dentry *dn) | 1280 | void ceph_dentry_lru_del(struct dentry *dn) |
@@ -1290,13 +1284,11 @@ void ceph_dentry_lru_del(struct dentry *dn) | |||
1290 | 1284 | ||
1291 | dout("dentry_lru_del %p %p '%.*s'\n", di, dn, | 1285 | dout("dentry_lru_del %p %p '%.*s'\n", di, dn, |
1292 | dn->d_name.len, dn->d_name.name); | 1286 | dn->d_name.len, dn->d_name.name); |
1293 | if (di) { | 1287 | mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; |
1294 | mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; | 1288 | spin_lock(&mdsc->dentry_lru_lock); |
1295 | spin_lock(&mdsc->dentry_lru_lock); | 1289 | list_del_init(&di->lru); |
1296 | list_del_init(&di->lru); | 1290 | mdsc->num_dentry--; |
1297 | mdsc->num_dentry--; | 1291 | spin_unlock(&mdsc->dentry_lru_lock); |
1298 | spin_unlock(&mdsc->dentry_lru_lock); | ||
1299 | } | ||
1300 | } | 1292 | } |
1301 | 1293 | ||
1302 | /* | 1294 | /* |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 6203d805eb45..23ab6a3f1825 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2772,7 +2772,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
2772 | di = ceph_dentry(dentry); | 2772 | di = ceph_dentry(dentry); |
2773 | switch (h->action) { | 2773 | switch (h->action) { |
2774 | case CEPH_MDS_LEASE_REVOKE: | 2774 | case CEPH_MDS_LEASE_REVOKE: |
2775 | if (di && di->lease_session == session) { | 2775 | if (di->lease_session == session) { |
2776 | if (ceph_seq_cmp(di->lease_seq, seq) > 0) | 2776 | if (ceph_seq_cmp(di->lease_seq, seq) > 0) |
2777 | h->seq = cpu_to_le32(di->lease_seq); | 2777 | h->seq = cpu_to_le32(di->lease_seq); |
2778 | __ceph_mdsc_drop_dentry_lease(dentry); | 2778 | __ceph_mdsc_drop_dentry_lease(dentry); |
@@ -2781,7 +2781,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
2781 | break; | 2781 | break; |
2782 | 2782 | ||
2783 | case CEPH_MDS_LEASE_RENEW: | 2783 | case CEPH_MDS_LEASE_RENEW: |
2784 | if (di && di->lease_session == session && | 2784 | if (di->lease_session == session && |
2785 | di->lease_gen == session->s_cap_gen && | 2785 | di->lease_gen == session->s_cap_gen && |
2786 | di->lease_renew_from && | 2786 | di->lease_renew_from && |
2787 | di->lease_renew_after == 0) { | 2787 | di->lease_renew_after == 0) { |