diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-10-20 23:27:44 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-03 15:21:17 -0500 |
commit | 78851093c032b4c622377b430c815f1836bfec4e (patch) | |
tree | 0bbcd7f7e9984d43ee509459ab492240336fd8ff | |
parent | 521f2ad7b674cbb1eaf3b143c30fdf03c2cac7b8 (diff) |
kill ll_rename_generic()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/staging/lustre/lustre/llite/namei.c | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index b4cc9247c0dd..e1434bb55822 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c | |||
@@ -1031,49 +1031,6 @@ out: | |||
1031 | return rc; | 1031 | return rc; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | static int ll_rename_generic(struct inode *src, struct dentry *src_dparent, | ||
1035 | struct dentry *src_dchild, struct qstr *src_name, | ||
1036 | struct inode *tgt, struct dentry *tgt_dparent, | ||
1037 | struct dentry *tgt_dchild, struct qstr *tgt_name) | ||
1038 | { | ||
1039 | struct ptlrpc_request *request = NULL; | ||
1040 | struct ll_sb_info *sbi = ll_i2sbi(src); | ||
1041 | struct md_op_data *op_data; | ||
1042 | int err; | ||
1043 | |||
1044 | CDEBUG(D_VFSTRACE, | ||
1045 | "VFS Op:oldname=%.*s,src_dir=%lu/%u(%p),newname=%.*s," | ||
1046 | "tgt_dir=%lu/%u(%p)\n", src_name->len, src_name->name, | ||
1047 | src->i_ino, src->i_generation, src, tgt_name->len, | ||
1048 | tgt_name->name, tgt->i_ino, tgt->i_generation, tgt); | ||
1049 | |||
1050 | if (unlikely(ll_d_mountpoint(src_dparent, src_dchild, src_name) || | ||
1051 | ll_d_mountpoint(tgt_dparent, tgt_dchild, tgt_name))) | ||
1052 | return -EBUSY; | ||
1053 | |||
1054 | op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0, | ||
1055 | LUSTRE_OPC_ANY, NULL); | ||
1056 | if (IS_ERR(op_data)) | ||
1057 | return PTR_ERR(op_data); | ||
1058 | |||
1059 | ll_get_child_fid(src, src_name, &op_data->op_fid3); | ||
1060 | ll_get_child_fid(tgt, tgt_name, &op_data->op_fid4); | ||
1061 | err = md_rename(sbi->ll_md_exp, op_data, | ||
1062 | src_name->name, src_name->len, | ||
1063 | tgt_name->name, tgt_name->len, &request); | ||
1064 | ll_finish_md_op_data(op_data); | ||
1065 | if (!err) { | ||
1066 | ll_update_times(request, src); | ||
1067 | ll_update_times(request, tgt); | ||
1068 | ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); | ||
1069 | err = ll_objects_destroy(request, src); | ||
1070 | } | ||
1071 | |||
1072 | ptlrpc_req_finished(request); | ||
1073 | |||
1074 | return err; | ||
1075 | } | ||
1076 | |||
1077 | /* ll_unlink() doesn't update the inode with the new link count. | 1034 | /* ll_unlink() doesn't update the inode with the new link count. |
1078 | * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there | 1035 | * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there |
1079 | * is any lock existing. They will recycle dentries and inodes based upon locks | 1036 | * is any lock existing. They will recycle dentries and inodes based upon locks |
@@ -1194,14 +1151,44 @@ static int ll_link(struct dentry *old_dentry, struct inode *dir, | |||
1194 | static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, | 1151 | static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, |
1195 | struct inode *new_dir, struct dentry *new_dentry) | 1152 | struct inode *new_dir, struct dentry *new_dentry) |
1196 | { | 1153 | { |
1154 | struct ptlrpc_request *request = NULL; | ||
1155 | struct ll_sb_info *sbi = ll_i2sbi(old_dir); | ||
1156 | struct md_op_data *op_data; | ||
1197 | int err; | 1157 | int err; |
1198 | err = ll_rename_generic(old_dir, NULL, | 1158 | |
1199 | old_dentry, &old_dentry->d_name, | 1159 | CDEBUG(D_VFSTRACE, |
1200 | new_dir, NULL, new_dentry, | 1160 | "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd," |
1201 | &new_dentry->d_name); | 1161 | "tgt_dir=%lu/%u(%p)\n", old_dentry, |
1162 | old_dir->i_ino, old_dir->i_generation, old_dir, new_dentry, | ||
1163 | new_dir->i_ino, new_dir->i_generation, new_dir); | ||
1164 | |||
1165 | if (unlikely(ll_d_mountpoint(NULL, old_dentry, &old_dentry->d_name) || | ||
1166 | ll_d_mountpoint(NULL, new_dentry, &new_dentry->d_name))) | ||
1167 | return -EBUSY; | ||
1168 | |||
1169 | op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0, | ||
1170 | LUSTRE_OPC_ANY, NULL); | ||
1171 | if (IS_ERR(op_data)) | ||
1172 | return PTR_ERR(op_data); | ||
1173 | |||
1174 | ll_get_child_fid(old_dir, &old_dentry->d_name, &op_data->op_fid3); | ||
1175 | ll_get_child_fid(new_dir, &new_dentry->d_name, &op_data->op_fid4); | ||
1176 | err = md_rename(sbi->ll_md_exp, op_data, | ||
1177 | old_dentry->d_name.name, | ||
1178 | old_dentry->d_name.len, | ||
1179 | new_dentry->d_name.name, | ||
1180 | new_dentry->d_name.len, &request); | ||
1181 | ll_finish_md_op_data(op_data); | ||
1202 | if (!err) { | 1182 | if (!err) { |
1203 | d_move(old_dentry, new_dentry); | 1183 | ll_update_times(request, old_dir); |
1184 | ll_update_times(request, new_dir); | ||
1185 | ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); | ||
1186 | err = ll_objects_destroy(request, old_dir); | ||
1204 | } | 1187 | } |
1188 | |||
1189 | ptlrpc_req_finished(request); | ||
1190 | if (!err) | ||
1191 | d_move(old_dentry, new_dentry); | ||
1205 | return err; | 1192 | return err; |
1206 | } | 1193 | } |
1207 | 1194 | ||