diff options
| author | Yan, Zheng <zyan@redhat.com> | 2016-03-16 04:40:23 -0400 |
|---|---|---|
| committer | Ilya Dryomov <idryomov@gmail.com> | 2016-03-25 13:51:55 -0400 |
| commit | 641235d8f823574961d225bdbfaef299842aa38c (patch) | |
| tree | 7db9892014522eda2f8c9e08239899929edbcd59 | |
| parent | 315f24088048a51eed341c53be66ea477a3c7d16 (diff) | |
ceph: kill ceph_get_dentry_parent_inode()
use vfs helper dget_parent() instead
Signed-off-by: Yan, Zheng <zyan@redhat.com>
| -rw-r--r-- | fs/ceph/dir.c | 24 | ||||
| -rw-r--r-- | fs/ceph/super.h | 1 |
2 files changed, 5 insertions, 20 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index b9f50a388aee..c37820bcb66b 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -68,23 +68,6 @@ out_unlock: | |||
| 68 | return 0; | 68 | return 0; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry) | ||
| 72 | { | ||
| 73 | struct inode *inode = NULL; | ||
| 74 | |||
| 75 | if (!dentry) | ||
| 76 | return NULL; | ||
| 77 | |||
| 78 | spin_lock(&dentry->d_lock); | ||
| 79 | if (!IS_ROOT(dentry)) { | ||
| 80 | inode = d_inode(dentry->d_parent); | ||
| 81 | ihold(inode); | ||
| 82 | } | ||
| 83 | spin_unlock(&dentry->d_lock); | ||
| 84 | return inode; | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | /* | 71 | /* |
| 89 | * for readdir, we encode the directory frag and offset within that | 72 | * for readdir, we encode the directory frag and offset within that |
| 90 | * frag into f_pos. | 73 | * frag into f_pos. |
| @@ -1100,6 +1083,7 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry) | |||
| 1100 | static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) | 1083 | static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) |
| 1101 | { | 1084 | { |
| 1102 | int valid = 0; | 1085 | int valid = 0; |
| 1086 | struct dentry *parent; | ||
| 1103 | struct inode *dir; | 1087 | struct inode *dir; |
| 1104 | 1088 | ||
| 1105 | if (flags & LOOKUP_RCU) | 1089 | if (flags & LOOKUP_RCU) |
| @@ -1108,7 +1092,8 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1108 | dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, | 1092 | dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, |
| 1109 | dentry, d_inode(dentry), ceph_dentry(dentry)->offset); | 1093 | dentry, d_inode(dentry), ceph_dentry(dentry)->offset); |
| 1110 | 1094 | ||
| 1111 | dir = ceph_get_dentry_parent_inode(dentry); | 1095 | parent = dget_parent(dentry); |
| 1096 | dir = d_inode(parent); | ||
| 1112 | 1097 | ||
| 1113 | /* always trust cached snapped dentries, snapdir dentry */ | 1098 | /* always trust cached snapped dentries, snapdir dentry */ |
| 1114 | if (ceph_snap(dir) != CEPH_NOSNAP) { | 1099 | if (ceph_snap(dir) != CEPH_NOSNAP) { |
| @@ -1132,7 +1117,8 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1132 | } else { | 1117 | } else { |
| 1133 | ceph_dir_clear_complete(dir); | 1118 | ceph_dir_clear_complete(dir); |
| 1134 | } | 1119 | } |
| 1135 | iput(dir); | 1120 | |
| 1121 | dput(parent); | ||
| 1136 | return valid; | 1122 | return valid; |
| 1137 | } | 1123 | } |
| 1138 | 1124 | ||
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 2d48138da58e..e705c4d612d7 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
| @@ -957,7 +957,6 @@ extern void ceph_dentry_lru_touch(struct dentry *dn); | |||
| 957 | extern void ceph_dentry_lru_del(struct dentry *dn); | 957 | extern void ceph_dentry_lru_del(struct dentry *dn); |
| 958 | extern void ceph_invalidate_dentry_lease(struct dentry *dentry); | 958 | extern void ceph_invalidate_dentry_lease(struct dentry *dentry); |
| 959 | extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn); | 959 | extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn); |
| 960 | extern struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry); | ||
| 961 | extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); | 960 | extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); |
| 962 | 961 | ||
| 963 | /* | 962 | /* |
