diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/llite/dir.c')
-rw-r--r-- | drivers/staging/lustre/lustre/llite/dir.c | 251 |
1 files changed, 114 insertions, 137 deletions
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 23c61fe81965..09844be5eec4 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -41,14 +41,13 @@ #include <linux/fs.h> #include <linux/pagemap.h> #include <linux/mm.h> -#include <linux/version.h> #include <asm/uaccess.h> #include <linux/buffer_head.h> // for wait_on_buffer #include <linux/pagevec.h> +#include <linux/prefetch.h> #define DEBUG_SUBSYSTEM S_LLITE -#include <lustre/lustre_idl.h> #include <obd_support.h> #include <obd_class.h> #include <lustre_lib.h> @@ -158,7 +157,6 @@ static int ll_dir_filler(void *_hash, struct page *page0) int npages; int i; int rc; - ENTRY; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) hash "LPU64"\n", inode->i_ino, inode->i_generation, inode, hash); @@ -239,7 +237,6 @@ static int ll_dir_filler(void *_hash, struct page *page0) if (page_pool != &page0) OBD_FREE(page_pool, sizeof(struct page *) * max_pages); - EXIT; return rc; } @@ -355,15 +352,12 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash, rc = md_lock_match(ll_i2sbi(dir)->ll_md_exp, LDLM_FL_BLOCK_GRANTED, ll_inode2fid(dir), LDLM_IBITS, &policy, mode, &lockh); if (!rc) { - struct ldlm_enqueue_info einfo = {.ei_type = LDLM_IBITS, - .ei_mode = mode, - .ei_cb_bl = - ll_md_blocking_ast, - .ei_cb_cp = - ldlm_completion_ast, - .ei_cb_gl = NULL, - .ei_cb_wg = NULL, - .ei_cbdata = NULL}; + struct ldlm_enqueue_info einfo = { + .ei_type = LDLM_IBITS, + .ei_mode = mode, + .ei_cb_bl = ll_md_blocking_ast, + .ei_cb_cp = ldlm_completion_ast, + }; struct lookup_intent it = { .it_op = IT_READDIR }; struct ptlrpc_request *request; struct md_op_data *op_data; @@ -482,19 +476,17 @@ fail: goto out_unlock; } -int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie, - filldir_t filldir) +int ll_dir_read(struct inode *inode, struct dir_context *ctx) { struct ll_inode_info *info = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); - __u64 pos = *_pos; + __u64 pos = ctx->pos; int api32 = ll_need_32bit_api(sbi); int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; struct page *page; struct ll_dir_chain chain; int done = 0; int rc = 0; - ENTRY; ll_dir_chain_init(&chain); @@ -547,12 +539,14 @@ int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie, fid_le_to_cpu(&fid, &ent->lde_fid); ino = cl_fid_build_ino(&fid, api32); type = ll_dirent_type_get(ent); + ctx->pos = lhash; /* For 'll_nfs_get_name_filldir()', it will try * to access the 'ent' through its 'lde_name', - * so the parameter 'name' for 'filldir()' must - * be part of the 'ent'. */ - done = filldir(cookie, ent->lde_name, namelen, - lhash, ino, type); + * so the parameter 'name' for 'ctx->actor()' + * must be part of the 'ent'. + */ + done = !dir_emit(ctx, ent->lde_name, + namelen, ino, type); } next = le64_to_cpu(dp->ldp_hash_end); if (!done) { @@ -593,56 +587,49 @@ int ll_dir_read(struct inode *inode, __u64 *_pos, void *cookie, } } - *_pos = pos; + ctx->pos = pos; ll_dir_chain_fini(&chain); - RETURN(rc); + return rc; } -static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir) +static int ll_readdir(struct file *filp, struct dir_context *ctx) { struct inode *inode = filp->f_dentry->d_inode; struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); struct ll_sb_info *sbi = ll_i2sbi(inode); - __u64 pos = lfd->lfd_pos; int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; int api32 = ll_need_32bit_api(sbi); int rc; - struct path path; - ENTRY; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu " " 32bit_api %d\n", inode->i_ino, inode->i_generation, - inode, (unsigned long)pos, i_size_read(inode), api32); + inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32); - if (pos == MDS_DIR_END_OFF) + if (lfd->lfd_pos == MDS_DIR_END_OFF) /* * end-of-file. */ GOTO(out, rc = 0); - rc = ll_dir_read(inode, &pos, cookie, filldir); - lfd->lfd_pos = pos; - if (pos == MDS_DIR_END_OFF) { + ctx->pos = lfd->lfd_pos; + rc = ll_dir_read(inode, ctx); + lfd->lfd_pos = ctx->pos; + if (ctx->pos == MDS_DIR_END_OFF) { if (api32) - filp->f_pos = LL_DIR_END_OFF_32BIT; + ctx->pos = LL_DIR_END_OFF_32BIT; else - filp->f_pos = LL_DIR_END_OFF; + ctx->pos = LL_DIR_END_OFF; } else { if (api32 && hash64) - filp->f_pos = pos >> 32; - else - filp->f_pos = pos; + ctx->pos >>= 32; } filp->f_version = inode->i_version; - path.mnt = filp->f_path.mnt; - path.dentry = filp->f_dentry; - touch_atime(&path); out: if (!rc) ll_stats_ops_tally(sbi, LPROC_LL_READDIR, 1); - RETURN(rc); + return rc; } int ll_send_mgc_param(struct obd_export *mgc, char *string) @@ -673,8 +660,6 @@ int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump, int mode; int err; - ENTRY; - mode = (0755 & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR; op_data = ll_prep_md_op_data(NULL, dir, NULL, filename, strlen(filename), mode, LUSTRE_OPC_MKDIR, @@ -684,7 +669,8 @@ int ll_dir_setdirstripe(struct inode *dir, struct lmv_user_md *lump, op_data->op_cli_flags |= CLI_SET_MEA; err = md_create(sbi->ll_md_exp, op_data, lump, sizeof(*lump), mode, - current_fsuid(), current_fsgid(), + from_kuid(&init_user_ns, current_fsuid()), + from_kgid(&init_user_ns, current_fsgid()), cfs_curproc_cap_pack(), 0, &request); ll_finish_md_op_data(op_data); if (err) @@ -704,7 +690,6 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, struct lustre_sb_info *lsi = s2lsi(inode->i_sb); struct obd_device *mgc = lsi->lsi_mgc; int lum_size; - ENTRY; if (lump != NULL) { /* @@ -731,7 +716,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, " %#08x != %#08x nor %#08x\n", lump->lmm_magic, LOV_USER_MAGIC_V1, LOV_USER_MAGIC_V3); - RETURN(-EINVAL); + return -EINVAL; } } } else { @@ -741,7 +726,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) - RETURN(PTR_ERR(op_data)); + return PTR_ERR(op_data); if (lump != NULL && lump->lmm_magic == cpu_to_le32(LMV_USER_MAGIC)) op_data->op_cli_flags |= CLI_SET_MEA; @@ -797,7 +782,7 @@ end: if (param != NULL) OBD_FREE(param, MGS_PARAM_MAXLEN); } - RETURN(rc); + return rc; } int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, @@ -812,13 +797,13 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, rc = ll_get_max_mdsize(sbi, &lmmsize); if (rc) - RETURN(rc); + return rc; op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, lmmsize, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) - RETURN(PTR_ERR(op_data)); + return PTR_ERR(op_data); op_data->op_valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA; rc = md_getattr(sbi->ll_md_exp, op_data, &req); @@ -878,12 +863,11 @@ int ll_get_mdt_idx(struct inode *inode) struct ll_sb_info *sbi = ll_i2sbi(inode); struct md_op_data *op_data; int rc, mdtidx; - ENTRY; op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) - RETURN(PTR_ERR(op_data)); + return PTR_ERR(op_data); op_data->op_flags |= MF_GET_MDT_IDX; rc = md_getattr(sbi->ll_md_exp, op_data, NULL); @@ -891,7 +875,7 @@ int ll_get_mdt_idx(struct inode *inode) ll_finish_md_op_data(op_data); if (rc < 0) { CDEBUG(D_INFO, "md_getattr_name: %d\n", rc); - RETURN(rc); + return rc; } return mdtidx; } @@ -912,7 +896,6 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) struct ll_sb_info *sbi = ll_s2sbi(sb); struct hsm_progress_kernel hpk; int rc; - ENTRY; /* Forge a hsm_progress based on data from copy. */ hpk.hpk_fid = copy->hc_hai.hai_fid; @@ -962,7 +945,7 @@ progress: rc = obd_iocontrol(LL_IOC_HSM_PROGRESS, sbi->ll_md_exp, sizeof(hpk), &hpk, NULL); - RETURN(rc); + return rc; } /** @@ -985,7 +968,6 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) struct ll_sb_info *sbi = ll_s2sbi(sb); struct hsm_progress_kernel hpk; int rc; - ENTRY; /* If you modify the logic here, also check llapi_hsm_copy_end(). */ /* Take care: copy->hc_hai.hai_action, len, gid and data are not @@ -1062,7 +1044,7 @@ progress: rc = obd_iocontrol(LL_IOC_HSM_PROGRESS, sbi->ll_md_exp, sizeof(hpk), &hpk, NULL); - RETURN(rc); + return rc; } @@ -1090,7 +1072,6 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) int id = qctl->qc_id; int valid = qctl->qc_valid; int rc = 0; - ENTRY; switch (cmd) { case LUSTRE_Q_INVALIDATE: @@ -1101,32 +1082,34 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) case Q_SETINFO: if (!cfs_capable(CFS_CAP_SYS_ADMIN) || sbi->ll_flags & LL_SBI_RMT_CLIENT) - RETURN(-EPERM); + return -EPERM; break; case Q_GETQUOTA: - if (((type == USRQUOTA && current_euid() != id) || - (type == GRPQUOTA && !in_egroup_p(id))) && + if (((type == USRQUOTA && + uid_eq(current_euid(), make_kuid(&init_user_ns, id))) || + (type == GRPQUOTA && + !in_egroup_p(make_kgid(&init_user_ns, id)))) && (!cfs_capable(CFS_CAP_SYS_ADMIN) || sbi->ll_flags & LL_SBI_RMT_CLIENT)) - RETURN(-EPERM); + return -EPERM; break; case Q_GETINFO: break; default: CERROR("unsupported quotactl op: %#x\n", cmd); - RETURN(-ENOTTY); + return -ENOTTY; } if (valid != QC_GENERAL) { if (sbi->ll_flags & LL_SBI_RMT_CLIENT) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; if (cmd == Q_GETINFO) qctl->qc_cmd = Q_GETOINFO; else if (cmd == Q_GETQUOTA) qctl->qc_cmd = Q_GETOQUOTA; else - RETURN(-EINVAL); + return -EINVAL; switch (valid) { case QC_MDTIDX: @@ -1151,7 +1134,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) } if (rc) - RETURN(rc); + return rc; qctl->qc_cmd = cmd; } else { @@ -1159,7 +1142,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) OBD_ALLOC_PTR(oqctl); if (oqctl == NULL) - RETURN(-ENOMEM); + return -ENOMEM; QCTL_COPY(oqctl, qctl); rc = obd_quotactl(sbi->ll_md_exp, oqctl); @@ -1169,7 +1152,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) obd_quotactl(sbi->ll_md_exp, oqctl); } OBD_FREE_PTR(oqctl); - RETURN(rc); + return rc; } /* If QIF_SPACE is not set, client should collect the * space usage from OSSs by itself */ @@ -1216,7 +1199,7 @@ out: OBD_FREE_PTR(oqctl); } - RETURN(rc); + return rc; } static char * @@ -1249,7 +1232,6 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct ll_sb_info *sbi = ll_i2sbi(inode); struct obd_ioctl_data *data; int rc = 0; - ENTRY; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), cmd=%#x\n", inode->i_ino, inode->i_generation, inode, cmd); @@ -1262,10 +1244,10 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch(cmd) { case FSFILT_IOC_GETFLAGS: case FSFILT_IOC_SETFLAGS: - RETURN(ll_iocontrol(inode, file, cmd, arg)); + return ll_iocontrol(inode, file, cmd, arg); case FSFILT_IOC_GETVERSION_OLD: case FSFILT_IOC_GETVERSION: - RETURN(put_user(inode->i_generation, (int *)arg)); + return put_user(inode->i_generation, (int *)arg); /* We need to special case any other ioctls we want to handle, * to send them to the MDS/OST as appropriate and to properly * network encode the arg field. @@ -1277,10 +1259,10 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) mdtidx = ll_get_mdt_idx(inode); if (mdtidx < 0) - RETURN(mdtidx); + return mdtidx; if (put_user((int)mdtidx, (int*)arg)) - RETURN(-EFAULT); + return -EFAULT; return 0; } @@ -1293,7 +1275,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) rc = obd_ioctl_getdata(&buf, &len, (void *)arg); if (rc) - RETURN(rc); + return rc; data = (void *)buf; filename = data->ioc_inlbuf1; @@ -1317,7 +1299,6 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) GOTO(out_free, rc); } ptlrpc_req_finished(request); - EXIT; out_free: obd_ioctl_freedata(buf, len); return rc; @@ -1333,7 +1314,7 @@ out_free: rc = obd_ioctl_getdata(&buf, &len, (void *)arg); if (rc) - RETURN(rc); + return rc; data = (void *)buf; if (data->ioc_inlbuf1 == NULL || data->ioc_inlbuf2 == NULL || @@ -1364,7 +1345,7 @@ out_free: rc = ll_dir_setdirstripe(inode, lum, filename); lmv_out_free: obd_ioctl_freedata(buf, len); - RETURN(rc); + return rc; } case LL_IOC_LOV_SETSTRIPE: { @@ -1380,11 +1361,11 @@ lmv_out_free: sizeof(lumv3p->lmm_objects[0])); /* first try with v1 which is smaller than v3 */ if (copy_from_user(lumv1, lumv1p, sizeof(*lumv1))) - RETURN(-EFAULT); + return -EFAULT; if ((lumv1->lmm_magic == LOV_USER_MAGIC_V3) ) { if (copy_from_user(&lumv3, lumv3p, sizeof(lumv3))) - RETURN(-EFAULT); + return -EFAULT; } if (inode->i_sb->s_root == file->f_dentry) @@ -1393,7 +1374,7 @@ lmv_out_free: /* in v1 and v3 cases lumv1 points to data */ rc = ll_dir_setstripe(inode, lumv1, set_default); - RETURN(rc); + return rc; } case LL_IOC_LMV_GETSTRIPE: { struct lmv_user_md *lump = (struct lmv_user_md *)arg; @@ -1404,10 +1385,10 @@ lmv_out_free: int mdtindex; if (copy_from_user(&lum, lump, sizeof(struct lmv_user_md))) - RETURN(-EFAULT); + return -EFAULT; if (lum.lum_magic != LMV_MAGIC_V1) - RETURN(-EINVAL); + return -EINVAL; lum_size = lmv_user_md_size(1, LMV_MAGIC_V1); OBD_ALLOC(tmp, lum_size); @@ -1430,7 +1411,7 @@ lmv_out_free: free_lmv: if (tmp) OBD_FREE(tmp, lum_size); - RETURN(rc); + return rc; } case LL_IOC_REMOVE_ENTRY: { char *filename = NULL; @@ -1447,7 +1428,7 @@ free_lmv: filename = ll_getname((const char *)arg); if (IS_ERR(filename)) - RETURN(PTR_ERR(filename)); + return PTR_ERR(filename); namelen = strlen(filename); if (namelen < 1) @@ -1457,12 +1438,12 @@ free_lmv: out_rmdir: if (filename) ll_putname(filename); - RETURN(rc); + return rc; } case LL_IOC_LOV_SWAP_LAYOUTS: - RETURN(-EPERM); + return -EPERM; case LL_IOC_OBD_STATFS: - RETURN(ll_obd_statfs(inode, (void *)arg)); + return ll_obd_statfs(inode, (void *)arg); case LL_IOC_LOV_GETSTRIPE: case LL_IOC_MDC_GETINFO: case IOC_MDC_GETFILEINFO: @@ -1478,7 +1459,7 @@ out_rmdir: cmd == IOC_MDC_GETFILESTRIPE) { filename = ll_getname((const char *)arg); if (IS_ERR(filename)) - RETURN(PTR_ERR(filename)); + return PTR_ERR(filename); rc = ll_lov_getstripe_ea_info(inode, filename, &lmm, &lmmsize, &request); @@ -1539,7 +1520,6 @@ out_rmdir: GOTO(out_req, rc = -EFAULT); } - EXIT; out_req: ptlrpc_req_finished(request); if (filename) @@ -1559,9 +1539,11 @@ out_rmdir: rc = ll_get_max_mdsize(sbi, &lmmsize); if (rc) - RETURN(rc); + return rc; OBD_ALLOC_LARGE(lmm, lmmsize); + if (lmm == NULL) + return -ENOMEM; if (copy_from_user(lmm, lum, lmmsize)) GOTO(free_lmm, rc = -EFAULT); @@ -1602,7 +1584,6 @@ out_rmdir: if (copy_to_user(&lumd->lmd_st, &st, sizeof(st))) GOTO(free_lsm, rc = -EFAULT); - EXIT; free_lsm: obd_free_memmd(sbi->ll_dt_exp, &lsm); free_lmm: @@ -1610,7 +1591,7 @@ out_rmdir: return rc; } case OBD_IOC_LLOG_CATINFO: { - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; } case OBD_IOC_QUOTACHECK: { struct obd_quotactl *oqctl; @@ -1618,11 +1599,11 @@ out_rmdir: if (!cfs_capable(CFS_CAP_SYS_ADMIN) || sbi->ll_flags & LL_SBI_RMT_CLIENT) - RETURN(-EPERM); + return -EPERM; OBD_ALLOC_PTR(oqctl); if (!oqctl) - RETURN(-ENOMEM); + return -ENOMEM; oqctl->qc_type = arg; rc = obd_quotacheck(sbi->ll_md_exp, oqctl); if (rc < 0) { @@ -1642,11 +1623,11 @@ out_rmdir: if (!cfs_capable(CFS_CAP_SYS_ADMIN) || sbi->ll_flags & LL_SBI_RMT_CLIENT) - RETURN(-EPERM); + return -EPERM; OBD_ALLOC_PTR(check); if (!check) - RETURN(-ENOMEM); + return -ENOMEM; rc = obd_iocontrol(cmd, sbi->ll_md_exp, 0, (void *)check, NULL); @@ -1669,7 +1650,7 @@ out_rmdir: } out_poll: OBD_FREE_PTR(check); - RETURN(rc); + return rc; } #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0) case LL_IOC_QUOTACTL_18: { @@ -1680,7 +1661,7 @@ out_rmdir: OBD_ALLOC_PTR(qctl_18); if (!qctl_18) - RETURN(-ENOMEM); + return -ENOMEM; OBD_ALLOC_PTR(qctl_20); if (!qctl_20) @@ -1720,7 +1701,7 @@ out_rmdir: OBD_FREE_PTR(qctl_20); out_quotactl_18: OBD_FREE_PTR(qctl_18); - RETURN(rc); + return rc; } #else #warning "remove old LL_IOC_QUOTACTL_18 compatibility code" @@ -1730,7 +1711,7 @@ out_rmdir: OBD_ALLOC_PTR(qctl); if (!qctl) - RETURN(-ENOMEM); + return -ENOMEM; if (copy_from_user(qctl, (void *)arg, sizeof(*qctl))) GOTO(out_quotactl, rc = -EFAULT); @@ -1742,13 +1723,13 @@ out_rmdir: out_quotactl: OBD_FREE_PTR(qctl); - RETURN(rc); + return rc; } case OBD_IOC_GETDTNAME: case OBD_IOC_GETMDNAME: - RETURN(ll_get_obd_name(inode, cmd, arg)); + return ll_get_obd_name(inode, cmd, arg); case LL_IOC_FLUSHCTX: - RETURN(ll_flush_ctx(inode)); + return ll_flush_ctx(inode); #ifdef CONFIG_FS_POSIX_ACL case LL_IOC_RMTACL: { if (sbi->ll_flags & LL_SBI_RMT_CLIENT && @@ -1759,9 +1740,9 @@ out_rmdir: rc = rct_add(&sbi->ll_rct, current_pid(), arg); if (!rc) fd->fd_flags |= LL_FILE_RMTACL; - RETURN(rc); + return rc; } else - RETURN(0); + return 0; } #endif case LL_IOC_GETOBDCOUNT: { @@ -1769,7 +1750,7 @@ out_rmdir: struct obd_export *exp; if (copy_from_user(&count, (int *)arg, sizeof(int))) - RETURN(-EFAULT); + return -EFAULT; /* get ost count when count is zero, get mdt count otherwise */ exp = count ? sbi->ll_md_exp : sbi->ll_dt_exp; @@ -1778,41 +1759,41 @@ out_rmdir: KEY_TGT_COUNT, &vallen, &count, NULL); if (rc) { CERROR("get target count failed: %d\n", rc); - RETURN(rc); + return rc; } if (copy_to_user((int *)arg, &count, sizeof(int))) - RETURN(-EFAULT); + return -EFAULT; - RETURN(0); + return 0; } case LL_IOC_PATH2FID: if (copy_to_user((void *)arg, ll_inode2fid(inode), sizeof(struct lu_fid))) - RETURN(-EFAULT); - RETURN(0); + return -EFAULT; + return 0; case LL_IOC_GET_CONNECT_FLAGS: { - RETURN(obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void*)arg)); + return obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void*)arg); } case OBD_IOC_CHANGELOG_SEND: case OBD_IOC_CHANGELOG_CLEAR: rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg, sizeof(struct ioc_changelog)); - RETURN(rc); + return rc; case OBD_IOC_FID2PATH: - RETURN(ll_fid2path(inode, (void *)arg)); + return ll_fid2path(inode, (void *)arg); case LL_IOC_HSM_REQUEST: { struct hsm_user_request *hur; int totalsize; OBD_ALLOC_PTR(hur); if (hur == NULL) - RETURN(-ENOMEM); + return -ENOMEM; /* We don't know the true size yet; copy the fixed-size part */ if (copy_from_user(hur, (void *)arg, sizeof(*hur))) { OBD_FREE_PTR(hur); - RETURN(-EFAULT); + return -EFAULT; } /* Compute the whole struct size */ @@ -1820,12 +1801,12 @@ out_rmdir: OBD_FREE_PTR(hur); OBD_ALLOC_LARGE(hur, totalsize); if (hur == NULL) - RETURN(-ENOMEM); + return -ENOMEM; /* Copy the whole struct */ if (copy_from_user(hur, (void *)arg, totalsize)) { OBD_FREE_LARGE(hur, totalsize); - RETURN(-EFAULT); + return -EFAULT; } rc = obd_iocontrol(cmd, ll_i2mdexp(inode), totalsize, @@ -1833,14 +1814,14 @@ out_rmdir: OBD_FREE_LARGE(hur, totalsize); - RETURN(rc); + return rc; } case LL_IOC_HSM_PROGRESS: { struct hsm_progress_kernel hpk; struct hsm_progress hp; if (copy_from_user(&hp, (void *)arg, sizeof(hp))) - RETURN(-EFAULT); + return -EFAULT; hpk.hpk_fid = hp.hp_fid; hpk.hpk_cookie = hp.hp_cookie; @@ -1853,12 +1834,12 @@ out_rmdir: * reported to Lustre root */ rc = obd_iocontrol(cmd, sbi->ll_md_exp, sizeof(hpk), &hpk, NULL); - RETURN(rc); + return rc; } case LL_IOC_HSM_CT_START: rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg, sizeof(struct lustre_kernelcomm)); - RETURN(rc); + return rc; case LL_IOC_HSM_COPY_START: { struct hsm_copy *copy; @@ -1866,10 +1847,10 @@ out_rmdir: OBD_ALLOC_PTR(copy); if (copy == NULL) - RETURN(-ENOMEM); + return -ENOMEM; if (copy_from_user(copy, (char *)arg, sizeof(*copy))) { OBD_FREE_PTR(copy); - RETURN(-EFAULT); + return -EFAULT; } rc = ll_ioc_copy_start(inode->i_sb, copy); @@ -1877,7 +1858,7 @@ out_rmdir: rc = -EFAULT; OBD_FREE_PTR(copy); - RETURN(rc); + return rc; } case LL_IOC_HSM_COPY_END: { struct hsm_copy *copy; @@ -1885,10 +1866,10 @@ out_rmdir: OBD_ALLOC_PTR(copy); if (copy == NULL) - RETURN(-ENOMEM); + return -ENOMEM; if (copy_from_user(copy, (char *)arg, sizeof(*copy))) { OBD_FREE_PTR(copy); - RETURN(-EFAULT); + return -EFAULT; } rc = ll_ioc_copy_end(inode->i_sb, copy); @@ -1896,11 +1877,10 @@ out_rmdir: rc = -EFAULT; OBD_FREE_PTR(copy); - RETURN(rc); + return rc; } default: - RETURN(obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL, - (void *)arg)); + return obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL, (void *)arg); } } @@ -1911,7 +1891,6 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin) struct ll_sb_info *sbi = ll_i2sbi(inode); int api32 = ll_need_32bit_api(sbi); loff_t ret = -EINVAL; - ENTRY; mutex_lock(&inode->i_mutex); switch (origin) { @@ -1957,14 +1936,12 @@ out: int ll_dir_open(struct inode *inode, struct file *file) { - ENTRY; - RETURN(ll_file_open(inode, file)); + return ll_file_open(inode, file); } int ll_dir_release(struct inode *inode, struct file *file) { - ENTRY; - RETURN(ll_file_release(inode, file)); + return ll_file_release(inode, file); } struct file_operations ll_dir_operations = { @@ -1972,7 +1949,7 @@ struct file_operations ll_dir_operations = { .open = ll_dir_open, .release = ll_dir_release, .read = generic_read_dir, - .readdir = ll_readdir, + .iterate = ll_readdir, .unlocked_ioctl = ll_dir_ioctl, .fsync = ll_fsync, }; |