aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/lmv/lmv_obd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/lmv/lmv_obd.c')
-rw-r--r--drivers/staging/lustre/lustre/lmv/lmv_obd.c111
1 files changed, 66 insertions, 45 deletions
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index a66b3e000d57..1a5821289c39 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -97,12 +97,16 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct obd_uuid *uuid,
break;
}
- if (i == lmv->desc.ld_tgt_count)
- GOTO(out_lmv_lock, rc = -EINVAL);
+ if (i == lmv->desc.ld_tgt_count) {
+ rc = -EINVAL;
+ goto out_lmv_lock;
+ }
obd = class_exp2obd(tgt->ltd_exp);
- if (obd == NULL)
- GOTO(out_lmv_lock, rc = -ENOTCONN);
+ if (obd == NULL) {
+ rc = -ENOTCONN;
+ goto out_lmv_lock;
+ }
CDEBUG(D_INFO, "Found OBD %s=%s device %d (%p) type %s at LMV idx %d\n",
obd->obd_name, obd->obd_uuid.uuid, obd->obd_minor, obd,
@@ -112,7 +116,7 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct obd_uuid *uuid,
if (tgt->ltd_active == activate) {
CDEBUG(D_INFO, "OBD %p already %sactive!\n", obd,
activate ? "" : "in");
- GOTO(out_lmv_lock, rc);
+ goto out_lmv_lock;
}
CDEBUG(D_INFO, "Marking OBD %p %sactive\n", obd,
@@ -574,7 +578,7 @@ int lmv_check_connect(struct obd_device *obd)
continue;
rc = lmv_connect_mdc(obd, tgt);
if (rc)
- GOTO(out_disc, rc);
+ goto out_disc;
}
lmv_set_timeouts(obd);
@@ -712,7 +716,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg, void *uarg)
repeat_fid2path:
rc = obd_iocontrol(OBD_IOC_FID2PATH, tgt->ltd_exp, len, gf, uarg);
if (rc != 0 && rc != -EREMOTE)
- GOTO(out_fid2path, rc);
+ goto out_fid2path;
/* If remote_gf != NULL, it means just building the
* path on the remote MDT, copy this path segment to gf */
@@ -722,8 +726,10 @@ repeat_fid2path:
ori_gf = (struct getinfo_fid2path *)karg;
if (strlen(ori_gf->gf_path) +
- strlen(gf->gf_path) > ori_gf->gf_pathlen)
- GOTO(out_fid2path, rc = -EOVERFLOW);
+ strlen(gf->gf_path) > ori_gf->gf_pathlen) {
+ rc = -EOVERFLOW;
+ goto out_fid2path;
+ }
ptr = ori_gf->gf_path;
@@ -741,14 +747,16 @@ repeat_fid2path:
gf->gf_linkno);
if (rc == 0)
- GOTO(out_fid2path, rc);
+ goto out_fid2path;
/* sigh, has to go to another MDT to do path building further */
if (remote_gf == NULL) {
remote_gf_size = sizeof(*remote_gf) + PATH_MAX;
OBD_ALLOC(remote_gf, remote_gf_size);
- if (remote_gf == NULL)
- GOTO(out_fid2path, rc = -ENOMEM);
+ if (remote_gf == NULL) {
+ rc = -ENOMEM;
+ goto out_fid2path;
+ }
remote_gf->gf_pathlen = PATH_MAX;
}
@@ -756,12 +764,15 @@ repeat_fid2path:
CERROR("%s: invalid FID "DFID": rc = %d\n",
tgt->ltd_exp->exp_obd->obd_name,
PFID(&gf->gf_fid), -EINVAL);
- GOTO(out_fid2path, rc = -EINVAL);
+ rc = -EINVAL;
+ goto out_fid2path;
}
tgt = lmv_find_target(lmv, &gf->gf_fid);
- if (IS_ERR(tgt))
- GOTO(out_fid2path, rc = -EINVAL);
+ if (IS_ERR(tgt)) {
+ rc = -EINVAL;
+ goto out_fid2path;
+ }
remote_gf->gf_fid = gf->gf_fid;
remote_gf->gf_recno = -1;
@@ -1178,7 +1189,7 @@ static int lmv_nid_policy(struct lmv_obd *lmv)
}
static int lmv_choose_mds(struct lmv_obd *lmv, struct md_op_data *op_data,
- placement_policy_t placement)
+ enum placement_policy placement)
{
switch (placement) {
case PLACEMENT_CHAR_POLICY:
@@ -1201,8 +1212,7 @@ static int lmv_choose_mds(struct lmv_obd *lmv, struct md_op_data *op_data,
* This is _inode_ placement policy function (not name).
*/
static int lmv_placement_policy(struct obd_device *obd,
- struct md_op_data *op_data,
- mdsno_t *mds)
+ struct md_op_data *op_data, u32 *mds)
{
struct lmv_obd *lmv = &obd->u.lmv;
@@ -1241,8 +1251,7 @@ static int lmv_placement_policy(struct obd_device *obd,
return 0;
}
-int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
- mdsno_t mds)
+int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds)
{
struct lmv_tgt_desc *tgt;
int rc;
@@ -1257,8 +1266,10 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
*/
mutex_lock(&tgt->ltd_fid_mutex);
- if (tgt->ltd_active == 0 || tgt->ltd_exp == NULL)
- GOTO(out, rc = -ENODEV);
+ if (tgt->ltd_active == 0 || tgt->ltd_exp == NULL) {
+ rc = -ENODEV;
+ goto out;
+ }
/*
* Asking underlaying tgt layer to allocate new fid.
@@ -1279,7 +1290,7 @@ int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
{
struct obd_device *obd = class_exp2obd(exp);
struct lmv_obd *lmv = &obd->u.lmv;
- mdsno_t mds = 0;
+ u32 mds = 0;
int rc;
LASSERT(op_data != NULL);
@@ -1352,7 +1363,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
LUSTRE_CLI_FLD_HASH_DHT);
if (rc) {
CERROR("Can't init FLD, err %d\n", rc);
- GOTO(out, rc);
+ goto out;
}
return 0;
@@ -1379,7 +1390,7 @@ static int lmv_cleanup(struct obd_device *obd)
return 0;
}
-static int lmv_process_config(struct obd_device *obd, obd_count len, void *buf)
+static int lmv_process_config(struct obd_device *obd, u32 len, void *buf)
{
struct lustre_cfg *lcfg = buf;
struct obd_uuid obd_uuid;
@@ -1391,20 +1402,27 @@ static int lmv_process_config(struct obd_device *obd, obd_count len, void *buf)
case LCFG_ADD_MDC:
/* modify_mdc_tgts add 0:lustre-clilmv 1:lustre-MDT0000_UUID
* 2:0 3:1 4:lustre-MDT0000-mdc_UUID */
- if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(obd_uuid.uuid))
- GOTO(out, rc = -EINVAL);
+ if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(obd_uuid.uuid)) {
+ rc = -EINVAL;
+ goto out;
+ }
obd_str2uuid(&obd_uuid, lustre_cfg_buf(lcfg, 1));
- if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", &index) != 1)
- GOTO(out, rc = -EINVAL);
- if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1)
- GOTO(out, rc = -EINVAL);
+ if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", &index) != 1) {
+ rc = -EINVAL;
+ goto out;
+ }
+ if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1) {
+ rc = -EINVAL;
+ goto out;
+ }
rc = lmv_add_target(obd, &obd_uuid, index, gen);
- GOTO(out, rc);
+ goto out;
default:
CERROR("Unknown command: %d\n", lcfg->lcfg_command);
- GOTO(out, rc = -EINVAL);
+ rc = -EINVAL;
+ goto out;
}
out:
return rc;
@@ -1437,7 +1455,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
CERROR("can't stat MDS #%d (%s), error %d\n", i,
lmv->tgts[i]->ltd_exp->exp_obd->obd_name,
rc);
- GOTO(out_free_temp, rc);
+ goto out_free_temp;
}
if (i == 0) {
@@ -1449,7 +1467,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
* And also clients can be mounted as long as
* MDT0 is in service*/
if (flags & OBD_STATFS_FOR_MDT0)
- GOTO(out_free_temp, rc);
+ goto out_free_temp;
} else {
osfs->os_bavail += temp->os_bavail;
osfs->os_blocks += temp->os_blocks;
@@ -1480,7 +1498,7 @@ static int lmv_getstatus(struct obd_export *exp,
}
static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, obd_valid valid, const char *name,
+ struct obd_capa *oc, u64 valid, const char *name,
const char *input, int input_size, int output_size,
int flags, struct ptlrpc_request **request)
{
@@ -1504,7 +1522,7 @@ static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
}
static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, obd_valid valid, const char *name,
+ struct obd_capa *oc, u64 valid, const char *name,
const char *input, int input_size, int output_size,
int flags, __u32 suppgid,
struct ptlrpc_request **request)
@@ -1750,12 +1768,16 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
ptlrpc_req_finished(req);
tgt = lmv_find_target(lmv, &fid1);
- if (IS_ERR(tgt))
- GOTO(out, rc = PTR_ERR(tgt));
+ if (IS_ERR(tgt)) {
+ rc = PTR_ERR(tgt);
+ goto out;
+ }
OBD_ALLOC_PTR(rdata);
- if (rdata == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (rdata == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
rdata->op_fid1 = fid1;
rdata->op_bias = MDS_CROSS_REF;
@@ -1804,7 +1826,7 @@ lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
}
static int
-lmv_getattr_name(struct obd_export *exp,struct md_op_data *op_data,
+lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
struct ptlrpc_request **request)
{
struct ptlrpc_request *req = NULL;
@@ -2371,7 +2393,7 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp,
}
int lmv_set_info_async(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, obd_count vallen,
+ u32 keylen, void *key, u32 vallen,
void *val, struct ptlrpc_request_set *set)
{
struct lmv_tgt_desc *tgt;
@@ -2488,8 +2510,7 @@ int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
if (mea->mea_magic == MEA_MAGIC_LAST_CHAR ||
mea->mea_magic == MEA_MAGIC_ALL_CHARS ||
- mea->mea_magic == MEA_MAGIC_HASH_SEGMENT)
- {
+ mea->mea_magic == MEA_MAGIC_HASH_SEGMENT) {
magic = le32_to_cpu(mea->mea_magic);
} else {
/*