* GPL HEADER END
*/
/*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2013, Intel Corporation.
*/
#define DEBUG_SUBSYSTEM S_MDS
struct mdd_device *mdd,
struct mdd_object *o)
{
- struct thandle *th = NULL;
+ struct thandle *th;
const struct dt_key *dot = (const struct dt_key *)".";
const struct dt_key *dotdot = (const struct dt_key *)"..";
int rc;
th = dt_trans_create(env, mdd->mdd_child);
if (IS_ERR(th))
RETURN(PTR_ERR(th));
+
rc = dt_declare_delete(env, mdd_object_child(o), dot, th);
if (rc)
GOTO(out, rc);
GOTO(out, rc);
out:
- if (th)
- dt_trans_stop(env, mdd->mdd_child, th);
+ dt_trans_stop(env, mdd->mdd_child, th);
RETURN(rc);
}
struct mdd_object *o,
const struct lu_name *name)
{
- struct thandle *th = NULL;
+ struct thandle *th;
struct lu_fid oldfid;
int rc;
ENTRY;
th = dt_trans_create(env, mdd->mdd_child);
+ if (IS_ERR(th))
+ RETURN(PTR_ERR(th));
+
rc = mdd_declare_links_add(env, o, th, NULL);
if (rc)
GOTO(out, rc);
rc = 0;
out:
- if (th)
- dt_trans_stop(env, mdd->mdd_child, th);
+ dt_trans_stop(env, mdd->mdd_child, th);
RETURN(rc);
}
const struct lu_name *name)
{
struct mdd_object *o;
- struct lu_attr *la = &mdd_env_info(env)->mti_la;
+ struct lu_attr *la = MDD_ENV_VAR(env, cattr);
int rc;
ENTRY;
struct mdd_object *o)
{
struct lustre_mdt_attrs *lma;
- struct thandle *th = NULL;
+ struct thandle *th;
struct lu_fid fid;
struct lu_buf buf;
int rc;
lu_root_fid(&fid);
lma = (struct lustre_mdt_attrs *)&mdd_env_info(env)->mti_xattr_buf;
- lustre_lma_init(lma, &fid, 0);
+ lustre_lma_init(lma, &fid, 0, 0);
lustre_lma_swab(lma);
buf.lb_buf = lma;
buf.lb_len = sizeof(*lma);
GOTO(out, rc);
rc = mdo_xattr_set(env, o, &buf, XATTR_NAME_LMA, 0, th, BYPASS_CAPA);
out:
- if (th)
- dt_trans_stop(env, mdd->mdd_child, th);
+ dt_trans_stop(env, mdd->mdd_child, th);
RETURN(rc);
}