diff options
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r-- | fs/ceph/dir.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index e729b79812b4..4248307fea90 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -49,9 +49,9 @@ int ceph_init_dentry(struct dentry *dentry) | |||
49 | goto out_unlock; | 49 | goto out_unlock; |
50 | } | 50 | } |
51 | 51 | ||
52 | if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) | 52 | if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) |
53 | d_set_d_op(dentry, &ceph_dentry_ops); | 53 | d_set_d_op(dentry, &ceph_dentry_ops); |
54 | else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) | 54 | else if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR) |
55 | d_set_d_op(dentry, &ceph_snapdir_dentry_ops); | 55 | d_set_d_op(dentry, &ceph_snapdir_dentry_ops); |
56 | else | 56 | else |
57 | d_set_d_op(dentry, &ceph_snap_dentry_ops); | 57 | d_set_d_op(dentry, &ceph_snap_dentry_ops); |
@@ -77,7 +77,7 @@ struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry) | |||
77 | 77 | ||
78 | spin_lock(&dentry->d_lock); | 78 | spin_lock(&dentry->d_lock); |
79 | if (!IS_ROOT(dentry)) { | 79 | if (!IS_ROOT(dentry)) { |
80 | inode = dentry->d_parent->d_inode; | 80 | inode = d_inode(dentry->d_parent); |
81 | ihold(inode); | 81 | ihold(inode); |
82 | } | 82 | } |
83 | spin_unlock(&dentry->d_lock); | 83 | spin_unlock(&dentry->d_lock); |
@@ -122,7 +122,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx, | |||
122 | { | 122 | { |
123 | struct ceph_file_info *fi = file->private_data; | 123 | struct ceph_file_info *fi = file->private_data; |
124 | struct dentry *parent = file->f_path.dentry; | 124 | struct dentry *parent = file->f_path.dentry; |
125 | struct inode *dir = parent->d_inode; | 125 | struct inode *dir = d_inode(parent); |
126 | struct list_head *p; | 126 | struct list_head *p; |
127 | struct dentry *dentry, *last; | 127 | struct dentry *dentry, *last; |
128 | struct ceph_dentry_info *di; | 128 | struct ceph_dentry_info *di; |
@@ -161,15 +161,15 @@ more: | |||
161 | } | 161 | } |
162 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); | 162 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); |
163 | if (di->lease_shared_gen == shared_gen && | 163 | if (di->lease_shared_gen == shared_gen && |
164 | !d_unhashed(dentry) && dentry->d_inode && | 164 | !d_unhashed(dentry) && d_really_is_positive(dentry) && |
165 | ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && | 165 | ceph_snap(d_inode(dentry)) != CEPH_SNAPDIR && |
166 | ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && | 166 | ceph_ino(d_inode(dentry)) != CEPH_INO_CEPH && |
167 | fpos_cmp(ctx->pos, di->offset) <= 0) | 167 | fpos_cmp(ctx->pos, di->offset) <= 0) |
168 | break; | 168 | break; |
169 | dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry, | 169 | dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry, |
170 | dentry, di->offset, | 170 | dentry, di->offset, |
171 | ctx->pos, d_unhashed(dentry) ? " unhashed" : "", | 171 | ctx->pos, d_unhashed(dentry) ? " unhashed" : "", |
172 | !dentry->d_inode ? " null" : ""); | 172 | !d_inode(dentry) ? " null" : ""); |
173 | spin_unlock(&dentry->d_lock); | 173 | spin_unlock(&dentry->d_lock); |
174 | p = p->prev; | 174 | p = p->prev; |
175 | dentry = list_entry(p, struct dentry, d_child); | 175 | dentry = list_entry(p, struct dentry, d_child); |
@@ -189,11 +189,11 @@ more: | |||
189 | } | 189 | } |
190 | 190 | ||
191 | dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos, | 191 | dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos, |
192 | dentry, dentry, dentry->d_inode); | 192 | dentry, dentry, d_inode(dentry)); |
193 | if (!dir_emit(ctx, dentry->d_name.name, | 193 | if (!dir_emit(ctx, dentry->d_name.name, |
194 | dentry->d_name.len, | 194 | dentry->d_name.len, |
195 | ceph_translate_ino(dentry->d_sb, dentry->d_inode->i_ino), | 195 | ceph_translate_ino(dentry->d_sb, d_inode(dentry)->i_ino), |
196 | dentry->d_inode->i_mode >> 12)) { | 196 | d_inode(dentry)->i_mode >> 12)) { |
197 | if (last) { | 197 | if (last) { |
198 | /* remember our position */ | 198 | /* remember our position */ |
199 | fi->dentry = last; | 199 | fi->dentry = last; |
@@ -543,7 +543,7 @@ int ceph_handle_snapdir(struct ceph_mds_request *req, | |||
543 | struct dentry *dentry, int err) | 543 | struct dentry *dentry, int err) |
544 | { | 544 | { |
545 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); | 545 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); |
546 | struct inode *parent = dentry->d_parent->d_inode; /* we hold i_mutex */ | 546 | struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */ |
547 | 547 | ||
548 | /* .snap dir? */ | 548 | /* .snap dir? */ |
549 | if (err == -ENOENT && | 549 | if (err == -ENOENT && |
@@ -579,8 +579,8 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
579 | err = 0; | 579 | err = 0; |
580 | if (!req->r_reply_info.head->is_dentry) { | 580 | if (!req->r_reply_info.head->is_dentry) { |
581 | dout("ENOENT and no trace, dentry %p inode %p\n", | 581 | dout("ENOENT and no trace, dentry %p inode %p\n", |
582 | dentry, dentry->d_inode); | 582 | dentry, d_inode(dentry)); |
583 | if (dentry->d_inode) { | 583 | if (d_really_is_positive(dentry)) { |
584 | d_drop(dentry); | 584 | d_drop(dentry); |
585 | err = -ENOENT; | 585 | err = -ENOENT; |
586 | } else { | 586 | } else { |
@@ -627,7 +627,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
627 | return ERR_PTR(err); | 627 | return ERR_PTR(err); |
628 | 628 | ||
629 | /* can we conclude ENOENT locally? */ | 629 | /* can we conclude ENOENT locally? */ |
630 | if (dentry->d_inode == NULL) { | 630 | if (d_really_is_negative(dentry)) { |
631 | struct ceph_inode_info *ci = ceph_inode(dir); | 631 | struct ceph_inode_info *ci = ceph_inode(dir); |
632 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 632 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
633 | 633 | ||
@@ -734,7 +734,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
734 | ceph_mdsc_put_request(req); | 734 | ceph_mdsc_put_request(req); |
735 | out: | 735 | out: |
736 | if (!err) | 736 | if (!err) |
737 | ceph_init_inode_acls(dentry->d_inode, &acls); | 737 | ceph_init_inode_acls(d_inode(dentry), &acls); |
738 | else | 738 | else |
739 | d_drop(dentry); | 739 | d_drop(dentry); |
740 | ceph_release_acls_info(&acls); | 740 | ceph_release_acls_info(&acls); |
@@ -835,7 +835,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
835 | ceph_mdsc_put_request(req); | 835 | ceph_mdsc_put_request(req); |
836 | out: | 836 | out: |
837 | if (!err) | 837 | if (!err) |
838 | ceph_init_inode_acls(dentry->d_inode, &acls); | 838 | ceph_init_inode_acls(d_inode(dentry), &acls); |
839 | else | 839 | else |
840 | d_drop(dentry); | 840 | d_drop(dentry); |
841 | ceph_release_acls_info(&acls); | 841 | ceph_release_acls_info(&acls); |
@@ -872,8 +872,8 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir, | |||
872 | if (err) { | 872 | if (err) { |
873 | d_drop(dentry); | 873 | d_drop(dentry); |
874 | } else if (!req->r_reply_info.head->is_dentry) { | 874 | } else if (!req->r_reply_info.head->is_dentry) { |
875 | ihold(old_dentry->d_inode); | 875 | ihold(d_inode(old_dentry)); |
876 | d_instantiate(dentry, old_dentry->d_inode); | 876 | d_instantiate(dentry, d_inode(old_dentry)); |
877 | } | 877 | } |
878 | ceph_mdsc_put_request(req); | 878 | ceph_mdsc_put_request(req); |
879 | return err; | 879 | return err; |
@@ -906,7 +906,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry) | |||
906 | { | 906 | { |
907 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 907 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
908 | struct ceph_mds_client *mdsc = fsc->mdsc; | 908 | struct ceph_mds_client *mdsc = fsc->mdsc; |
909 | struct inode *inode = dentry->d_inode; | 909 | struct inode *inode = d_inode(dentry); |
910 | struct ceph_mds_request *req; | 910 | struct ceph_mds_request *req; |
911 | int err = -EROFS; | 911 | int err = -EROFS; |
912 | int op; | 912 | int op; |
@@ -975,8 +975,8 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
975 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; | 975 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; |
976 | /* release LINK_RDCACHE on source inode (mds will lock it) */ | 976 | /* release LINK_RDCACHE on source inode (mds will lock it) */ |
977 | req->r_old_inode_drop = CEPH_CAP_LINK_SHARED; | 977 | req->r_old_inode_drop = CEPH_CAP_LINK_SHARED; |
978 | if (new_dentry->d_inode) | 978 | if (d_really_is_positive(new_dentry)) |
979 | req->r_inode_drop = drop_caps_for_unlink(new_dentry->d_inode); | 979 | req->r_inode_drop = drop_caps_for_unlink(d_inode(new_dentry)); |
980 | err = ceph_mdsc_do_request(mdsc, old_dir, req); | 980 | err = ceph_mdsc_do_request(mdsc, old_dir, req); |
981 | if (!err && !req->r_reply_info.head->is_dentry) { | 981 | if (!err && !req->r_reply_info.head->is_dentry) { |
982 | /* | 982 | /* |
@@ -1042,7 +1042,7 @@ static int dentry_lease_is_valid(struct dentry *dentry) | |||
1042 | if (di->lease_renew_after && | 1042 | if (di->lease_renew_after && |
1043 | time_after(jiffies, di->lease_renew_after)) { | 1043 | time_after(jiffies, di->lease_renew_after)) { |
1044 | /* we should renew */ | 1044 | /* we should renew */ |
1045 | dir = dentry->d_parent->d_inode; | 1045 | dir = d_inode(dentry->d_parent); |
1046 | session = ceph_get_mds_session(s); | 1046 | session = ceph_get_mds_session(s); |
1047 | seq = di->lease_seq; | 1047 | seq = di->lease_seq; |
1048 | di->lease_renew_after = 0; | 1048 | di->lease_renew_after = 0; |
@@ -1092,22 +1092,22 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
1092 | return -ECHILD; | 1092 | return -ECHILD; |
1093 | 1093 | ||
1094 | dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, | 1094 | dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, |
1095 | dentry, dentry->d_inode, ceph_dentry(dentry)->offset); | 1095 | dentry, d_inode(dentry), ceph_dentry(dentry)->offset); |
1096 | 1096 | ||
1097 | dir = ceph_get_dentry_parent_inode(dentry); | 1097 | dir = ceph_get_dentry_parent_inode(dentry); |
1098 | 1098 | ||
1099 | /* always trust cached snapped dentries, snapdir dentry */ | 1099 | /* always trust cached snapped dentries, snapdir dentry */ |
1100 | if (ceph_snap(dir) != CEPH_NOSNAP) { | 1100 | if (ceph_snap(dir) != CEPH_NOSNAP) { |
1101 | dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, | 1101 | dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, |
1102 | dentry, dentry->d_inode); | 1102 | dentry, d_inode(dentry)); |
1103 | valid = 1; | 1103 | valid = 1; |
1104 | } else if (dentry->d_inode && | 1104 | } else if (d_really_is_positive(dentry) && |
1105 | ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) { | 1105 | ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) { |
1106 | valid = 1; | 1106 | valid = 1; |
1107 | } else if (dentry_lease_is_valid(dentry) || | 1107 | } else if (dentry_lease_is_valid(dentry) || |
1108 | dir_lease_is_valid(dir, dentry)) { | 1108 | dir_lease_is_valid(dir, dentry)) { |
1109 | if (dentry->d_inode) | 1109 | if (d_really_is_positive(dentry)) |
1110 | valid = ceph_is_any_caps(dentry->d_inode); | 1110 | valid = ceph_is_any_caps(d_inode(dentry)); |
1111 | else | 1111 | else |
1112 | valid = 1; | 1112 | valid = 1; |
1113 | } | 1113 | } |
@@ -1169,7 +1169,7 @@ static void ceph_d_prune(struct dentry *dentry) | |||
1169 | * we hold d_lock, so d_parent is stable, and d_fsdata is never | 1169 | * we hold d_lock, so d_parent is stable, and d_fsdata is never |
1170 | * cleared until d_release | 1170 | * cleared until d_release |
1171 | */ | 1171 | */ |
1172 | ceph_dir_clear_complete(dentry->d_parent->d_inode); | 1172 | ceph_dir_clear_complete(d_inode(dentry->d_parent)); |
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | /* | 1175 | /* |