diff options
-rw-r--r-- | drivers/staging/lustre/lustre/llite/namei.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index e1434bb55822..572e7f7ce6a0 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c | |||
@@ -909,20 +909,10 @@ out: | |||
909 | return err; | 909 | return err; |
910 | } | 910 | } |
911 | 911 | ||
912 | /* Try to find the child dentry by its name. | 912 | static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) |
913 | If found, put the result fid into @fid. */ | ||
914 | static void ll_get_child_fid(struct inode * dir, struct qstr *name, | ||
915 | struct lu_fid *fid) | ||
916 | { | 913 | { |
917 | struct dentry *parent, *child; | 914 | if (child->d_inode) |
918 | 915 | *fid = *ll_inode2fid(child->d_inode); | |
919 | parent = ll_d_hlist_entry(dir->i_dentry, struct dentry, d_u.d_alias); | ||
920 | child = d_lookup(parent, name); | ||
921 | if (child) { | ||
922 | if (child->d_inode) | ||
923 | *fid = *ll_inode2fid(child->d_inode); | ||
924 | dput(child); | ||
925 | } | ||
926 | } | 916 | } |
927 | 917 | ||
928 | /** | 918 | /** |
@@ -1057,7 +1047,7 @@ static int ll_unlink(struct inode * dir, struct dentry *dentry) | |||
1057 | if (IS_ERR(op_data)) | 1047 | if (IS_ERR(op_data)) |
1058 | return PTR_ERR(op_data); | 1048 | return PTR_ERR(op_data); |
1059 | 1049 | ||
1060 | ll_get_child_fid(dir, &dentry->d_name, &op_data->op_fid3); | 1050 | ll_get_child_fid(dentry, &op_data->op_fid3); |
1061 | op_data->op_fid2 = op_data->op_fid3; | 1051 | op_data->op_fid2 = op_data->op_fid3; |
1062 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); | 1052 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); |
1063 | ll_finish_md_op_data(op_data); | 1053 | ll_finish_md_op_data(op_data); |
@@ -1110,7 +1100,7 @@ static int ll_rmdir(struct inode *dir, struct dentry *dentry) | |||
1110 | if (IS_ERR(op_data)) | 1100 | if (IS_ERR(op_data)) |
1111 | return PTR_ERR(op_data); | 1101 | return PTR_ERR(op_data); |
1112 | 1102 | ||
1113 | ll_get_child_fid(dir, &dentry->d_name, &op_data->op_fid3); | 1103 | ll_get_child_fid(dentry, &op_data->op_fid3); |
1114 | op_data->op_fid2 = op_data->op_fid3; | 1104 | op_data->op_fid2 = op_data->op_fid3; |
1115 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); | 1105 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); |
1116 | ll_finish_md_op_data(op_data); | 1106 | ll_finish_md_op_data(op_data); |
@@ -1171,8 +1161,8 @@ static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1171 | if (IS_ERR(op_data)) | 1161 | if (IS_ERR(op_data)) |
1172 | return PTR_ERR(op_data); | 1162 | return PTR_ERR(op_data); |
1173 | 1163 | ||
1174 | ll_get_child_fid(old_dir, &old_dentry->d_name, &op_data->op_fid3); | 1164 | ll_get_child_fid(old_dentry, &op_data->op_fid3); |
1175 | ll_get_child_fid(new_dir, &new_dentry->d_name, &op_data->op_fid4); | 1165 | ll_get_child_fid(new_dentry, &op_data->op_fid4); |
1176 | err = md_rename(sbi->ll_md_exp, op_data, | 1166 | err = md_rename(sbi->ll_md_exp, op_data, |
1177 | old_dentry->d_name.name, | 1167 | old_dentry->d_name.name, |
1178 | old_dentry->d_name.len, | 1168 | old_dentry->d_name.len, |