aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/lustre/lustre/llite/namei.c80
1 files changed, 38 insertions, 42 deletions
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index c3bd7e41c954..b4cc9247c0dd 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -1031,47 +1031,6 @@ out:
1031 return rc; 1031 return rc;
1032} 1032}
1033 1033
1034/* ll_unlink_generic() doesn't update the inode with the new link count.
1035 * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there
1036 * is any lock existing. They will recycle dentries and inodes based upon locks
1037 * too. b=20433 */
1038static int ll_unlink_generic(struct inode *dir, struct dentry *dparent,
1039 struct dentry *dchild, struct qstr *name)
1040{
1041 struct ptlrpc_request *request = NULL;
1042 struct md_op_data *op_data;
1043 int rc;
1044 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
1045 name->len, name->name, dir->i_ino, dir->i_generation, dir);
1046
1047 /*
1048 * XXX: unlink bind mountpoint maybe call to here,
1049 * just check it as vfs_unlink does.
1050 */
1051 if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
1052 return -EBUSY;
1053
1054 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
1055 name->len, 0, LUSTRE_OPC_ANY, NULL);
1056 if (IS_ERR(op_data))
1057 return PTR_ERR(op_data);
1058
1059 ll_get_child_fid(dir, name, &op_data->op_fid3);
1060 op_data->op_fid2 = op_data->op_fid3;
1061 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1062 ll_finish_md_op_data(op_data);
1063 if (rc)
1064 goto out;
1065
1066 ll_update_times(request, dir);
1067 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK, 1);
1068
1069 rc = ll_objects_destroy(request, dir);
1070 out:
1071 ptlrpc_req_finished(request);
1072 return rc;
1073}
1074
1075static int ll_rename_generic(struct inode *src, struct dentry *src_dparent, 1034static int ll_rename_generic(struct inode *src, struct dentry *src_dparent,
1076 struct dentry *src_dchild, struct qstr *src_name, 1035 struct dentry *src_dchild, struct qstr *src_name,
1077 struct inode *tgt, struct dentry *tgt_dparent, 1036 struct inode *tgt, struct dentry *tgt_dparent,
@@ -1115,9 +1074,46 @@ static int ll_rename_generic(struct inode *src, struct dentry *src_dparent,
1115 return err; 1074 return err;
1116} 1075}
1117 1076
1077/* 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
1079 * is any lock existing. They will recycle dentries and inodes based upon locks
1080 * too. b=20433 */
1118static int ll_unlink(struct inode * dir, struct dentry *dentry) 1081static int ll_unlink(struct inode * dir, struct dentry *dentry)
1119{ 1082{
1120 return ll_unlink_generic(dir, NULL, dentry, &dentry->d_name); 1083 struct ptlrpc_request *request = NULL;
1084 struct md_op_data *op_data;
1085 int rc;
1086 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n",
1087 dentry, dir->i_ino, dir->i_generation, dir);
1088
1089 /*
1090 * XXX: unlink bind mountpoint maybe call to here,
1091 * just check it as vfs_unlink does.
1092 */
1093 if (unlikely(ll_d_mountpoint(NULL, dentry, &dentry->d_name)))
1094 return -EBUSY;
1095
1096 op_data = ll_prep_md_op_data(NULL, dir, NULL,
1097 dentry->d_name.name,
1098 dentry->d_name.len,
1099 0, LUSTRE_OPC_ANY, NULL);
1100 if (IS_ERR(op_data))
1101 return PTR_ERR(op_data);
1102
1103 ll_get_child_fid(dir, &dentry->d_name, &op_data->op_fid3);
1104 op_data->op_fid2 = op_data->op_fid3;
1105 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1106 ll_finish_md_op_data(op_data);
1107 if (rc)
1108 goto out;
1109
1110 ll_update_times(request, dir);
1111 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK, 1);
1112
1113 rc = ll_objects_destroy(request, dir);
1114 out:
1115 ptlrpc_req_finished(request);
1116 return rc;
1121} 1117}
1122 1118
1123static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) 1119static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode)