aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/obdclass/dt_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/dt_object.c')
-rw-r--r--drivers/staging/lustre/lustre/obdclass/dt_object.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/dt_object.c b/drivers/staging/lustre/lustre/obdclass/dt_object.c
index 130b8dd0b418..52256c26bf07 100644
--- a/drivers/staging/lustre/lustre/obdclass/dt_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/dt_object.c
@@ -384,26 +384,30 @@ struct dt_object *dt_find_or_create(const struct lu_env *env,
return dto;
th = dt_trans_create(env, dt);
- if (IS_ERR(th))
- GOTO(out, rc = PTR_ERR(th));
+ if (IS_ERR(th)) {
+ rc = PTR_ERR(th);
+ goto out;
+ }
rc = dt_declare_create(env, dto, at, NULL, dof, th);
if (rc)
- GOTO(trans_stop, rc);
+ goto trans_stop;
rc = dt_trans_start_local(env, dt, th);
if (rc)
- GOTO(trans_stop, rc);
+ goto trans_stop;
dt_write_lock(env, dto, 0);
- if (dt_object_exists(dto))
- GOTO(unlock, rc = 0);
+ if (dt_object_exists(dto)) {
+ rc = 0;
+ goto unlock;
+ }
CDEBUG(D_OTHER, "create new object "DFID"\n", PFID(fid));
rc = dt_create(env, dto, at, NULL, dof, th);
if (rc)
- GOTO(unlock, rc);
+ goto unlock;
LASSERT(dt_object_exists(dto));
unlock:
dt_write_unlock(env, dto);
@@ -683,14 +687,18 @@ static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
ii->ii_hash_end = hash;
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_IDX_READ_BREAK)) {
- if (lip->lip_nr != 0)
- GOTO(out, rc = 0);
+ if (lip->lip_nr != 0) {
+ rc = 0;
+ goto out;
+ }
}
if (nob < size) {
if (lip->lip_nr == 0)
- GOTO(out, rc = -EINVAL);
- GOTO(out, rc = 0);
+ rc = -EINVAL;
+ else
+ rc = 0;
+ goto out;
}
if ((ii->ii_flags & II_FL_NOHASH) == 0) {
@@ -710,7 +718,7 @@ static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
rc = iops->rec(env, it, (struct dt_rec *)tmp_entry, attr);
if (rc != -ESTALE) {
if (rc != 0)
- GOTO(out, rc);
+ goto out;
/* hash/key/record successfully copied! */
lip->lip_nr++;
@@ -727,7 +735,7 @@ static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
} while (rc == 0);
- GOTO(out, rc);
+ goto out;
out:
if (rc >= 0 && lip->lip_nr > 0)
/* one more container */
@@ -869,20 +877,24 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev,
obj = dt_locate(env, dev, &ii->ii_fid);
if (IS_ERR(obj))
return PTR_ERR(obj);
- if (dt_object_exists(obj) == 0)
- GOTO(out, rc = -ENOENT);
+ if (dt_object_exists(obj) == 0) {
+ rc = -ENOENT;
+ goto out;
+ }
/* fetch index features associated with index object */
feat = dt_index_feat_select(fid_seq(&ii->ii_fid),
lu_object_attr(&obj->do_lu));
- if (IS_ERR(feat))
- GOTO(out, rc = PTR_ERR(feat));
+ if (IS_ERR(feat)) {
+ rc = PTR_ERR(feat);
+ goto out;
+ }
/* load index feature if not done already */
if (obj->do_index_ops == NULL) {
rc = obj->do_ops->do_index_try(env, obj, feat);
if (rc)
- GOTO(out, rc);
+ goto out;
}
/* fill ii_flags with supported index features */
@@ -893,7 +905,8 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev,
/* key size is variable */
ii->ii_flags |= II_FL_VARKEY;
/* we don't support variable key size for the time being */
- GOTO(out, rc = -EOPNOTSUPP);
+ rc = -EOPNOTSUPP;
+ goto out;
}
ii->ii_recsize = feat->dif_recsize_max;
@@ -901,7 +914,8 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev,
/* record size is variable */
ii->ii_flags |= II_FL_VARREC;
/* we don't support variable record size for the time being */
- GOTO(out, rc = -EOPNOTSUPP);
+ rc = -EOPNOTSUPP;
+ goto out;
}
if ((feat->dif_flags & DT_IND_NONUNQ) != 0)
@@ -922,7 +936,7 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev,
ii->ii_hash_end = II_END_OFF;
}
- GOTO(out, rc);
+ goto out;
out:
lu_object_put(env, &obj->do_lu);
return rc;