struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
struct dentry *save = dentry, *retval;
struct ptlrpc_request *req = NULL;
- struct md_op_data op_data;
+ struct md_op_data *op_data;
struct it_cb_data icbd;
int rc;
ENTRY;
icbd.icbd_childp = &dentry;
icbd.icbd_parent = parent;
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(ERR_PTR(-ENOMEM));
+
/* prepare operatoin hint first */
- ll_prepare_md_op_data(&op_data, parent, NULL, dentry->d_name.name,
- dentry->d_name.len, lookup_flags);
+ ll_prepare_md_op_data(op_data, parent, NULL, dentry->d_name.name,
+ dentry->d_name.len, lookup_flags);
/* allocate new fid for child */
if (it->it_op & IT_CREAT ||
.ph_cname = &dentry->d_name,
.ph_opc = LUSTRE_OPC_CREATE };
- rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data.fid2, &hint);
+ rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, &hint);
if (rc) {
CERROR("can't allocate new fid, rc %d\n", rc);
LBUG();
it->it_create_mode &= ~current->fs->umask;
- rc = md_intent_lock(ll_i2mdexp(parent), &op_data, NULL, 0, it,
+ rc = md_intent_lock(ll_i2mdexp(parent), op_data, NULL, 0, it,
lookup_flags, &req, ll_md_blocking_ast, 0);
-
+ OBD_FREE_PTR(op_data);
+
if (rc < 0)
GOTO(out, retval = ERR_PTR(rc));
struct ptlrpc_request *request = NULL;
struct inode *inode = NULL;
struct ll_sb_info *sbi = ll_i2sbi(dir);
- struct md_op_data op_data;
+ struct md_op_data *op_data;
struct lu_placement_hint hint = {
.ph_pname = NULL,
.ph_cname = name,
case S_IFBLK:
case S_IFIFO:
case S_IFSOCK:
- ll_prepare_md_op_data(&op_data, dir, NULL, name->name,
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(-ENOMEM);
+ ll_prepare_md_op_data(op_data, dir, NULL, name->name,
name->len, 0);
- err = ll_fid_md_alloc(sbi, &op_data.fid2, &hint);
+ err = ll_fid_md_alloc(sbi, &op_data->fid2, &hint);
if (err)
break;
- err = md_create(sbi->ll_md_exp, &op_data, NULL, 0, mode,
+ err = md_create(sbi->ll_md_exp, op_data, NULL, 0, mode,
current->fsuid, current->fsgid,
current->cap_effective, rdev, &request);
+ OBD_FREE_PTR(op_data);
if (err)
break;
ll_update_times(request, 0, dir);
struct ptlrpc_request *request = NULL;
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct inode *inode = NULL;
- struct md_op_data op_data;
+ struct md_op_data *op_data;
int err;
ENTRY;
name->len, name->name, dir->i_ino, dir->i_generation,
dir, tgt);
- ll_prepare_md_op_data(&op_data, dir, NULL,
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(-ENOMEM);
+
+ ll_prepare_md_op_data(op_data, dir, NULL,
name->name, name->len, 0);
/* allocate new fid */
- err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2, &hint);
+ err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data->fid2, &hint);
if (err) {
CERROR("can't allocate new fid, rc %d\n", err);
LBUG();
}
- err = md_create(sbi->ll_md_exp, &op_data,
+ err = md_create(sbi->ll_md_exp, op_data,
tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
current->fsuid, current->fsgid, current->cap_effective,
0, &request);
+ OBD_FREE_PTR(op_data);
if (err == 0) {
ll_update_times(request, 0, dir);
{
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct ptlrpc_request *request = NULL;
- struct md_op_data op_data;
+ struct md_op_data *op_data;
int err;
ENTRY;
src->i_ino, src->i_generation, src, dir->i_ino,
dir->i_generation, dir, name->len, name->name);
- ll_prepare_md_op_data(&op_data, src, dir, name->name,
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(-ENOMEM);
+ ll_prepare_md_op_data(op_data, src, dir, name->name,
name->len, 0);
- err = md_link(sbi->ll_md_exp, &op_data, &request);
+ err = md_link(sbi->ll_md_exp, op_data, &request);
+ OBD_FREE_PTR(op_data);
if (err == 0)
ll_update_times(request, 0, dir);
ptlrpc_req_finished(request);
-
RETURN(err);
}
-static int ll_mkdir_generic(struct inode *dir, struct qstr *name, int mode,
- struct dentry *dchild)
+static int ll_mkdir_generic(struct inode *dir, struct qstr *name,
+ int mode, struct dentry *dchild)
{
struct lu_placement_hint hint = { .ph_pname = NULL,
struct ptlrpc_request *request = NULL;
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct inode *inode = NULL;
- struct md_op_data op_data;
+ struct md_op_data *op_data;
int err;
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
- ll_prepare_md_op_data(&op_data, dir, NULL,
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(-ENOMEM);
+ ll_prepare_md_op_data(op_data, dir, NULL,
name->name, name->len, 0);
/* allocate new fid */
- err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2, &hint);
+ err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data->fid2, &hint);
if (err) {
CERROR("can't allocate new fid, rc %d\n", err);
LBUG();
}
- err = md_create(sbi->ll_md_exp, &op_data, NULL, 0, mode,
- current->fsuid, current->fsgid, current->cap_effective,
- 0, &request);
+ err = md_create(sbi->ll_md_exp, op_data, NULL, 0, mode,
+ current->fsuid, current->fsgid,
+ current->cap_effective, 0, &request);
+ OBD_FREE_PTR(op_data);
ll_update_times(request, 0, dir);
if (!err && dchild) {
err = ll_prep_inode(&inode, request, 0,
struct qstr *name)
{
struct ptlrpc_request *request = NULL;
- struct md_op_data op_data;
+ struct md_op_data *op_data;
struct dentry *dentry;
int rc;
ENTRY;
}
}
- ll_prepare_md_op_data(&op_data, dir, NULL, name->name,
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(-ENOMEM);
+
+ ll_prepare_md_op_data(op_data, dir, NULL, name->name,
name->len, S_IFDIR);
- rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, &op_data, &request);
+ rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
+ OBD_FREE_PTR(op_data);
if (rc == 0)
ll_update_times(request, 0, dir);
ptlrpc_req_finished(request);
static int ll_unlink_generic(struct inode * dir, struct qstr *name)
{
struct ptlrpc_request *request = NULL;
- struct md_op_data op_data;
+ struct md_op_data *op_data;
int rc;
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
name->len, name->name, dir->i_ino, dir->i_generation, dir);
- ll_prepare_md_op_data(&op_data, dir, NULL, name->name,
- name->len,
- 0);
- rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, &op_data, &request);
+ ll_prepare_md_op_data(op_data, dir, NULL, name->name,
+ name->len, 0);
+ rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
+ OBD_FREE_PTR(op_data);
+
if (rc)
GOTO(out, rc);
{
struct ptlrpc_request *request = NULL;
struct ll_sb_info *sbi = ll_i2sbi(src);
- struct md_op_data op_data;
+ struct md_op_data *op_data;
int err;
ENTRY;
CDEBUG(D_VFSTRACE,"VFS Op:oldname=%.*s,src_dir=%lu/%u(%p),newname=%.*s,"
src->i_ino, src->i_generation, src, tgt_name->len,
tgt_name->name, tgt->i_ino, tgt->i_generation, tgt);
- ll_prepare_md_op_data(&op_data, src, tgt, NULL, 0, 0);
- err = md_rename(sbi->ll_md_exp, &op_data,
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ RETURN(-ENOMEM);
+
+ ll_prepare_md_op_data(op_data, src, tgt, NULL, 0, 0);
+ err = md_rename(sbi->ll_md_exp, op_data,
src_name->name, src_name->len,
tgt_name->name, tgt_name->len, &request);
+ OBD_FREE_PTR(op_data);
if (!err) {
ll_update_times(request, 0, src);
ll_update_times(request, 0, tgt);