The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier lbl;
@@
if (...)
GOTO(lbl,...);
+else
GOTO(lbl,...);
@@
identifier lbl,rc;
constant c;
expression e,e1;
@@
if (
- e
+ !e
)
- GOTO(lbl,\(rc\|c\));
-else GOTO(lbl,e1);
+ e1;
+goto lbl;
@@
identifier lbl,rc;
constant c;
expression e,e1;
@@
if (e)
- GOTO(lbl,e1);
-else GOTO(lbl,\(rc\|c\));
+ e1;
+goto lbl;
@@
identifier lbl;
expression e,e1,e2;
@@
if (e)
- GOTO(lbl,e1);
-else GOTO(lbl,e2);
+ e1;
+else e2;
+goto lbl;
// ------------------------------------------------------------------------
@@
identifier lbl,rc;
constant c;
@@
- GOTO(lbl,\(rc\|c\));
+ goto lbl;
@@
identifier lbl;
expression rc;
@@
- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>
The rules above the line deal with the case where the goto desination is
the same whether or not the the branch is taken. In that case, the goto is
created in just one instance after the if. This affects only the files
namei.c and llite_lib.c.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 files changed:
if (IS_ERR(page)) {
CERROR("dir page locate: "DFID" at %llu: rc %ld\n",
PFID(ll_inode2fid(dir)), lhash, PTR_ERR(page));
if (IS_ERR(page)) {
CERROR("dir page locate: "DFID" at %llu: rc %ld\n",
PFID(ll_inode2fid(dir)), lhash, PTR_ERR(page));
- GOTO(out_unlock, page);
} else if (page != NULL) {
/*
* XXX nikita: not entirely correct handling of a corner case:
} else if (page != NULL) {
/*
* XXX nikita: not entirely correct handling of a corner case:
* it as an "overflow" page. 1. invalidate all pages at
* once. 2. use HASH|1 as an index for P1.
*/
* it as an "overflow" page. 1. invalidate all pages at
* once. 2. use HASH|1 as an index for P1.
*/
- GOTO(hash_collision, page);
}
page = read_cache_page(mapping, hash_x_index(hash, hash64),
}
page = read_cache_page(mapping, hash_x_index(hash, hash64),
if (IS_ERR(page)) {
CERROR("read cache page: "DFID" at %llu: rc %ld\n",
PFID(ll_inode2fid(dir)), hash, PTR_ERR(page));
if (IS_ERR(page)) {
CERROR("read cache page: "DFID" at %llu: rc %ld\n",
PFID(ll_inode2fid(dir)), hash, PTR_ERR(page));
- GOTO(out_unlock, page);
}
wait_on_page_locked(page);
}
wait_on_page_locked(page);
" 32bit_api %d\n", inode->i_ino, inode->i_generation,
inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32);
" 32bit_api %d\n", inode->i_ino, inode->i_generation,
inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32);
- if (lfd->lfd_pos == MDS_DIR_END_OFF)
+ if (lfd->lfd_pos == MDS_DIR_END_OFF) {
+ rc = 0;
+ goto out;
+ }
ctx->pos = lfd->lfd_pos;
rc = ll_dir_read(inode, ctx);
ctx->pos = lfd->lfd_pos;
rc = ll_dir_read(inode, ctx);
op_data = ll_prep_md_op_data(NULL, dir, NULL, filename,
strlen(filename), mode, LUSTRE_OPC_MKDIR,
lump);
op_data = ll_prep_md_op_data(NULL, dir, NULL, filename,
strlen(filename), mode, LUSTRE_OPC_MKDIR,
lump);
- if (IS_ERR(op_data))
- GOTO(err_exit, err = PTR_ERR(op_data));
+ if (IS_ERR(op_data)) {
+ err = PTR_ERR(op_data);
+ goto err_exit;
+ }
op_data->op_cli_flags |= CLI_SET_MEA;
err = md_create(sbi->ll_md_exp, op_data, lump, sizeof(*lump), mode,
op_data->op_cli_flags |= CLI_SET_MEA;
err = md_create(sbi->ll_md_exp, op_data, lump, sizeof(*lump), mode,
cfs_curproc_cap_pack(), 0, &request);
ll_finish_md_op_data(op_data);
if (err)
cfs_curproc_cap_pack(), 0, &request);
ll_finish_md_op_data(op_data);
if (err)
err_exit:
ptlrpc_req_finished(request);
return err;
err_exit:
ptlrpc_req_finished(request);
return err;
char *buf;
OBD_ALLOC(param, MGS_PARAM_MAXLEN);
char *buf;
OBD_ALLOC(param, MGS_PARAM_MAXLEN);
- if (param == NULL)
- GOTO(end, rc = -ENOMEM);
+ if (param == NULL) {
+ rc = -ENOMEM;
+ goto end;
+ }
buf = param;
/* Get fsname and assume devname to be -MDT0000. */
buf = param;
/* Get fsname and assume devname to be -MDT0000. */
lump ? le32_to_cpu(lump->lmm_stripe_size) : 0);
rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param);
if (rc)
lump ? le32_to_cpu(lump->lmm_stripe_size) : 0);
rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param);
if (rc)
/* Set root stripecount */
sprintf(buf, ".stripecount=%hd",
lump ? le16_to_cpu(lump->lmm_stripe_count) : 0);
rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param);
if (rc)
/* Set root stripecount */
sprintf(buf, ".stripecount=%hd",
lump ? le16_to_cpu(lump->lmm_stripe_count) : 0);
rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param);
if (rc)
/* Set root stripeoffset */
sprintf(buf, ".stripeoffset=%hd",
/* Set root stripeoffset */
sprintf(buf, ".stripeoffset=%hd",
CDEBUG(D_INFO, "md_getattr failed on inode "
"%lu/%u: rc %d\n", inode->i_ino,
inode->i_generation, rc);
CDEBUG(D_INFO, "md_getattr failed on inode "
"%lu/%u: rc %d\n", inode->i_ino,
inode->i_generation, rc);
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (!(body->valid & (OBD_MD_FLEASIZE | OBD_MD_FLDIREA)) ||
lmmsize == 0) {
if (!(body->valid & (OBD_MD_FLEASIZE | OBD_MD_FLDIREA)) ||
lmmsize == 0) {
- GOTO(out, rc = -ENODATA);
+ rc = -ENODATA;
+ goto out;
}
lmm = req_capsule_server_sized_get(&req->rq_pill,
}
lmm = req_capsule_server_sized_get(&req->rq_pill,
hpk.hpk_flags |= HP_FLAG_RETRY;
/* hpk_errval is >= 0 */
hpk.hpk_errval = -PTR_ERR(inode);
hpk.hpk_flags |= HP_FLAG_RETRY;
/* hpk_errval is >= 0 */
hpk.hpk_errval = -PTR_ERR(inode);
- GOTO(progress, rc = PTR_ERR(inode));
+ rc = PTR_ERR(inode);
+ goto progress;
}
/* Read current file data version */
}
/* Read current file data version */
hpk.hpk_flags |= HP_FLAG_RETRY;
/* hpk_errval must be >= 0 */
hpk.hpk_errval = -rc;
hpk.hpk_flags |= HP_FLAG_RETRY;
/* hpk_errval must be >= 0 */
hpk.hpk_errval = -rc;
}
/* Store it the hsm_copy for later copytool use.
}
/* Store it the hsm_copy for later copytool use.
hpk.hpk_flags |= HP_FLAG_RETRY;
/* hpk_errval must be >= 0 */
hpk.hpk_errval = -PTR_ERR(inode);
hpk.hpk_flags |= HP_FLAG_RETRY;
/* hpk_errval must be >= 0 */
hpk.hpk_errval = -PTR_ERR(inode);
- GOTO(progress, rc = PTR_ERR(inode));
+ rc = PTR_ERR(inode);
+ goto progress;
}
rc = ll_data_version(inode, &data_version,
}
rc = ll_data_version(inode, &data_version,
"Request could not be confirmed.\n");
if (hpk.hpk_errval == 0)
hpk.hpk_errval = -rc;
"Request could not be confirmed.\n");
if (hpk.hpk_errval == 0)
hpk.hpk_errval = -rc;
}
/* Store it the hsm_copy for later copytool use.
}
/* Store it the hsm_copy for later copytool use.
struct obd_quotactl *oqctl_tmp;
OBD_ALLOC_PTR(oqctl_tmp);
struct obd_quotactl *oqctl_tmp;
OBD_ALLOC_PTR(oqctl_tmp);
- if (oqctl_tmp == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (oqctl_tmp == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
oqctl_tmp->qc_cmd = Q_GETOQUOTA;
oqctl_tmp->qc_id = oqctl->qc_id;
oqctl_tmp->qc_cmd = Q_GETOQUOTA;
oqctl_tmp->qc_id = oqctl->qc_id;
if (namelen < 1) {
CDEBUG(D_INFO, "IOC_MDC_LOOKUP missing filename\n");
if (namelen < 1) {
CDEBUG(D_INFO, "IOC_MDC_LOOKUP missing filename\n");
- GOTO(out_free, rc = -EINVAL);
+ rc = -EINVAL;
+ goto out_free;
}
op_data = ll_prep_md_op_data(NULL, inode, NULL, filename, namelen,
0, LUSTRE_OPC_ANY, NULL);
}
op_data = ll_prep_md_op_data(NULL, inode, NULL, filename, namelen,
0, LUSTRE_OPC_ANY, NULL);
- if (IS_ERR(op_data))
- GOTO(out_free, rc = PTR_ERR(op_data));
+ if (IS_ERR(op_data)) {
+ rc = PTR_ERR(op_data);
+ goto out_free;
+ }
op_data->op_valid = OBD_MD_FLID;
rc = md_getattr_name(sbi->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name: %d\n", rc);
op_data->op_valid = OBD_MD_FLID;
rc = md_getattr_name(sbi->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name: %d\n", rc);
}
ptlrpc_req_finished(request);
out_free:
}
ptlrpc_req_finished(request);
out_free:
data = (void *)buf;
if (data->ioc_inlbuf1 == NULL || data->ioc_inlbuf2 == NULL ||
data = (void *)buf;
if (data->ioc_inlbuf1 == NULL || data->ioc_inlbuf2 == NULL ||
- data->ioc_inllen1 == 0 || data->ioc_inllen2 == 0)
- GOTO(lmv_out_free, rc = -EINVAL);
+ data->ioc_inllen1 == 0 || data->ioc_inllen2 == 0) {
+ rc = -EINVAL;
+ goto lmv_out_free;
+ }
filename = data->ioc_inlbuf1;
namelen = data->ioc_inllen1;
if (namelen < 1) {
CDEBUG(D_INFO, "IOC_MDC_LOOKUP missing filename\n");
filename = data->ioc_inlbuf1;
namelen = data->ioc_inllen1;
if (namelen < 1) {
CDEBUG(D_INFO, "IOC_MDC_LOOKUP missing filename\n");
- GOTO(lmv_out_free, rc = -EINVAL);
+ rc = -EINVAL;
+ goto lmv_out_free;
}
lum = (struct lmv_user_md *)data->ioc_inlbuf2;
lumlen = data->ioc_inllen2;
}
lum = (struct lmv_user_md *)data->ioc_inlbuf2;
lumlen = data->ioc_inllen2;
lumlen != sizeof(*lum)) {
CERROR("%s: wrong lum magic %x or size %d: rc = %d\n",
filename, lum->lum_magic, lumlen, -EFAULT);
lumlen != sizeof(*lum)) {
CERROR("%s: wrong lum magic %x or size %d: rc = %d\n",
filename, lum->lum_magic, lumlen, -EFAULT);
- GOTO(lmv_out_free, rc = -EINVAL);
+ rc = -EINVAL;
+ goto lmv_out_free;
lum_size = lmv_user_md_size(1, LMV_MAGIC_V1);
OBD_ALLOC(tmp, lum_size);
lum_size = lmv_user_md_size(1, LMV_MAGIC_V1);
OBD_ALLOC(tmp, lum_size);
- if (tmp == NULL)
- GOTO(free_lmv, rc = -ENOMEM);
+ if (tmp == NULL) {
+ rc = -ENOMEM;
+ goto free_lmv;
+ }
*tmp = lum;
tmp->lum_type = LMV_STRIPE_TYPE;
tmp->lum_stripe_count = 1;
mdtindex = ll_get_mdt_idx(inode);
*tmp = lum;
tmp->lum_type = LMV_STRIPE_TYPE;
tmp->lum_stripe_count = 1;
mdtindex = ll_get_mdt_idx(inode);
- if (mdtindex < 0)
- GOTO(free_lmv, rc = -ENOMEM);
+ if (mdtindex < 0) {
+ rc = -ENOMEM;
+ goto free_lmv;
+ }
tmp->lum_stripe_offset = mdtindex;
tmp->lum_objects[0].lum_mds = mdtindex;
memcpy(&tmp->lum_objects[0].lum_fid, ll_inode2fid(inode),
sizeof(struct lu_fid));
tmp->lum_stripe_offset = mdtindex;
tmp->lum_objects[0].lum_mds = mdtindex;
memcpy(&tmp->lum_objects[0].lum_fid, ll_inode2fid(inode),
sizeof(struct lu_fid));
- if (copy_to_user((void *)arg, tmp, lum_size))
- GOTO(free_lmv, rc = -EFAULT);
+ if (copy_to_user((void *)arg, tmp, lum_size)) {
+ rc = -EFAULT;
+ goto free_lmv;
+ }
free_lmv:
if (tmp)
OBD_FREE(tmp, lum_size);
free_lmv:
if (tmp)
OBD_FREE(tmp, lum_size);
return PTR_ERR(filename);
namelen = strlen(filename);
return PTR_ERR(filename);
namelen = strlen(filename);
- if (namelen < 1)
- GOTO(out_rmdir, rc = -EINVAL);
+ if (namelen < 1) {
+ rc = -EINVAL;
+ goto out_rmdir;
+ }
rc = ll_rmdir_entry(inode, filename, namelen);
out_rmdir:
rc = ll_rmdir_entry(inode, filename, namelen);
out_rmdir:
&RMF_MDT_BODY);
LASSERT(body != NULL);
} else {
&RMF_MDT_BODY);
LASSERT(body != NULL);
} else {
}
if (rc < 0) {
if (rc == -ENODATA && (cmd == IOC_MDC_GETFILEINFO ||
}
if (rc < 0) {
if (rc == -ENODATA && (cmd == IOC_MDC_GETFILEINFO ||
- cmd == LL_IOC_MDC_GETINFO))
- GOTO(skip_lmm, rc = 0);
+ cmd == LL_IOC_MDC_GETINFO)) {
+ rc = 0;
+ goto skip_lmm;
+ }
}
if (cmd == IOC_MDC_GETFILESTRIPE ||
}
if (cmd == IOC_MDC_GETFILESTRIPE ||
lump = &lmdp->lmd_lmm;
}
if (copy_to_user(lump, lmm, lmmsize)) {
lump = &lmdp->lmd_lmm;
}
if (copy_to_user(lump, lmm, lmmsize)) {
- if (copy_to_user(lump, lmm, sizeof(*lump)))
- GOTO(out_req, rc = -EFAULT);
+ if (copy_to_user(lump, lmm, sizeof(*lump))) {
+ rc = -EFAULT;
+ goto out_req;
+ }
rc = -EOVERFLOW;
}
skip_lmm:
rc = -EOVERFLOW;
}
skip_lmm:
st.st_ino = inode->i_ino;
lmdp = (struct lov_user_mds_data *)arg;
st.st_ino = inode->i_ino;
lmdp = (struct lov_user_mds_data *)arg;
- if (copy_to_user(&lmdp->lmd_st, &st, sizeof(st)))
- GOTO(out_req, rc = -EFAULT);
+ if (copy_to_user(&lmdp->lmd_st, &st, sizeof(st))) {
+ rc = -EFAULT;
+ goto out_req;
+ }
OBD_ALLOC_LARGE(lmm, lmmsize);
if (lmm == NULL)
return -ENOMEM;
OBD_ALLOC_LARGE(lmm, lmmsize);
if (lmm == NULL)
return -ENOMEM;
- if (copy_from_user(lmm, lum, lmmsize))
- GOTO(free_lmm, rc = -EFAULT);
+ if (copy_from_user(lmm, lum, lmmsize)) {
+ rc = -EFAULT;
+ goto free_lmm;
+ }
switch (lmm->lmm_magic) {
case LOV_USER_MAGIC_V1:
switch (lmm->lmm_magic) {
case LOV_USER_MAGIC_V1:
lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lmm);
break;
default:
lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lmm);
break;
default:
- GOTO(free_lmm, rc = -EINVAL);
+ rc = -EINVAL;
+ goto free_lmm;
}
rc = obd_unpackmd(sbi->ll_dt_exp, &lsm, lmm, lmmsize);
}
rc = obd_unpackmd(sbi->ll_dt_exp, &lsm, lmm, lmmsize);
- if (rc < 0)
- GOTO(free_lmm, rc = -ENOMEM);
+ if (rc < 0) {
+ rc = -ENOMEM;
+ goto free_lmm;
+ }
/* Perform glimpse_size operation. */
memset(&st, 0, sizeof(st));
rc = ll_glimpse_ioctl(sbi, lsm, &st);
if (rc)
/* Perform glimpse_size operation. */
memset(&st, 0, sizeof(st));
rc = ll_glimpse_ioctl(sbi, lsm, &st);
if (rc)
- if (copy_to_user(&lumd->lmd_st, &st, sizeof(st)))
- GOTO(free_lsm, rc = -EFAULT);
+ if (copy_to_user(&lumd->lmd_st, &st, sizeof(st))) {
+ rc = -EFAULT;
+ goto free_lsm;
+ }
free_lsm:
obd_free_memmd(sbi->ll_dt_exp, &lsm);
free_lsm:
obd_free_memmd(sbi->ll_dt_exp, &lsm);
if (copy_to_user((void *)arg, check,
sizeof(*check)))
CDEBUG(D_QUOTA, "copy_to_user failed\n");
if (copy_to_user((void *)arg, check,
sizeof(*check)))
CDEBUG(D_QUOTA, "copy_to_user failed\n");
}
rc = obd_iocontrol(cmd, sbi->ll_dt_exp, 0, (void *)check,
}
rc = obd_iocontrol(cmd, sbi->ll_dt_exp, 0, (void *)check,
if (copy_to_user((void *)arg, check,
sizeof(*check)))
CDEBUG(D_QUOTA, "copy_to_user failed\n");
if (copy_to_user((void *)arg, check,
sizeof(*check)))
CDEBUG(D_QUOTA, "copy_to_user failed\n");
}
out_poll:
OBD_FREE_PTR(check);
}
out_poll:
OBD_FREE_PTR(check);
return -ENOMEM;
OBD_ALLOC_PTR(qctl_20);
return -ENOMEM;
OBD_ALLOC_PTR(qctl_20);
- if (!qctl_20)
- GOTO(out_quotactl_18, rc = -ENOMEM);
+ if (!qctl_20) {
+ rc = -ENOMEM;
+ goto out_quotactl_18;
+ }
- if (copy_from_user(qctl_18, (void *)arg, sizeof(*qctl_18)))
- GOTO(out_quotactl_20, rc = -ENOMEM);
+ if (copy_from_user(qctl_18, (void *)arg, sizeof(*qctl_18))) {
+ rc = -ENOMEM;
+ goto out_quotactl_20;
+ }
QCTL_COPY(qctl_20, qctl_18);
qctl_20->qc_idx = 0;
QCTL_COPY(qctl_20, qctl_18);
qctl_20->qc_idx = 0;
if (!qctl)
return -ENOMEM;
if (!qctl)
return -ENOMEM;
- if (copy_from_user(qctl, (void *)arg, sizeof(*qctl)))
- GOTO(out_quotactl, rc = -EFAULT);
+ if (copy_from_user(qctl, (void *)arg, sizeof(*qctl))) {
+ rc = -EFAULT;
+ goto out_quotactl;
+ }
rc = quotactl_ioctl(sbi, qctl);
rc = quotactl_ioctl(sbi, qctl);
break;
case SEEK_END:
if (offset > 0)
break;
case SEEK_END:
if (offset > 0)
if (api32)
offset += LL_DIR_END_OFF_32BIT;
else
offset += LL_DIR_END_OFF;
break;
default:
if (api32)
offset += LL_DIR_END_OFF_32BIT;
else
offset += LL_DIR_END_OFF;
break;
default:
out:
mutex_unlock(&inode->i_mutex);
out:
mutex_unlock(&inode->i_mutex);
*/
CERROR("Invalid MDC connection handle %#llx\n",
ll_i2mdexp(inode)->exp_handle.h_cookie);
*/
CERROR("Invalid MDC connection handle %#llx\n",
ll_i2mdexp(inode)->exp_handle.h_cookie);
}
OBD_ALLOC_PTR(op_data);
}
OBD_ALLOC_PTR(op_data);
- if (op_data == NULL)
- GOTO(out, rc = -ENOMEM); // XXX We leak openhandle and request here.
+ if (op_data == NULL) {
+ /* XXX We leak openhandle and request here. */
+ rc = -ENOMEM;
+ goto out;
+ }
ll_prepare_close(inode, op_data, och);
if (data_version != NULL) {
ll_prepare_close(inode, op_data, och);
if (data_version != NULL) {
if (fd->fd_och != NULL) {
rc = ll_close_inode_openhandle(md_exp, inode, fd->fd_och, NULL);
fd->fd_och = NULL;
if (fd->fd_och != NULL) {
rc = ll_close_inode_openhandle(md_exp, inode, fd->fd_och, NULL);
fd->fd_och = NULL;
}
/* Let's see if we have good enough OPEN lock on the file and if
}
/* Let's see if we have good enough OPEN lock on the file and if
*/
if (!it_disposition(itp, DISP_OPEN_OPEN) ||
it_open_error(DISP_OPEN_OPEN, itp))
*/
if (!it_disposition(itp, DISP_OPEN_OPEN) ||
it_open_error(DISP_OPEN_OPEN, itp))
ll_release_openhandle(file->f_dentry, itp);
ll_release_openhandle(file->f_dentry, itp);
- if (it_disposition(itp, DISP_LOOKUP_NEG))
- GOTO(out, rc = -ENOENT);
+ if (it_disposition(itp, DISP_LOOKUP_NEG)) {
+ rc = -ENOENT;
+ goto out;
+ }
if (rc != 0 || it_open_error(DISP_OPEN_OPEN, itp)) {
rc = rc ? rc : it_open_error(DISP_OPEN_OPEN, itp);
CDEBUG(D_VFSTRACE, "lock enqueue: err: %d\n", rc);
if (rc != 0 || it_open_error(DISP_OPEN_OPEN, itp)) {
rc = rc ? rc : it_open_error(DISP_OPEN_OPEN, itp);
CDEBUG(D_VFSTRACE, "lock enqueue: err: %d\n", rc);
}
rc = ll_prep_inode(&file->f_dentry->d_inode, req, NULL, itp);
}
rc = ll_prep_inode(&file->f_dentry->d_inode, req, NULL, itp);
file->private_data = NULL; /* prevent ll_local_open assertion */
fd = ll_file_data_get();
file->private_data = NULL; /* prevent ll_local_open assertion */
fd = ll_file_data_get();
- if (fd == NULL)
- GOTO(out_openerr, rc = -ENOMEM);
+ if (fd == NULL) {
+ rc = -ENOMEM;
+ goto out_openerr;
+ }
fd->fd_file = file;
if (S_ISDIR(inode->i_mode)) {
fd->fd_file = file;
if (S_ISDIR(inode->i_mode)) {
rc = it_open_error(DISP_OPEN_OPEN, it);
if (rc) {
mutex_unlock(&lli->lli_och_mutex);
rc = it_open_error(DISP_OPEN_OPEN, it);
if (rc) {
mutex_unlock(&lli->lli_och_mutex);
}
ll_release_openhandle(file->f_dentry, it);
}
ll_release_openhandle(file->f_dentry, it);
if (rc) {
(*och_usecount)--;
mutex_unlock(&lli->lli_och_mutex);
if (rc) {
(*och_usecount)--;
mutex_unlock(&lli->lli_och_mutex);
}
} else {
LASSERT(*och_usecount == 0);
}
} else {
LASSERT(*och_usecount == 0);
rc = ll_intent_file_open(file, NULL, 0, it);
it->it_create_mode &= ~M_CHECK_STALE;
if (rc)
rc = ll_intent_file_open(file, NULL, 0, it);
it->it_create_mode &= ~M_CHECK_STALE;
if (rc)
goto restart;
}
OBD_ALLOC(*och_p, sizeof (struct obd_client_handle));
goto restart;
}
OBD_ALLOC(*och_p, sizeof (struct obd_client_handle));
- if (!*och_p)
- GOTO(out_och_free, rc = -ENOMEM);
+ if (!*och_p) {
+ rc = -ENOMEM;
+ goto out_och_free;
+ }
* just open error? */
rc = it_open_error(DISP_OPEN_OPEN, it);
if (rc)
* just open error? */
rc = it_open_error(DISP_OPEN_OPEN, it);
if (rc)
- GOTO(out_och_free, rc);
LASSERT(it_disposition(it, DISP_ENQ_OPEN_REF));
rc = ll_local_open(file, it, fd, *och_p);
if (rc)
LASSERT(it_disposition(it, DISP_ENQ_OPEN_REF));
rc = ll_local_open(file, it, fd, *och_p);
if (rc)
- GOTO(out_och_free, rc);
}
mutex_unlock(&lli->lli_och_mutex);
fd = NULL;
}
mutex_unlock(&lli->lli_och_mutex);
fd = NULL;
different kind of OPEN lock for this same inode gets cancelled
by ldlm_cancel_lru */
if (!S_ISREG(inode->i_mode))
different kind of OPEN lock for this same inode gets cancelled
by ldlm_cancel_lru */
if (!S_ISREG(inode->i_mode))
- GOTO(out_och_free, rc);
(cl_is_lov_delay_create(file->f_flags) ||
(file->f_mode & FMODE_WRITE) == 0)) {
CDEBUG(D_INODE, "object creation was delayed\n");
(cl_is_lov_delay_create(file->f_flags) ||
(file->f_mode & FMODE_WRITE) == 0)) {
CDEBUG(D_INODE, "object creation was delayed\n");
- GOTO(out_och_free, rc);
}
cl_lov_delay_create_clear(&file->f_flags);
}
cl_lov_delay_create_clear(&file->f_flags);
- GOTO(out_och_free, rc);
op_data = ll_prep_md_op_data(NULL, inode, inode, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
op_data = ll_prep_md_op_data(NULL, inode, inode, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
- if (IS_ERR(op_data))
- GOTO(out, rc = PTR_ERR(op_data));
+ if (IS_ERR(op_data)) {
+ rc = PTR_ERR(op_data);
+ goto out;
+ }
/* To tell the MDT this openhandle is from the same owner */
op_data->op_handle = old_handle;
/* To tell the MDT this openhandle is from the same owner */
op_data->op_handle = old_handle;
ll_finish_md_op_data(op_data);
ptlrpc_req_finished(req);
if (rc < 0)
ll_finish_md_op_data(op_data);
ptlrpc_req_finished(req);
if (rc < 0)
- GOTO(out_release_it, rc);
- if (it_disposition(&it, DISP_LOOKUP_NEG))
- GOTO(out_release_it, rc = -ENOENT);
+ if (it_disposition(&it, DISP_LOOKUP_NEG)) {
+ rc = -ENOENT;
+ goto out_release_it;
+ }
rc = it_open_error(DISP_OPEN_OPEN, &it);
if (rc)
rc = it_open_error(DISP_OPEN_OPEN, &it);
if (rc)
- GOTO(out_release_it, rc);
LASSERT(it_disposition(&it, DISP_ENQ_OPEN_REF));
ll_och_fill(sbi->ll_md_exp, &it, och);
LASSERT(it_disposition(&it, DISP_ENQ_OPEN_REF));
ll_och_fill(sbi->ll_md_exp, &it, och);
- if (!it_disposition(&it, DISP_OPEN_LEASE)) /* old server? */
- GOTO(out_close, rc = -EOPNOTSUPP);
+ if (!it_disposition(&it, DISP_OPEN_LEASE)) /* old server? */ {
+ rc = -EOPNOTSUPP;
+ goto out_close;
+ }
/* already get lease, handle lease lock */
ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL);
/* already get lease, handle lease lock */
ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL);
CERROR(DFID "lease granted but no open lock, %d/%llu.\n",
PFID(ll_inode2fid(inode)), it.d.lustre.it_lock_mode,
it.d.lustre.it_lock_bits);
CERROR(DFID "lease granted but no open lock, %d/%llu.\n",
PFID(ll_inode2fid(inode)), it.d.lustre.it_lock_mode,
it.d.lustre.it_lock_bits);
- GOTO(out_close, rc = -EPROTO);
+ rc = -EPROTO;
+ goto out_close;
}
ll_intent_release(&it);
}
ll_intent_release(&it);
if ((iot == CIT_WRITE) &&
!(cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
if (mutex_lock_interruptible(&lli->
if ((iot == CIT_WRITE) &&
!(cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
if (mutex_lock_interruptible(&lli->
- lli_write_mutex))
- GOTO(out, result = -ERESTARTSYS);
+ lli_write_mutex)) {
+ result = -ERESTARTSYS;
+ goto out;
+ }
write_mutex_locked = 1;
} else if (iot == CIT_READ) {
down_read(&lli->lli_trunc_sem);
write_mutex_locked = 1;
} else if (iot == CIT_READ) {
down_read(&lli->lli_trunc_sem);
result = io->ci_nob;
*ppos = io->u.ci_wr.wr.crw_pos;
}
result = io->ci_nob;
*ppos = io->u.ci_wr.wr.crw_pos;
}
out:
cl_io_fini(env, io);
/* If any bit been read/written (result != 0), we just return
out:
cl_io_fini(env, io);
/* If any bit been read/written (result != 0), we just return
return -ENOMEM;
lsm = ccc_inode_lsm_get(inode);
return -ENOMEM;
lsm = ccc_inode_lsm_get(inode);
- if (!lsm_has_objects(lsm))
- GOTO(out, rc = -ENOENT);
+ if (!lsm_has_objects(lsm)) {
+ rc = -ENOENT;
+ goto out;
+ }
lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) *
(lsm->lsm_stripe_count));
OBD_ALLOC_LARGE(lsm2, lsm_size);
lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) *
(lsm->lsm_stripe_count));
OBD_ALLOC_LARGE(lsm2, lsm_size);
- if (lsm2 == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (lsm2 == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
oa->o_oi = *oi;
oa->o_nlink = ost_idx;
oa->o_oi = *oi;
oa->o_nlink = ost_idx;
ll_inode_size_unlock(inode);
OBD_FREE_LARGE(lsm2, lsm_size);
ll_inode_size_unlock(inode);
OBD_FREE_LARGE(lsm2, lsm_size);
out:
ccc_inode_lsm_put(inode, lsm);
OBDO_FREE(oa);
out:
ccc_inode_lsm_put(inode, lsm);
OBDO_FREE(oa);
ccc_inode_lsm_put(inode, lsm);
CDEBUG(D_IOCTL, "stripe already exists for ino %lu\n",
inode->i_ino);
ccc_inode_lsm_put(inode, lsm);
CDEBUG(D_IOCTL, "stripe already exists for ino %lu\n",
inode->i_ino);
- GOTO(out, rc = -EEXIST);
+ rc = -EEXIST;
+ goto out;
}
ll_inode_size_lock(inode);
rc = ll_intent_file_open(file, lum, lum_size, &oit);
if (rc)
}
ll_inode_size_lock(inode);
rc = ll_intent_file_open(file, lum, lum_size, &oit);
if (rc)
rc = oit.d.lustre.it_status;
if (rc < 0)
rc = oit.d.lustre.it_status;
if (rc < 0)
- GOTO(out_req_free, rc);
ll_release_openhandle(file->f_dentry, &oit);
ll_release_openhandle(file->f_dentry, &oit);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name failed "
"on %s: rc %d\n", filename, rc);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name failed "
"on %s: rc %d\n", filename, rc);
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (!(body->valid & (OBD_MD_FLEASIZE | OBD_MD_FLDIREA)) ||
lmmsize == 0) {
if (!(body->valid & (OBD_MD_FLEASIZE | OBD_MD_FLDIREA)) ||
lmmsize == 0) {
- GOTO(out, rc = -ENODATA);
+ rc = -ENODATA;
+ goto out;
}
lmm = req_capsule_server_sized_get(&req->rq_pill, &RMF_MDT_MD, lmmsize);
}
lmm = req_capsule_server_sized_get(&req->rq_pill, &RMF_MDT_MD, lmmsize);
if ((lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V1)) &&
(lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V3))) {
if ((lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V1)) &&
(lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V3))) {
- GOTO(out, rc = -EPROTO);
+ rc = -EPROTO;
+ goto out;
LASSERT(it_open_error(DISP_OPEN_OPEN, it) == 0);
OBD_ALLOC(och, sizeof(*och));
LASSERT(it_open_error(DISP_OPEN_OPEN, it) == 0);
OBD_ALLOC(och, sizeof(*och));
- if (!och)
- GOTO(out, rc = -ENOMEM);
+ if (!och) {
+ rc = -ENOMEM;
+ goto out;
+ }
ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och);
ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och);
* DEVICE_ORDER flag, then it cannot interpret the extents correctly.
*/
if (lsm->lsm_stripe_count > 1 &&
* DEVICE_ORDER flag, then it cannot interpret the extents correctly.
*/
if (lsm->lsm_stripe_count > 1 &&
- !(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER))
- GOTO(out, rc = -EOPNOTSUPP);
+ !(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) {
+ rc = -EOPNOTSUPP;
+ goto out;
+ }
fm_key.oa.o_oi = lsm->lsm_oi;
fm_key.oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
fm_key.oa.o_oi = lsm->lsm_oi;
fm_key.oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
/* If filesize is 0, then there would be no objects for mapping */
if (fm_key.oa.o_size == 0) {
fiemap->fm_mapped_extents = 0;
/* If filesize is 0, then there would be no objects for mapping */
if (fm_key.oa.o_size == 0) {
fiemap->fm_mapped_extents = 0;
}
memcpy(&fm_key.fiemap, fiemap, sizeof(*fiemap));
}
memcpy(&fm_key.fiemap, fiemap, sizeof(*fiemap));
if (gfout == NULL)
return -ENOMEM;
if (gfout == NULL)
return -ENOMEM;
- if (copy_from_user(gfout, arg, sizeof(*gfout)))
- GOTO(gf_free, rc = -EFAULT);
+ if (copy_from_user(gfout, arg, sizeof(*gfout))) {
+ rc = -EFAULT;
+ goto gf_free;
+ }
/* Call mdc_iocontrol */
rc = obd_iocontrol(OBD_IOC_FID2PATH, exp, outsize, gfout, NULL);
if (rc != 0)
/* Call mdc_iocontrol */
rc = obd_iocontrol(OBD_IOC_FID2PATH, exp, outsize, gfout, NULL);
if (rc != 0)
if (copy_to_user(arg, gfout, outsize))
rc = -EFAULT;
if (copy_to_user(arg, gfout, outsize))
rc = -EFAULT;
/* get the fiemap value */
if (copy_from_user(fiemap_s, (struct ll_user_fiemap __user *)arg,
/* get the fiemap value */
if (copy_from_user(fiemap_s, (struct ll_user_fiemap __user *)arg,
- sizeof(*fiemap_s)))
- GOTO(error, rc = -EFAULT);
+ sizeof(*fiemap_s))) {
+ rc = -EFAULT;
+ goto error;
+ }
/* If fm_extent_count is non-zero, read the first extent since
* it is used to calculate end_offset and device from previous
/* If fm_extent_count is non-zero, read the first extent since
* it is used to calculate end_offset and device from previous
if (extent_count) {
if (copy_from_user(&fiemap_s->fm_extents[0],
(char __user *)arg + sizeof(*fiemap_s),
if (extent_count) {
if (copy_from_user(&fiemap_s->fm_extents[0],
(char __user *)arg + sizeof(*fiemap_s),
- sizeof(struct ll_fiemap_extent)))
- GOTO(error, rc = -EFAULT);
+ sizeof(struct ll_fiemap_extent))) {
+ rc = -EFAULT;
+ goto error;
+ }
}
rc = ll_do_fiemap(inode, fiemap_s, num_bytes);
if (rc)
}
rc = ll_do_fiemap(inode, fiemap_s, num_bytes);
if (rc)
ret_bytes = sizeof(struct ll_user_fiemap);
ret_bytes = sizeof(struct ll_user_fiemap);
if (!lsm_has_objects(lsm)) {
*data_version = 0;
CDEBUG(D_INODE, "No object for inode\n");
if (!lsm_has_objects(lsm)) {
*data_version = 0;
CDEBUG(D_INODE, "No object for inode\n");
- if (obdo == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (obdo == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, obdo, 0, extent_lock);
if (rc == 0) {
rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, obdo, 0, extent_lock);
if (rc == 0) {
PFID(&ll_i2info(inode)->lli_fid));
och = ll_lease_open(inode, NULL, FMODE_WRITE, MDS_OPEN_RELEASE);
PFID(&ll_i2info(inode)->lli_fid));
och = ll_lease_open(inode, NULL, FMODE_WRITE, MDS_OPEN_RELEASE);
- if (IS_ERR(och))
- GOTO(out, rc = PTR_ERR(och));
+ if (IS_ERR(och)) {
+ rc = PTR_ERR(och);
+ goto out;
+ }
/* Grab latest data_version and [am]time values */
rc = ll_data_version(inode, &data_version, 1);
if (rc != 0)
/* Grab latest data_version and [am]time values */
rc = ll_data_version(inode, &data_version, 1);
if (rc != 0)
env = cl_env_nested_get(&nest);
env = cl_env_nested_get(&nest);
- if (IS_ERR(env))
- GOTO(out, rc = PTR_ERR(env));
+ if (IS_ERR(env)) {
+ rc = PTR_ERR(env);
+ goto out;
+ }
ll_merge_lvb(env, inode);
cl_env_nested_put(&nest, env);
ll_merge_lvb(env, inode);
cl_env_nested_put(&nest, env);
llss->inode1 = file1->f_dentry->d_inode;
llss->inode2 = file2->f_dentry->d_inode;
llss->inode1 = file1->f_dentry->d_inode;
llss->inode2 = file2->f_dentry->d_inode;
- if (!S_ISREG(llss->inode2->i_mode))
- GOTO(free, rc = -EINVAL);
+ if (!S_ISREG(llss->inode2->i_mode)) {
+ rc = -EINVAL;
+ goto free;
+ }
if (inode_permission(llss->inode1, MAY_WRITE) ||
if (inode_permission(llss->inode1, MAY_WRITE) ||
- inode_permission(llss->inode2, MAY_WRITE))
- GOTO(free, rc = -EPERM);
+ inode_permission(llss->inode2, MAY_WRITE)) {
+ rc = -EPERM;
+ goto free;
+ }
- if (llss->inode2->i_sb != llss->inode1->i_sb)
- GOTO(free, rc = -EXDEV);
+ if (llss->inode2->i_sb != llss->inode1->i_sb) {
+ rc = -EXDEV;
+ goto free;
+ }
/* we use 2 bool because it is easier to swap than 2 bits */
if (lsl->sl_flags & SWAP_LAYOUTS_CHECK_DV1)
/* we use 2 bool because it is easier to swap than 2 bits */
if (lsl->sl_flags & SWAP_LAYOUTS_CHECK_DV1)
llss->dv2 = lsl->sl_dv2;
rc = lu_fid_cmp(ll_inode2fid(llss->inode1), ll_inode2fid(llss->inode2));
llss->dv2 = lsl->sl_dv2;
rc = lu_fid_cmp(ll_inode2fid(llss->inode1), ll_inode2fid(llss->inode2));
- if (rc == 0) /* same file, done! */
- GOTO(free, rc = 0);
+ if (rc == 0) /* same file, done! */ {
+ rc = 0;
+ goto free;
+ }
if (rc < 0) { /* sequentialize it */
swap(llss->inode1, llss->inode2);
if (rc < 0) { /* sequentialize it */
swap(llss->inode1, llss->inode2);
if (gid != 0) { /* application asks to flush dirty cache */
rc = ll_get_grouplock(llss->inode1, file1, gid);
if (rc < 0)
if (gid != 0) { /* application asks to flush dirty cache */
rc = ll_get_grouplock(llss->inode1, file1, gid);
if (rc < 0)
rc = ll_get_grouplock(llss->inode2, file2, gid);
if (rc < 0) {
ll_put_grouplock(llss->inode1, file1, gid);
rc = ll_get_grouplock(llss->inode2, file2, gid);
if (rc < 0) {
ll_put_grouplock(llss->inode1, file1, gid);
if (llss->check_dv1) {
rc = ll_data_version(llss->inode1, &dv, 0);
if (rc)
if (llss->check_dv1) {
rc = ll_data_version(llss->inode1, &dv, 0);
if (rc)
- GOTO(putgl, rc);
- if (dv != llss->dv1)
- GOTO(putgl, rc = -EAGAIN);
+ goto putgl;
+ if (dv != llss->dv1) {
+ rc = -EAGAIN;
+ goto putgl;
+ }
}
if (llss->check_dv2) {
rc = ll_data_version(llss->inode2, &dv, 0);
if (rc)
}
if (llss->check_dv2) {
rc = ll_data_version(llss->inode2, &dv, 0);
if (rc)
- GOTO(putgl, rc);
- if (dv != llss->dv2)
- GOTO(putgl, rc = -EAGAIN);
+ goto putgl;
+ if (dv != llss->dv2) {
+ rc = -EAGAIN;
+ goto putgl;
+ }
}
/* struct md_op_data is used to send the swap args to the mdt
}
/* struct md_op_data is used to send the swap args to the mdt
rc = -ENOMEM;
op_data = ll_prep_md_op_data(NULL, llss->inode1, llss->inode2, NULL, 0,
0, LUSTRE_OPC_ANY, &msl);
rc = -ENOMEM;
op_data = ll_prep_md_op_data(NULL, llss->inode1, llss->inode2, NULL, 0,
0, LUSTRE_OPC_ANY, &msl);
- if (IS_ERR(op_data))
- GOTO(free, rc = PTR_ERR(op_data));
+ if (IS_ERR(op_data)) {
+ rc = PTR_ERR(op_data);
+ goto free;
+ }
rc = obd_iocontrol(LL_IOC_LOV_SWAP_LAYOUTS, ll_i2mdexp(llss->inode1),
sizeof(*op_data), op_data, NULL);
rc = obd_iocontrol(LL_IOC_LOV_SWAP_LAYOUTS, ll_i2mdexp(llss->inode1),
sizeof(*op_data), op_data, NULL);
/* rc can be set from obd_iocontrol() or from a GOTO(putgl, ...) */
if (rc != 0)
/* rc can be set from obd_iocontrol() or from a GOTO(putgl, ...) */
if (rc != 0)
/* clear useless flags */
if (!(lsl->sl_flags & SWAP_LAYOUTS_KEEP_MTIME)) {
/* clear useless flags */
if (!(lsl->sl_flags & SWAP_LAYOUTS_KEEP_MTIME)) {
/* set HSM flags */
OBD_ALLOC_PTR(hss);
/* set HSM flags */
OBD_ALLOC_PTR(hss);
- if (hss == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (hss == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
hss->hss_valid = HSS_SETMASK | HSS_ARCHIVE_ID;
hss->hss_archive_id = hui->hui_archive_id;
hss->hss_setmask = HS_ARCHIVED | HS_EXISTS | HS_RELEASED;
rc = ll_hsm_state_set(inode, hss);
if (rc != 0)
hss->hss_valid = HSS_SETMASK | HSS_ARCHIVE_ID;
hss->hss_archive_id = hui->hui_archive_id;
hss->hss_setmask = HS_ARCHIVED | HS_EXISTS | HS_RELEASED;
rc = ll_hsm_state_set(inode, hss);
if (rc != 0)
- if (attr == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (attr == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
attr->ia_mode = hui->hui_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
attr->ia_mode |= S_IFREG;
attr->ia_mode = hui->hui_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
attr->ia_mode |= S_IFREG;
oit.it_create_mode &= ~M_CHECK_STALE;
if (rc < 0) {
rc = ll_inode_revalidate_fini(inode, rc);
oit.it_create_mode &= ~M_CHECK_STALE;
if (rc < 0) {
rc = ll_inode_revalidate_fini(inode, rc);
}
rc = ll_revalidate_it_finish(req, &oit, dentry);
if (rc != 0) {
ll_intent_release(&oit);
}
rc = ll_revalidate_it_finish(req, &oit, dentry);
if (rc != 0) {
ll_intent_release(&oit);
}
/* Unlinked? Unhash dentry, so it is not picked up later by
}
/* Unlinked? Unhash dentry, so it is not picked up later by
return rc;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
return rc;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
- if (body == NULL)
- GOTO(out, rc = -EPROTO);
+ if (body == NULL) {
+ rc = -EPROTO;
+ goto out;
+ }
lmmsize = body->eadatasize;
lmmsize = body->eadatasize;
- if (lmmsize == 0) /* empty layout */
- GOTO(out, rc = 0);
+ if (lmmsize == 0) /* empty layout */ {
+ rc = 0;
+ goto out;
+ }
lmm = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA, lmmsize);
lmm = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA, lmmsize);
- if (lmm == NULL)
- GOTO(out, rc = -EFAULT);
+ if (lmm == NULL) {
+ rc = -EFAULT;
+ goto out;
+ }
OBD_ALLOC_LARGE(lvbdata, lmmsize);
OBD_ALLOC_LARGE(lvbdata, lmmsize);
- if (lvbdata == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (lvbdata == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
memcpy(lvbdata, lmm, lmmsize);
lock_res_and_lock(lock);
memcpy(lvbdata, lmm, lmmsize);
lock_res_and_lock(lock);
*gen = ll_layout_version_get(lli);
rc = 0;
}
*gen = ll_layout_version_get(lli);
rc = 0;
}
}
rc = ll_layout_fetch(inode, lock);
if (rc < 0)
}
rc = ll_layout_fetch(inode, lock);
if (rc < 0)
/* for layout lock, lmm is returned in lock's lvb.
* lvb_data is immutable if the lock is held so it's safe to access it
/* for layout lock, lmm is returned in lock's lvb.
* lvb_data is immutable if the lock is held so it's safe to access it
/* set layout to file. Unlikely this will fail as old layout was
* surely eliminated */
/* set layout to file. Unlikely this will fail as old layout was
* surely eliminated */
"renewal failed: -EIO, "
"retry in 2 mins");
ll_capa_renewal_retries++;
"renewal failed: -EIO, "
"retry in 2 mins");
ll_capa_renewal_retries++;
} else {
DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
"renewal failed(rc: %d) for", rc);
} else {
DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
"renewal failed(rc: %d) for", rc);
inode = igrab(inode);
LASSERT(inode);
inode = igrab(inode);
LASSERT(inode);
}
if (flags & LLIF_DONE_WRITING) {
/* Some pages are still dirty, it is early to send
}
if (flags & LLIF_DONE_WRITING) {
/* Some pages are still dirty, it is early to send
inode = igrab(inode);
LASSERT(inode);
inode = igrab(inode);
LASSERT(inode);
}
}
CDEBUG(D_INODE, "Epoch %llu closed on "DFID"\n",
}
}
CDEBUG(D_INODE, "Epoch %llu closed on "DFID"\n",
/* Pack Size-on-MDS inode attributes only if they has changed */
if (!(lli->lli_flags & LLIF_SOM_DIRTY)) {
spin_unlock(&lli->lli_lock);
/* Pack Size-on-MDS inode attributes only if they has changed */
if (!(lli->lli_flags & LLIF_SOM_DIRTY)) {
spin_unlock(&lli->lli_lock);
}
/* There is a pending DONE_WRITE -- close epoch with no
* attribute change. */
if (lli->lli_flags & LLIF_EPOCH_PENDING) {
spin_unlock(&lli->lli_lock);
}
/* There is a pending DONE_WRITE -- close epoch with no
* attribute change. */
if (lli->lli_flags & LLIF_EPOCH_PENDING) {
spin_unlock(&lli->lli_lock);
ll_prepare_done_writing(inode, op_data, &och);
/* If there is no @och, we do not do D_W yet. */
if (och == NULL)
ll_prepare_done_writing(inode, op_data, &och);
/* If there is no @och, we do not do D_W yet. */
if (och == NULL)
rc = md_done_writing(ll_i2sbi(inode)->ll_md_exp, op_data, NULL);
if (rc == -EAGAIN) {
rc = md_done_writing(ll_i2sbi(inode)->ll_md_exp, op_data, NULL);
if (rc == -EAGAIN) {
"recovery, of which this client is not a "
"part. Please wait for recovery to complete,"
" abort, or time out.\n", md);
"recovery, of which this client is not a "
"part. Please wait for recovery to complete,"
" abort, or time out.\n", md);
} else if (err) {
CERROR("cannot connect to %s: rc = %d\n", md, err);
} else if (err) {
CERROR("cannot connect to %s: rc = %d\n", md, err);
}
sbi->ll_md_exp->exp_connect_data = *data;
}
sbi->ll_md_exp->exp_connect_data = *data;
if (err) {
CERROR("%s: Can't init metadata layer FID infrastructure, "
"rc = %d\n", sbi->ll_md_exp->exp_obd->obd_name, err);
if (err) {
CERROR("%s: Can't init metadata layer FID infrastructure, "
"rc = %d\n", sbi->ll_md_exp->exp_obd->obd_name, err);
}
/* For mount, we only need fs info from MDT0, and also in DNE, it
}
/* For mount, we only need fs info from MDT0, and also in DNE, it
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_FOR_MDT0);
if (err)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_FOR_MDT0);
if (err)
/* This needs to be after statfs to ensure connect has finished.
* Note that "data" does NOT contain the valid connect reply.
/* This needs to be after statfs to ensure connect has finished.
* Note that "data" does NOT contain the valid connect reply.
"server or downgrade client.\n",
sbi->ll_md_exp->exp_obd->obd_name, buf);
OBD_FREE(buf, PAGE_CACHE_SIZE);
"server or downgrade client.\n",
sbi->ll_md_exp->exp_obd->obd_name, buf);
OBD_FREE(buf, PAGE_CACHE_SIZE);
- GOTO(out_md_fid, err = -EPROTO);
+ err = -EPROTO;
+ goto out_md_fid;
if (err) {
CERROR("%s: Get connect data failed: rc = %d\n",
sbi->ll_md_exp->exp_obd->obd_name, err);
if (err) {
CERROR("%s: Get connect data failed: rc = %d\n",
sbi->ll_md_exp->exp_obd->obd_name, err);
}
LASSERT(osfs->os_bsize);
}
LASSERT(osfs->os_bsize);
obd = class_name2obd(dt);
if (!obd) {
CERROR("DT %s: not setup or attached\n", dt);
obd = class_name2obd(dt);
if (!obd) {
CERROR("DT %s: not setup or attached\n", dt);
- GOTO(out_md_fid, err = -ENODEV);
+ err = -ENODEV;
+ goto out_md_fid;
}
data->ocd_connect_flags = OBD_CONNECT_GRANT | OBD_CONNECT_VERSION |
}
data->ocd_connect_flags = OBD_CONNECT_GRANT | OBD_CONNECT_VERSION |
"recovery, of which this client is not a "
"part. Please wait for recovery to "
"complete, abort, or time out.\n", dt);
"recovery, of which this client is not a "
"part. Please wait for recovery to "
"complete, abort, or time out.\n", dt);
} else if (err) {
CERROR("%s: Cannot connect to %s: rc = %d\n",
sbi->ll_dt_exp->exp_obd->obd_name, dt, err);
} else if (err) {
CERROR("%s: Cannot connect to %s: rc = %d\n",
sbi->ll_dt_exp->exp_obd->obd_name, dt, err);
}
sbi->ll_dt_exp->exp_connect_data = *data;
}
sbi->ll_dt_exp->exp_connect_data = *data;
if (err) {
CERROR("%s: Can't init data layer FID infrastructure, "
"rc = %d\n", sbi->ll_dt_exp->exp_obd->obd_name, err);
if (err) {
CERROR("%s: Can't init data layer FID infrastructure, "
"rc = %d\n", sbi->ll_dt_exp->exp_obd->obd_name, err);
}
mutex_lock(&sbi->ll_lco.lco_lock);
}
mutex_lock(&sbi->ll_lco.lco_lock);
err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
if (err) {
CERROR("cannot mds_connect: rc = %d\n", err);
err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
if (err) {
CERROR("cannot mds_connect: rc = %d\n", err);
- GOTO(out_lock_cn_cb, err);
}
if (!fid_is_sane(&sbi->ll_root_fid)) {
CERROR("%s: Invalid root fid "DFID" during mount\n",
sbi->ll_md_exp->exp_obd->obd_name,
PFID(&sbi->ll_root_fid));
}
if (!fid_is_sane(&sbi->ll_root_fid)) {
CERROR("%s: Invalid root fid "DFID" during mount\n",
sbi->ll_md_exp->exp_obd->obd_name,
PFID(&sbi->ll_root_fid));
- GOTO(out_lock_cn_cb, err = -EINVAL);
+ err = -EINVAL;
+ goto out_lock_cn_cb;
}
CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
}
CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
valid |= OBD_MD_FLACL;
OBD_ALLOC_PTR(op_data);
valid |= OBD_MD_FLACL;
OBD_ALLOC_PTR(op_data);
- if (op_data == NULL)
- GOTO(out_lock_cn_cb, err = -ENOMEM);
+ if (op_data == NULL) {
+ err = -ENOMEM;
+ goto out_lock_cn_cb;
+ }
op_data->op_fid1 = sbi->ll_root_fid;
op_data->op_mode = 0;
op_data->op_fid1 = sbi->ll_root_fid;
op_data->op_mode = 0;
if (err) {
CERROR("%s: md_getattr failed for root: rc = %d\n",
sbi->ll_md_exp->exp_obd->obd_name, err);
if (err) {
CERROR("%s: md_getattr failed for root: rc = %d\n",
sbi->ll_md_exp->exp_obd->obd_name, err);
- GOTO(out_lock_cn_cb, err);
}
err = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
}
err = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
if (err) {
CERROR("failed to understand root inode md: rc = %d\n", err);
ptlrpc_req_finished(request);
if (err) {
CERROR("failed to understand root inode md: rc = %d\n", err);
ptlrpc_req_finished(request);
- GOTO(out_lock_cn_cb, err);
}
LASSERT(fid_is_sane(&sbi->ll_root_fid));
}
LASSERT(fid_is_sane(&sbi->ll_root_fid));
err = IS_ERR(root) ? PTR_ERR(root) : -EBADF;
root = NULL;
CERROR("lustre_lite: bad iget4 for root\n");
err = IS_ERR(root) ? PTR_ERR(root) : -EBADF;
root = NULL;
CERROR("lustre_lite: bad iget4 for root\n");
}
err = ll_close_thread_start(&sbi->ll_lcq);
if (err) {
CERROR("cannot start close thread: rc %d\n", err);
}
err = ll_close_thread_start(&sbi->ll_lcq);
if (err) {
CERROR("cannot start close thread: rc %d\n", err);
}
#ifdef CONFIG_FS_POSIX_ACL
}
#ifdef CONFIG_FS_POSIX_ACL
if (sb->s_root == NULL) {
CERROR("%s: can't make root dentry\n",
ll_get_fsname(sb, NULL, 0));
if (sb->s_root == NULL) {
CERROR("%s: can't make root dentry\n",
ll_get_fsname(sb, NULL, 0));
- GOTO(out_root, err = -ENOMEM);
+ err = -ENOMEM;
+ goto out_root;
}
sbi->ll_sdev_orig = sb->s_dev;
}
sbi->ll_sdev_orig = sb->s_dev;
err = ll_options(lsi->lsi_lmd->lmd_opts, &sbi->ll_flags);
if (err)
err = ll_options(lsi->lsi_lmd->lmd_opts, &sbi->ll_flags);
if (err)
err = bdi_init(&lsi->lsi_bdi);
if (err)
err = bdi_init(&lsi->lsi_bdi);
if (err)
lsi->lsi_flags |= LSI_BDI_INITIALIZED;
lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
err = ll_bdi_register(&lsi->lsi_bdi);
if (err)
lsi->lsi_flags |= LSI_BDI_INITIALIZED;
lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
err = ll_bdi_register(&lsi->lsi_bdi);
if (err)
sb->s_bdi = &lsi->lsi_bdi;
/* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
sb->s_bdi = &lsi->lsi_bdi;
/* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
err = lustre_process_log(sb, profilenm, cfg);
if (err < 0) {
CERROR("Unable to process log: %d\n", err);
err = lustre_process_log(sb, profilenm, cfg);
if (err < 0) {
CERROR("Unable to process log: %d\n", err);
}
/* Profile set with LCFG_MOUNTOPT so we can find our mdc and osc obds */
}
/* Profile set with LCFG_MOUNTOPT so we can find our mdc and osc obds */
LCONSOLE_ERROR_MSG(0x156, "The client profile '%s' could not be"
" read from the MGS. Does that filesystem "
"exist?\n", profilenm);
LCONSOLE_ERROR_MSG(0x156, "The client profile '%s' could not be"
" read from the MGS. Does that filesystem "
"exist?\n", profilenm);
- GOTO(out_free, err = -EINVAL);
+ err = -EINVAL;
+ goto out_free;
}
CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm,
lprof->lp_md, lprof->lp_dt);
OBD_ALLOC(dt, strlen(lprof->lp_dt) + instlen + 2);
}
CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm,
lprof->lp_md, lprof->lp_dt);
OBD_ALLOC(dt, strlen(lprof->lp_dt) + instlen + 2);
- if (!dt)
- GOTO(out_free, err = -ENOMEM);
+ if (!dt) {
+ err = -ENOMEM;
+ goto out_free;
+ }
sprintf(dt, "%s-%p", lprof->lp_dt, cfg->cfg_instance);
OBD_ALLOC(md, strlen(lprof->lp_md) + instlen + 2);
sprintf(dt, "%s-%p", lprof->lp_dt, cfg->cfg_instance);
OBD_ALLOC(md, strlen(lprof->lp_md) + instlen + 2);
- if (!md)
- GOTO(out_free, err = -ENOMEM);
+ if (!md) {
+ err = -ENOMEM;
+ goto out_free;
+ }
sprintf(md, "%s-%p", lprof->lp_md, cfg->cfg_instance);
/* connections, registrations, sb setup */
sprintf(md, "%s-%p", lprof->lp_md, cfg->cfg_instance);
/* connections, registrations, sb setup */
rc = ll_md_setattr(dentry, op_data, &mod);
if (rc)
rc = ll_md_setattr(dentry, op_data, &mod);
if (rc)
/* truncate failed (only when non HSM import), others succeed */
if (file_is_released) {
if ((attr->ia_valid & ATTR_SIZE) && !hsm_import)
/* truncate failed (only when non HSM import), others succeed */
if (file_is_released) {
if ((attr->ia_valid & ATTR_SIZE) && !hsm_import)
- GOTO(out, rc = -ENODATA);
}
/* RPC to MDT is sent, cancel data modification flag */
}
/* RPC to MDT is sent, cancel data modification flag */
}
ll_ioepoch_open(lli, op_data->op_ioepoch);
}
ll_ioepoch_open(lli, op_data->op_ioepoch);
- if (!S_ISREG(inode->i_mode))
- GOTO(out, rc = 0);
+ if (!S_ISREG(inode->i_mode)) {
+ rc = 0;
+ goto out;
+ }
if (attr->ia_valid & (ATTR_SIZE |
ATTR_ATIME | ATTR_ATIME_SET |
if (attr->ia_valid & (ATTR_SIZE |
ATTR_ATIME | ATTR_ATIME_SET |
rc = IS_ERR(*inode) ? PTR_ERR(*inode) : -ENOMEM;
*inode = NULL;
CERROR("new_inode -fatal: rc %d\n", rc);
rc = IS_ERR(*inode) ? PTR_ERR(*inode) : -ENOMEM;
*inode = NULL;
CERROR("new_inode -fatal: rc %d\n", rc);
__u32 flags;
int len = 0, rc;
__u32 flags;
int len = 0, rc;
- if (!inode || !(sbi = ll_i2sbi(inode)))
- GOTO(out_statfs, rc = -EINVAL);
+ if (!inode || !(sbi = ll_i2sbi(inode))) {
+ rc = -EINVAL;
+ goto out_statfs;
+ }
rc = obd_ioctl_getdata(&buf, &len, arg);
if (rc)
rc = obd_ioctl_getdata(&buf, &len, arg);
if (rc)
data = (void*)buf;
if (!data->ioc_inlbuf1 || !data->ioc_inlbuf2 ||
data = (void*)buf;
if (!data->ioc_inlbuf1 || !data->ioc_inlbuf2 ||
- !data->ioc_pbuf1 || !data->ioc_pbuf2)
- GOTO(out_statfs, rc = -EINVAL);
+ !data->ioc_pbuf1 || !data->ioc_pbuf2) {
+ rc = -EINVAL;
+ goto out_statfs;
+ }
if (data->ioc_inllen1 != sizeof(__u32) ||
data->ioc_inllen2 != sizeof(__u32) ||
data->ioc_plen1 != sizeof(struct obd_statfs) ||
if (data->ioc_inllen1 != sizeof(__u32) ||
data->ioc_inllen2 != sizeof(__u32) ||
data->ioc_plen1 != sizeof(struct obd_statfs) ||
- data->ioc_plen2 != sizeof(struct obd_uuid))
- GOTO(out_statfs, rc = -EINVAL);
+ data->ioc_plen2 != sizeof(struct obd_uuid)) {
+ rc = -EINVAL;
+ goto out_statfs;
+ }
memcpy(&type, data->ioc_inlbuf1, sizeof(__u32));
if (type & LL_STATFS_LMV)
exp = sbi->ll_md_exp;
else if (type & LL_STATFS_LOV)
exp = sbi->ll_dt_exp;
memcpy(&type, data->ioc_inlbuf1, sizeof(__u32));
if (type & LL_STATFS_LMV)
exp = sbi->ll_md_exp;
else if (type & LL_STATFS_LOV)
exp = sbi->ll_dt_exp;
- else
- GOTO(out_statfs, rc = -ENODEV);
+ else {
+ rc = -ENODEV;
+ goto out_statfs;
+ }
flags = (type & LL_STATFS_NODELAY) ? OBD_STATFS_NODELAY : 0;
rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, &flags);
if (rc)
flags = (type & LL_STATFS_NODELAY) ? OBD_STATFS_NODELAY : 0;
rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, &flags);
if (rc)
out_statfs:
if (buf)
obd_ioctl_freedata(buf, len);
out_statfs:
if (buf)
obd_ioctl_freedata(buf, len);
LASSERT(vmpage != NULL);
io = ll_fault_io_init(vma, &env, &nest, vmpage->index, NULL);
LASSERT(vmpage != NULL);
io = ll_fault_io_init(vma, &env, &nest, vmpage->index, NULL);
- if (IS_ERR(io))
- GOTO(out, result = PTR_ERR(io));
+ if (IS_ERR(io)) {
+ result = PTR_ERR(io);
+ goto out;
+ }
result = io->ci_result;
if (result < 0)
result = io->ci_result;
if (result < 0)
io->u.ci_fault.ft_mkwrite = 1;
io->u.ci_fault.ft_writable = 1;
io->u.ci_fault.ft_mkwrite = 1;
io->u.ci_fault.ft_writable = 1;
.ctx.actor = ll_nfs_get_name_filldir,
};
.ctx.actor = ll_nfs_get_name_filldir,
};
- if (!dir || !S_ISDIR(dir->i_mode))
- GOTO(out, rc = -ENOTDIR);
+ if (!dir || !S_ISDIR(dir->i_mode)) {
+ rc = -ENOTDIR;
+ goto out;
+ }
- if (!dir->i_fop)
- GOTO(out, rc = -EINVAL);
+ if (!dir->i_fop) {
+ rc = -EINVAL;
+ goto out;
+ }
mutex_lock(&dir->i_mutex);
rc = ll_dir_read(dir, &lgd.ctx);
mutex_lock(&dir->i_mutex);
rc = ll_dir_read(dir, &lgd.ctx);
lo->lo_state = LLOOP_BOUND;
env = cl_env_get(&refcheck);
lo->lo_state = LLOOP_BOUND;
env = cl_env_get(&refcheck);
- if (IS_ERR(env))
- GOTO(out, ret = PTR_ERR(env));
+ if (IS_ERR(env)) {
+ ret = PTR_ERR(env);
+ goto out;
+ }
lo->lo_env = env;
memset(&lo->lo_pvec, 0, sizeof(lo->lo_pvec));
lo->lo_env = env;
memset(&lo->lo_pvec, 0, sizeof(lo->lo_pvec));
if (magic != ll_iocontrol_magic)
return LLIOC_CONT;
if (magic != ll_iocontrol_magic)
return LLIOC_CONT;
- if (disks == NULL)
- GOTO(out1, err = -ENODEV);
+ if (disks == NULL) {
+ err = -ENODEV;
+ goto out1;
+ }
CWARN("Enter llop_ioctl\n");
CWARN("Enter llop_ioctl\n");
file->f_dentry->d_inode)
break;
}
file->f_dentry->d_inode)
break;
}
- if (lo || !lo_free)
- GOTO(out, err = -EBUSY);
+ if (lo || !lo_free) {
+ err = -EBUSY;
+ goto out;
+ }
lo = lo_free;
dev = MKDEV(lloop_major, lo->lo_number);
/* quit if the used pointer is writable */
lo = lo_free;
dev = MKDEV(lloop_major, lo->lo_number);
/* quit if the used pointer is writable */
- if (put_user((long)old_encode_dev(dev), (long*)arg))
- GOTO(out, err = -EFAULT);
+ if (put_user((long)old_encode_dev(dev), (long*)arg)) {
+ err = -EFAULT;
+ goto out;
+ }
bdev = blkdev_get_by_dev(dev, file->f_mode, NULL);
bdev = blkdev_get_by_dev(dev, file->f_mode, NULL);
- if (IS_ERR(bdev))
- GOTO(out, err = PTR_ERR(bdev));
+ if (IS_ERR(bdev)) {
+ err = PTR_ERR(bdev);
+ goto out;
+ }
get_file(file);
err = loop_set_fd(lo, NULL, bdev, file);
get_file(file);
err = loop_set_fd(lo, NULL, bdev, file);
int minor;
dev = old_decode_dev(arg);
int minor;
dev = old_decode_dev(arg);
- if (MAJOR(dev) != lloop_major)
- GOTO(out, err = -EINVAL);
+ if (MAJOR(dev) != lloop_major) {
+ err = -EINVAL;
+ goto out;
+ }
- if (minor > max_loop - 1)
- GOTO(out, err = -EINVAL);
+ if (minor > max_loop - 1) {
+ err = -EINVAL;
+ goto out;
+ }
- if (lo->lo_state != LLOOP_BOUND)
- GOTO(out, err = -EINVAL);
+ if (lo->lo_state != LLOOP_BOUND) {
+ err = -EINVAL;
+ goto out;
+ }
bdev = lo->lo_device;
err = loop_clr_fd(lo, bdev, 1);
bdev = lo->lo_device;
err = loop_clr_fd(lo, bdev, 1);
/* easy - add more LRU slots. */
if (diff >= 0) {
atomic_add(diff, &cache->ccc_lru_left);
/* easy - add more LRU slots. */
if (diff >= 0) {
atomic_add(diff, &cache->ccc_lru_left);
/* File operations stats */
sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
LPROCFS_STATS_FLAG_NONE);
/* File operations stats */
sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
LPROCFS_STATS_FLAG_NONE);
- if (sbi->ll_stats == NULL)
- GOTO(out, err = -ENOMEM);
+ if (sbi->ll_stats == NULL) {
+ err = -ENOMEM;
+ goto out;
+ }
/* do counter init */
for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) {
__u32 type = llite_opcode_table[id].type;
/* do counter init */
for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) {
__u32 type = llite_opcode_table[id].type;
}
err = lprocfs_register_stats(sbi->ll_proc_root, "stats", sbi->ll_stats);
if (err)
}
err = lprocfs_register_stats(sbi->ll_proc_root, "stats", sbi->ll_stats);
if (err)
sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
LPROCFS_STATS_FLAG_NONE);
sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
LPROCFS_STATS_FLAG_NONE);
- if (sbi->ll_ra_stats == NULL)
- GOTO(out, err = -ENOMEM);
+ if (sbi->ll_ra_stats == NULL) {
+ err = -ENOMEM;
+ goto out;
+ }
for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++)
lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++)
lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats",
sbi->ll_ra_stats);
if (err)
err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats",
sbi->ll_ra_stats);
if (err)
err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
if (err)
err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
if (err)
/* MDC info */
obd = class_name2obd(mdc);
/* MDC info */
obd = class_name2obd(mdc);
LASSERT(obd->obd_type->typ_name != NULL);
dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
LASSERT(obd->obd_type->typ_name != NULL);
dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
- if (dir == NULL)
- GOTO(out, err = -ENOMEM);
+ if (dir == NULL) {
+ err = -ENOMEM;
+ goto out;
+ }
snprintf(name, MAX_STRING_SIZE, "common_name");
lvars[0].fops = &llite_name_fops;
err = lprocfs_add_vars(dir, lvars, obd);
if (err)
snprintf(name, MAX_STRING_SIZE, "common_name");
lvars[0].fops = &llite_name_fops;
err = lprocfs_add_vars(dir, lvars, obd);
if (err)
snprintf(name, MAX_STRING_SIZE, "uuid");
lvars[0].fops = &llite_uuid_fops;
err = lprocfs_add_vars(dir, lvars, obd);
if (err)
snprintf(name, MAX_STRING_SIZE, "uuid");
lvars[0].fops = &llite_uuid_fops;
err = lprocfs_add_vars(dir, lvars, obd);
if (err)
/* OSC */
obd = class_name2obd(osc);
/* OSC */
obd = class_name2obd(osc);
LASSERT(obd->obd_type->typ_name != NULL);
dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
LASSERT(obd->obd_type->typ_name != NULL);
dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
- if (dir == NULL)
- GOTO(out, err = -ENOMEM);
+ if (dir == NULL) {
+ err = -ENOMEM;
+ goto out;
+ }
snprintf(name, MAX_STRING_SIZE, "common_name");
lvars[0].fops = &llite_name_fops;
err = lprocfs_add_vars(dir, lvars, obd);
if (err)
snprintf(name, MAX_STRING_SIZE, "common_name");
lvars[0].fops = &llite_name_fops;
err = lprocfs_add_vars(dir, lvars, obd);
if (err)
snprintf(name, MAX_STRING_SIZE, "uuid");
lvars[0].fops = &llite_uuid_fops;
snprintf(name, MAX_STRING_SIZE, "uuid");
lvars[0].fops = &llite_uuid_fops;
rc = ll_statahead_enter(parent, &dentry, 0);
if (rc == 1) {
if (dentry == save)
rc = ll_statahead_enter(parent, &dentry, 0);
if (rc == 1) {
if (dentry == save)
- GOTO(out, retval = NULL);
- GOTO(out, retval = dentry);
+ retval = NULL;
+ else
+ retval = dentry;
+ goto out;
rc = md_intent_lock(ll_i2mdexp(parent), op_data, NULL, 0, it,
lookup_flags, &req, ll_md_blocking_ast, 0);
ll_finish_md_op_data(op_data);
rc = md_intent_lock(ll_i2mdexp(parent), op_data, NULL, 0, it,
lookup_flags, &req, ll_md_blocking_ast, 0);
ll_finish_md_op_data(op_data);
- if (rc < 0)
- GOTO(out, retval = ERR_PTR(rc));
+ if (rc < 0) {
+ retval = ERR_PTR(rc);
+ goto out;
+ }
rc = ll_lookup_it_finish(req, it, parent, &dentry);
if (rc != 0) {
ll_intent_release(it);
rc = ll_lookup_it_finish(req, it, parent, &dentry);
if (rc != 0) {
ll_intent_release(it);
- GOTO(out, retval = ERR_PTR(rc));
+ retval = ERR_PTR(rc);
+ goto out;
}
if ((it->it_op & IT_OPEN) && dentry->d_inode &&
}
if ((it->it_op & IT_OPEN) && dentry->d_inode &&
ll_lookup_finish_locks(it, dentry);
if (dentry == save)
ll_lookup_finish_locks(it, dentry);
if (dentry == save)
- GOTO(out, retval = NULL);
- GOTO(out, retval = dentry);
+ retval = dentry;
+ goto out;
out:
if (req)
ptlrpc_req_finished(req);
out:
if (req)
ptlrpc_req_finished(req);
request = it->d.lustre.it_data;
it_clear_disposition(it, DISP_ENQ_CREATE_REF);
rc = ll_prep_inode(&inode, request, dir->i_sb, it);
request = it->d.lustre.it_data;
it_clear_disposition(it, DISP_ENQ_CREATE_REF);
rc = ll_prep_inode(&inode, request, dir->i_sb, it);
- if (rc)
- GOTO(out, inode = ERR_PTR(rc));
+ if (rc) {
+ inode = ERR_PTR(rc);
+ goto out;
+ }
LASSERT(ll_d_hlist_empty(&inode->i_dentry));
LASSERT(ll_d_hlist_empty(&inode->i_dentry));
op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
name->len, 0, opc, NULL);
op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
name->len, 0, opc, NULL);
- if (IS_ERR(op_data))
- GOTO(err_exit, err = PTR_ERR(op_data));
+ if (IS_ERR(op_data)) {
+ err = PTR_ERR(op_data);
+ goto err_exit;
+ }
err = md_create(sbi->ll_md_exp, op_data, tgt, tgt_len, mode,
from_kuid(&init_user_ns, current_fsuid()),
err = md_create(sbi->ll_md_exp, op_data, tgt, tgt_len, mode,
from_kuid(&init_user_ns, current_fsuid()),
cfs_curproc_cap_pack(), rdev, &request);
ll_finish_md_op_data(op_data);
if (err)
cfs_curproc_cap_pack(), rdev, &request);
ll_finish_md_op_data(op_data);
if (err)
ll_update_times(request, dir);
if (dchild) {
err = ll_prep_inode(&inode, request, dchild->d_sb, NULL);
if (err)
ll_update_times(request, dir);
if (dchild) {
err = ll_prep_inode(&inode, request, dchild->d_sb, NULL);
if (err)
d_instantiate(dchild, inode);
}
d_instantiate(dchild, inode);
}
err = md_link(sbi->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
if (err)
err = md_link(sbi->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
if (err)
ll_update_times(request, dir);
ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1);
ll_update_times(request, dir);
ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1);
if (body->eadatasize == 0) {
CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n");
if (body->eadatasize == 0) {
CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n");
- GOTO(out, rc = -EPROTO);
+ rc = -EPROTO;
+ goto out;
}
/* The MDS sent back the EA because we unlinked the last reference
}
/* The MDS sent back the EA because we unlinked the last reference
rc = obd_unpackmd(ll_i2dtexp(dir), &lsm, eadata, body->eadatasize);
if (rc < 0) {
CERROR("obd_unpackmd: %d\n", rc);
rc = obd_unpackmd(ll_i2dtexp(dir), &lsm, eadata, body->eadatasize);
if (rc < 0) {
CERROR("obd_unpackmd: %d\n", rc);
}
LASSERT(rc >= sizeof(*lsm));
OBDO_ALLOC(oa);
}
LASSERT(rc >= sizeof(*lsm));
OBDO_ALLOC(oa);
- if (oa == NULL)
- GOTO(out_free_memmd, rc = -ENOMEM);
+ if (oa == NULL) {
+ rc = -ENOMEM;
+ goto out_free_memmd;
+ }
oa->o_oi = lsm->lsm_oi;
oa->o_mode = body->mode & S_IFMT;
oa->o_oi = lsm->lsm_oi;
oa->o_mode = body->mode & S_IFMT;
if (body->valid & OBD_MD_FLOSSCAPA) {
rc = md_unpack_capa(ll_i2mdexp(dir), request, &RMF_CAPA2, &oc);
if (rc)
if (body->valid & OBD_MD_FLOSSCAPA) {
rc = md_unpack_capa(ll_i2mdexp(dir), request, &RMF_CAPA2, &oc);
if (rc)
- GOTO(out_free_memmd, rc);
}
rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti,
}
rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti,
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
if (rc)
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
if (rc)
ll_update_times(request, dir);
ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK, 1);
ll_update_times(request, dir);
ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK, 1);
- if (!found)
- GOTO(out, rc = -ENOENT);
+ if (!found) {
+ rc = -ENOENT;
+ goto out;
+ }
CDEBUG(D_SEC, "found remote perm: %u/%u/%u/%u - %#x\n",
lrp->lrp_uid, lrp->lrp_gid, lrp->lrp_fsuid, lrp->lrp_fsgid,
CDEBUG(D_SEC, "found remote perm: %u/%u/%u/%u - %#x\n",
lrp->lrp_uid, lrp->lrp_gid, lrp->lrp_fsuid, lrp->lrp_fsgid,
* otherwise it will form small read RPC(< 1M), which hurt server
* performance a lot. */
ret = min(ra->ra_max_pages - atomic_read(&ra->ra_cur_pages), pages);
* otherwise it will form small read RPC(< 1M), which hurt server
* performance a lot. */
ret = min(ra->ra_max_pages - atomic_read(&ra->ra_cur_pages), pages);
- if (ret < 0 || ret < min_t(long, PTLRPC_MAX_BRW_PAGES, pages))
- GOTO(out, ret = 0);
+ if (ret < 0 || ret < min_t(long, PTLRPC_MAX_BRW_PAGES, pages)) {
+ ret = 0;
+ goto out;
+ }
/* If the non-strided (ria_pages == 0) readahead window
* (ria_start + ret) has grown across an RPC boundary, then trim
/* If the non-strided (ria_pages == 0) readahead window
* (ria_start + ret) has grown across an RPC boundary, then trim
ras->ras_next_readahead = 0;
ras->ras_window_len = min(ra->ra_max_pages_per_file,
ra->ra_max_read_ahead_whole_pages);
ras->ras_next_readahead = 0;
ras->ras_window_len = min(ra->ra_max_pages_per_file,
ra->ra_max_read_ahead_whole_pages);
}
ras_reset(inode, ras, index);
ras->ras_consecutive_pages++;
}
ras_reset(inode, ras, index);
ras->ras_consecutive_pages++;
} else {
ras->ras_consecutive_pages = 0;
ras->ras_consecutive_requests = 0;
} else {
ras->ras_consecutive_pages = 0;
ras->ras_consecutive_requests = 0;
ras_reset(inode, ras, index);
ras->ras_consecutive_pages++;
ras_stride_reset(ras);
ras_reset(inode, ras, index);
ras->ras_consecutive_pages++;
ras_stride_reset(ras);
}
} else if (stride_io_mode(ras)) {
/* If this is contiguous read but in stride I/O mode
}
} else if (stride_io_mode(ras)) {
/* If this is contiguous read but in stride I/O mode
* is not incremented and thus can't be used to trigger RA */
if (!ras->ras_window_len && ras->ras_consecutive_pages == 4) {
ras->ras_window_len = RAS_INCREASE_STEP(inode);
* is not incremented and thus can't be used to trigger RA */
if (!ras->ras_window_len && ras->ras_consecutive_pages == 4) {
ras->ras_window_len = RAS_INCREASE_STEP(inode);
}
/* Initially reset the stride window offset to next_readahead*/
}
/* Initially reset the stride window offset to next_readahead*/
LASSERT(ll_i2dtexp(inode) != NULL);
env = cl_env_nested_get(&nest);
LASSERT(ll_i2dtexp(inode) != NULL);
env = cl_env_nested_get(&nest);
- if (IS_ERR(env))
- GOTO(out, result = PTR_ERR(env));
+ if (IS_ERR(env)) {
+ result = PTR_ERR(env);
+ goto out;
+ }
clob = ll_i2info(inode)->lli_clob;
LASSERT(clob != NULL);
clob = ll_i2info(inode)->lli_clob;
LASSERT(clob != NULL);
}
cl_env_nested_put(&nest, env);
}
cl_env_nested_put(&nest, env);
}
iov_iter_advance(iter, result);
tot_bytes += result;
}
iov_iter_advance(iter, result);
tot_bytes += result;
it = &minfo->mi_it;
req = entry->se_req;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
it = &minfo->mi_it;
req = entry->se_req;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
- if (body == NULL)
- GOTO(out, rc = -EFAULT);
+ if (body == NULL) {
+ rc = -EFAULT;
+ goto out;
+ }
child = entry->se_inode;
if (child == NULL) {
child = entry->se_inode;
if (child == NULL) {
/* XXX: No fid in reply, this is probably cross-ref case.
* SA can't handle it yet. */
/* XXX: No fid in reply, this is probably cross-ref case.
* SA can't handle it yet. */
- if (body->valid & OBD_MD_MDS)
- GOTO(out, rc = -EAGAIN);
+ if (body->valid & OBD_MD_MDS) {
+ rc = -EAGAIN;
+ goto out;
+ }
} else {
/*
* revalidate.
} else {
/*
* revalidate.
it->d.lustre.it_lock_handle = entry->se_handle;
rc = md_revalidate_lock(ll_i2mdexp(dir), it, ll_inode2fid(dir), NULL);
it->d.lustre.it_lock_handle = entry->se_handle;
rc = md_revalidate_lock(ll_i2mdexp(dir), it, ll_inode2fid(dir), NULL);
- if (rc != 1)
- GOTO(out, rc = -EAGAIN);
+ if (rc != 1) {
+ rc = -EAGAIN;
+ goto out;
+ }
rc = ll_prep_inode(&child, req, dir->i_sb, it);
if (rc)
rc = ll_prep_inode(&child, req, dir->i_sb, it);
if (rc)
CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
child, child->i_ino, child->i_generation);
CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
child, child->i_ino, child->i_generation);
if (unlikely(lli->lli_sai == NULL ||
lli->lli_sai->sai_generation != minfo->mi_generation)) {
spin_unlock(&lli->lli_sa_lock);
if (unlikely(lli->lli_sai == NULL ||
lli->lli_sai->sai_generation != minfo->mi_generation)) {
spin_unlock(&lli->lli_sa_lock);
- GOTO(out, rc = -ESTALE);
+ rc = -ESTALE;
+ goto out;
} else {
sai = ll_sai_get(lli->lli_sai);
if (unlikely(!thread_is_running(&sai->sai_thread))) {
sai->sai_replied++;
spin_unlock(&lli->lli_sa_lock);
} else {
sai = ll_sai_get(lli->lli_sai);
if (unlikely(!thread_is_running(&sai->sai_thread))) {
sai->sai_replied++;
spin_unlock(&lli->lli_sa_lock);
- GOTO(out, rc = -EBADFD);
+ rc = -EBADFD;
+ goto out;
}
entry = ll_sa_entry_get_byindex(sai, minfo->mi_cbdata);
if (entry == NULL) {
sai->sai_replied++;
spin_unlock(&lli->lli_sa_lock);
}
entry = ll_sa_entry_get_byindex(sai, minfo->mi_cbdata);
if (entry == NULL) {
sai->sai_replied++;
spin_unlock(&lli->lli_sa_lock);
- GOTO(out, rc = -EIDRM);
+ rc = -EIDRM;
+ goto out;
CDEBUG(D_READA, "error reading dir "DFID" at %llu/%llu: [rc %d] [parent %u]\n",
PFID(ll_inode2fid(dir)), pos, sai->sai_index,
rc, plli->lli_opendir_pid);
CDEBUG(D_READA, "error reading dir "DFID" at %llu/%llu: [rc %d] [parent %u]\n",
PFID(ll_inode2fid(dir)), pos, sai->sai_index,
rc, plli->lli_opendir_pid);
}
dp = page_address(page);
}
dp = page_address(page);
if (unlikely(!thread_is_running(thread))) {
ll_release_page(page, 0);
if (unlikely(!thread_is_running(thread))) {
ll_release_page(page, 0);
}
/* If no window for metadata statahead, but there are
}
/* If no window for metadata statahead, but there are
if (unlikely(
!thread_is_running(thread))) {
ll_release_page(page, 0);
if (unlikely(
!thread_is_running(thread))) {
ll_release_page(page, 0);
}
if (!sa_sent_full(sai))
}
if (!sa_sent_full(sai))
while (!sa_received_empty(sai))
ll_post_statahead(sai);
while (!sa_received_empty(sai))
ll_post_statahead(sai);
- if (unlikely(!thread_is_running(thread)))
- GOTO(out, rc = 0);
+ if (unlikely(!thread_is_running(thread))) {
+ rc = 0;
+ goto out;
+ }
if (sai->sai_sent == sai->sai_replied &&
sa_received_empty(sai))
if (sai->sai_sent == sai->sai_replied &&
sa_received_empty(sai))
}
spin_unlock(&plli->lli_agl_lock);
}
spin_unlock(&plli->lli_agl_lock);
} else if (1) {
/*
* chain is exhausted.
} else if (1) {
/*
* chain is exhausted.
rc = LS_FIRST_DOT_DE;
ll_release_page(page, 0);
rc = LS_FIRST_DOT_DE;
ll_release_page(page, 0);
}
pos = le64_to_cpu(dp->ldp_hash_end);
if (pos == MDS_DIR_END_OFF) {
}
pos = le64_to_cpu(dp->ldp_hash_end);
if (pos == MDS_DIR_END_OFF) {
/* I am the "lli_opendir_pid" owner, only me can set "lli_sai". */
rc = is_first_dirent(dir, *dentryp);
/* I am the "lli_opendir_pid" owner, only me can set "lli_sai". */
rc = is_first_dirent(dir, *dentryp);
- if (rc == LS_NONE_FIRST_DE)
+ if (rc == LS_NONE_FIRST_DE) {
/* It is not "ls -{a}l" operation, no need statahead for it. */
/* It is not "ls -{a}l" operation, no need statahead for it. */
- GOTO(out, rc = -EAGAIN);
+ rc = -EAGAIN;
+ goto out;
+ }
- if (sai == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (sai == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
sai->sai_ls_all = (rc == LS_FIRST_DOT_DE);
sai->sai_inode = igrab(dir);
if (unlikely(sai->sai_inode == NULL)) {
CWARN("Do not start stat ahead on dying inode "DFID"\n",
PFID(&lli->lli_fid));
sai->sai_ls_all = (rc == LS_FIRST_DOT_DE);
sai->sai_inode = igrab(dir);
if (unlikely(sai->sai_inode == NULL)) {
CWARN("Do not start stat ahead on dying inode "DFID"\n",
PFID(&lli->lli_fid));
- GOTO(out, rc = -ESTALE);
+ rc = -ESTALE;
+ goto out;
}
/* get parent reference count here, and put it in ll_statahead_thread */
}
/* get parent reference count here, and put it in ll_statahead_thread */
PFID(&lli->lli_fid), PFID(&nlli->lli_fid));
dput(parent);
iput(sai->sai_inode);
PFID(&lli->lli_fid), PFID(&nlli->lli_fid));
dput(parent);
iput(sai->sai_inode);
- GOTO(out, rc = -EAGAIN);
+ rc = -EAGAIN;
+ goto out;
}
CDEBUG(D_READA, "start statahead thread: sai %p, parent %.*s\n",
}
CDEBUG(D_READA, "start statahead thread: sai %p, parent %.*s\n",
if (rc) {
if (rc != -ENOENT)
CERROR("inode %lu: rc = %d\n", inode->i_ino, rc);
if (rc) {
if (rc != -ENOENT)
CERROR("inode %lu: rc = %d\n", inode->i_ino, rc);
}
body = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_BODY);
LASSERT(body != NULL);
if ((body->valid & OBD_MD_LINKNAME) == 0) {
CERROR("OBD_MD_LINKNAME not set on reply\n");
}
body = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_BODY);
LASSERT(body != NULL);
if ((body->valid & OBD_MD_LINKNAME) == 0) {
CERROR("OBD_MD_LINKNAME not set on reply\n");
- GOTO(failed, rc = -EPROTO);
+ rc = -EPROTO;
+ goto failed;
}
LASSERT(symlen != 0);
if (body->eadatasize != symlen) {
CERROR("inode %lu: symlink length %d not expected %d\n",
inode->i_ino, body->eadatasize - 1, symlen - 1);
}
LASSERT(symlen != 0);
if (body->eadatasize != symlen) {
CERROR("inode %lu: symlink length %d not expected %d\n",
inode->i_ino, body->eadatasize - 1, symlen - 1);
- GOTO(failed, rc = -EPROTO);
+ rc = -EPROTO;
+ goto failed;
}
*symname = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_MD);
}
*symname = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_MD);
/* not full/NULL terminated */
CERROR("inode %lu: symlink not NULL terminated string"
"of length %d\n", inode->i_ino, symlen - 1);
/* not full/NULL terminated */
CERROR("inode %lu: symlink not NULL terminated string"
"of length %d\n", inode->i_ino, symlen - 1);
- GOTO(failed, rc = -EPROTO);
+ rc = -EPROTO;
+ goto failed;
}
OBD_ALLOC(lli->lli_symlink_name, symlen);
}
OBD_ALLOC(lli->lli_symlink_name, symlen);
/* return +1 to stop cl_io_loop() and ll_fault() will catch
* and retry. */
/* return +1 to stop cl_io_loop() and ll_fault() will catch
* and retry. */
- GOTO(out, result = +1);
+ result = +1;
+ goto out;
* in ll_page_mkwrite0. Thus we return -ENODATA
* to handle both cases
*/
* in ll_page_mkwrite0. Thus we return -ENODATA
* to handle both cases
*/
- GOTO(out, result = -ENODATA);
+ result = -ENODATA;
+ goto out;
}
}
page = cl_page_find(env, obj, fio->ft_index, vmpage, CPT_CACHEABLE);
}
}
page = cl_page_find(env, obj, fio->ft_index, vmpage, CPT_CACHEABLE);
- if (IS_ERR(page))
- GOTO(out, result = PTR_ERR(page));
+ if (IS_ERR(page)) {
+ result = PTR_ERR(page);
+ goto out;
+ }
/* if page is going to be written, we should add this page into cache
* earlier. */
/* if page is going to be written, we should add this page into cache
* earlier. */
/* we're in big trouble, what can we do now? */
if (result == -EDQUOT)
result = -ENOSPC;
/* we're in big trouble, what can we do now? */
if (result == -EDQUOT)
result = -ENOSPC;
} else
cl_page_disown(env, io, page);
}
} else
cl_page_disown(env, io, page);
}
if (rc == -EAGAIN)
goto getxattr_nocache;
if (rc < 0)
if (rc == -EAGAIN)
goto getxattr_nocache;
if (rc < 0)
/* Add "system.posix_acl_access" to the list */
if (lli->lli_posix_acl != NULL && valid & OBD_MD_FLXATTRLS) {
/* Add "system.posix_acl_access" to the list */
if (lli->lli_posix_acl != NULL && valid & OBD_MD_FLXATTRLS) {
sizeof(XATTR_NAME_ACL_ACCESS));
rc += sizeof(XATTR_NAME_ACL_ACCESS);
} else {
sizeof(XATTR_NAME_ACL_ACCESS));
rc += sizeof(XATTR_NAME_ACL_ACCESS);
} else {
- GOTO(out_xattr, rc = -ERANGE);
+ rc = -ERANGE;
+ goto out_xattr;
capa_put(oc);
if (rc < 0)
capa_put(oc);
if (rc < 0)
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
LASSERT(body);
/* only detect the xattr size */
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
LASSERT(body);
/* only detect the xattr size */
- if (size == 0)
- GOTO(out, rc = body->eadatasize);
+ if (size == 0) {
+ rc = body->eadatasize;
+ goto out;
+ }
if (size < body->eadatasize) {
CERROR("server bug: replied size %u > %u\n",
body->eadatasize, (int)size);
if (size < body->eadatasize) {
CERROR("server bug: replied size %u > %u\n",
body->eadatasize, (int)size);
- GOTO(out, rc = -ERANGE);
+ rc = -ERANGE;
+ goto out;
- if (body->eadatasize == 0)
- GOTO(out, rc = -ENODATA);
+ if (body->eadatasize == 0) {
+ rc = -ENODATA;
+ goto out;
+ }
/* do not need swab xattr data */
xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
body->eadatasize);
/* do not need swab xattr data */
xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
body->eadatasize);
- if (!xdata)
- GOTO(out, rc = -EFAULT);
+ if (!xdata) {
+ rc = -EFAULT;
+ goto out;
+ }
memcpy(buffer, xdata, body->eadatasize);
rc = body->eadatasize;
memcpy(buffer, xdata, body->eadatasize);
rc = body->eadatasize;
acl = lustre_posix_acl_xattr_2ext(
(posix_acl_xattr_header *)buffer, rc);
acl = lustre_posix_acl_xattr_2ext(
(posix_acl_xattr_header *)buffer, rc);
- if (IS_ERR(acl))
- GOTO(out, rc = PTR_ERR(acl));
+ if (IS_ERR(acl)) {
+ rc = PTR_ERR(acl);
+ goto out;
+ }
rc = ee_add(&sbi->ll_et, current_pid(), ll_inode2fid(inode),
xattr_type, acl);
if (unlikely(rc < 0)) {
lustre_ext_acl_xattr_free(acl);
rc = ee_add(&sbi->ll_et, current_pid(), ll_inode2fid(inode),
xattr_type, acl);
if (unlikely(rc < 0)) {
lustre_ext_acl_xattr_free(acl);
if (size == 0 && S_ISDIR(inode->i_mode)) {
/* XXX directory EA is fix for now, optimize to save
* RPC transfer */
if (size == 0 && S_ISDIR(inode->i_mode)) {
/* XXX directory EA is fix for now, optimize to save
* RPC transfer */
- GOTO(out, rc = sizeof(struct lov_user_md));
+ rc = sizeof(struct lov_user_md);
+ goto out;
}
lsm = ccc_inode_lsm_get(inode);
}
lsm = ccc_inode_lsm_get(inode);
ccc_inode_lsm_put(inode, lsm);
if (rc < 0)
ccc_inode_lsm_put(inode, lsm);
if (rc < 0)
if (size == 0) {
/* used to call ll_get_max_mdsize() forward to get
if (size == 0) {
/* used to call ll_get_max_mdsize() forward to get
* rsync 3.0.x) care much about the exact xattr value
* size */
rc = lmmsize;
* rsync 3.0.x) care much about the exact xattr value
* size */
rc = lmmsize;
}
if (size < lmmsize) {
CERROR("server bug: replied size %d > %d for %s (%s)\n",
lmmsize, (int)size, dentry->d_name.name, name);
}
if (size < lmmsize) {
CERROR("server bug: replied size %d > %d for %s (%s)\n",
lmmsize, (int)size, dentry->d_name.name, name);
- GOTO(out, rc = -ERANGE);
+ rc = -ERANGE;
+ goto out;
}
lump = (struct lov_user_md *)buffer;
}
lump = (struct lov_user_md *)buffer;
rc = ll_getxattr_common(inode, NULL, buffer, size, OBD_MD_FLXATTRLS);
if (rc < 0)
rc = ll_getxattr_common(inode, NULL, buffer, size, OBD_MD_FLXATTRLS);
if (rc < 0)
if (buffer != NULL) {
struct ll_sb_info *sbi = ll_i2sbi(inode);
if (buffer != NULL) {
struct ll_sb_info *sbi = ll_i2sbi(inode);
} else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
const int prefix_len = sizeof(XATTR_LUSTRE_PREFIX) - 1;
const size_t name_len = sizeof("lov") - 1;
} else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
const int prefix_len = sizeof(XATTR_LUSTRE_PREFIX) - 1;
const size_t name_len = sizeof("lov") - 1;
rc = ll_xattr_find_get_lock(inode, oit, &req);
if (rc)
rc = ll_xattr_find_get_lock(inode, oit, &req);
if (rc)
- GOTO(out_no_unlock, rc);
/* Do we have the data at this point? */
if (ll_xattr_cache_valid(lli)) {
ll_stats_ops_tally(sbi, LPROC_LL_GETXATTR_HITS, 1);
/* Do we have the data at this point? */
if (ll_xattr_cache_valid(lli)) {
ll_stats_ops_tally(sbi, LPROC_LL_GETXATTR_HITS, 1);
- GOTO(out_maybe_drop, rc = 0);
+ rc = 0;
+ goto out_maybe_drop;
}
/* Matched but no cache? Cancelled on error by a parallel refill. */
if (unlikely(req == NULL)) {
CDEBUG(D_CACHE, "cancelled by a parallel getxattr\n");
}
/* Matched but no cache? Cancelled on error by a parallel refill. */
if (unlikely(req == NULL)) {
CDEBUG(D_CACHE, "cancelled by a parallel getxattr\n");
- GOTO(out_maybe_drop, rc = -EIO);
+ rc = -EIO;
+ goto out_maybe_drop;
}
if (oit->d.lustre.it_status < 0) {
}
if (oit->d.lustre.it_status < 0) {
/* xattr data is so large that we don't want to cache it */
if (rc == -ERANGE)
rc = -EAGAIN;
/* xattr data is so large that we don't want to cache it */
if (rc == -ERANGE)
rc = -EAGAIN;
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (body == NULL) {
CERROR("no MDT BODY in the refill xattr reply\n");
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (body == NULL) {
CERROR("no MDT BODY in the refill xattr reply\n");
- GOTO(out_destroy, rc = -EPROTO);
+ rc = -EPROTO;
+ goto out_destroy;
}
/* do not need swab xattr data */
xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
}
/* do not need swab xattr data */
xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
body->max_mdsize * sizeof(__u32));
if (xdata == NULL || xval == NULL || xsizes == NULL) {
CERROR("wrong setxattr reply\n");
body->max_mdsize * sizeof(__u32));
if (xdata == NULL || xval == NULL || xsizes == NULL) {
CERROR("wrong setxattr reply\n");
- GOTO(out_destroy, rc = -EPROTO);
+ rc = -EPROTO;
+ goto out_destroy;
}
xtail = xdata + body->eadatasize;
}
xtail = xdata + body->eadatasize;
}
if (rc < 0) {
ll_xattr_cache_destroy_locked(lli);
}
if (rc < 0) {
ll_xattr_cache_destroy_locked(lli);
}
xdata += strlen(xdata) + 1;
xval += *xsizes;
}
xdata += strlen(xdata) + 1;
xval += *xsizes;
ll_set_lock_data(sbi->ll_md_exp, inode, oit, NULL);
ll_set_lock_data(sbi->ll_md_exp, inode, oit, NULL);
- GOTO(out_maybe_drop, rc);
out_maybe_drop:
ll_intent_drop_lock(oit);
out_maybe_drop:
ll_intent_drop_lock(oit);
size ? buffer : NULL, size);
}
size ? buffer : NULL, size);
}
out:
up_read(&lli->lli_xattrs_list_rwsem);
out:
up_read(&lli->lli_xattrs_list_rwsem);