From 3151aa574e2c9bd3343dad11577cba3c55c16dca Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Fri, 7 Nov 2014 17:50:15 +0800 Subject: [PATCH] LU-5823 clio: remove IOC_LOV_GETINFO * In cb_find_init() (lfs find) use some variant of stat() to get file size and times. * Remove the then unused IOC_LOV_GETINFO ioctl. * Remove ll_glimpse_ioctl() and ll_lsm_getattr(). * Remove the OBD API method obd_getattr_async(). Signed-off-by: Bobi Jam Signed-off-by: John L. Hammond Change-Id: I8fb6b69b1c94f0522a1405f1105ab0b7a2041601 Reviewed-on: http://review.whamcloud.com/12748 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- lustre/include/lustre/lustre_user.h | 4 +- lustre/include/obd.h | 2 - lustre/include/obd_class.h | 14 ------- lustre/llite/dir.c | 66 ------------------------------- lustre/llite/file.c | 70 --------------------------------- lustre/llite/llite_internal.h | 2 - lustre/lov/lov_obd.c | 60 ---------------------------- lustre/obdclass/lprocfs_status_server.c | 1 - lustre/osc/osc_request.c | 33 ---------------- lustre/utils/liblustreapi.c | 11 +++--- 10 files changed, 8 insertions(+), 255 deletions(-) diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 060ff29..a40a52a 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -66,11 +66,13 @@ typedef struct stat lstat_t; # define lstat_f lstat # define fstat_f fstat +# define fstatat_f fstatat # define HAVE_LOV_USER_MDS_DATA #elif defined(__USE_LARGEFILE64) || defined(__KERNEL__) typedef struct stat64 lstat_t; # define lstat_f lstat64 # define fstat_f fstat64 +# define fstatat_f fstatat64 # define HAVE_LOV_USER_MDS_DATA #endif @@ -244,7 +246,7 @@ struct ost_id { /* LL_IOC_POLL_QUOTACHECK 161 OBD_IOC_POLL_QUOTACHECK */ /* LL_IOC_QUOTACTL 162 OBD_IOC_QUOTACTL */ #define IOC_OBD_STATFS _IOWR('f', 164, struct obd_statfs *) -#define IOC_LOV_GETINFO _IOWR('f', 165, struct lov_user_mds_data *) +/* IOC_LOV_GETINFO 165 obsolete */ #define LL_IOC_FLUSHCTX _IOW ('f', 166, long) #define LL_IOC_RMTACL _IOW ('f', 167, long) #define LL_IOC_GETOBDCOUNT _IOR ('f', 168, long) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index f65f804..596e0ef 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -962,8 +962,6 @@ struct obd_ops { struct ptlrpc_request_set *rqset); int (*o_getattr)(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo); - int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo, - struct ptlrpc_request_set *set); int (*o_preprw)(const struct lu_env *env, int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *remote, diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 5faf160..b3ccb08 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -803,20 +803,6 @@ static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp, RETURN(rc); } -static inline int obd_getattr_async(struct obd_export *exp, - struct obd_info *oinfo, - struct ptlrpc_request_set *set) -{ - int rc; - ENTRY; - - EXP_CHECK_DT_OP(exp, getattr_async); - EXP_COUNTER_INCREMENT(exp, getattr_async); - - rc = OBP(exp->exp_obd, getattr_async)(exp, oinfo, set); - RETURN(rc); -} - static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 440c711..e20ffd7 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -1397,72 +1397,6 @@ out_rmdir: ll_putname(filename); return rc; } - case IOC_LOV_GETINFO: { - struct lov_user_mds_data __user *lumd; - struct lov_stripe_md *lsm; - struct lov_user_md __user *lum; - struct lov_mds_md *lmm; - int lmmsize; - lstat_t st; - - lumd = (struct lov_user_mds_data __user *)arg; - lum = &lumd->lmd_lmm; - - rc = ll_get_max_mdsize(sbi, &lmmsize); - if (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); - - switch (lmm->lmm_magic) { - case LOV_USER_MAGIC_V1: - if (LOV_USER_MAGIC_V1 == cpu_to_le32(LOV_USER_MAGIC_V1)) - break; - /* swab objects first so that stripes num will be sane */ - lustre_swab_lov_user_md_objects( - ((struct lov_user_md_v1 *)lmm)->lmm_objects, - ((struct lov_user_md_v1 *)lmm)->lmm_stripe_count); - lustre_swab_lov_user_md_v1((struct lov_user_md_v1 *)lmm); - break; - case LOV_USER_MAGIC_V3: - if (LOV_USER_MAGIC_V3 == cpu_to_le32(LOV_USER_MAGIC_V3)) - break; - /* swab objects first so that stripes num will be sane */ - lustre_swab_lov_user_md_objects( - ((struct lov_user_md_v3 *)lmm)->lmm_objects, - ((struct lov_user_md_v3 *)lmm)->lmm_stripe_count); - lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lmm); - break; - default: - GOTO(free_lmm, rc = -EINVAL); - } - - rc = obd_unpackmd(sbi->ll_dt_exp, &lsm, lmm, lmmsize); - if (rc < 0) - GOTO(free_lmm, rc = -ENOMEM); - - /* Perform glimpse_size operation. */ - memset(&st, 0, sizeof(st)); - - rc = ll_glimpse_ioctl(sbi, lsm, &st); - if (rc) - GOTO(free_lsm, rc); - - 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: - OBD_FREE_LARGE(lmm, lmmsize); - return rc; - } case OBD_IOC_QUOTACHECK: { struct obd_quotactl *oqctl; int error = 0; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index f835a85..a07e74b 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -881,59 +881,6 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, RETURN(rc); } -/* Fills the obdo with the attributes for the lsm */ -static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp, - struct obd_capa *capa, struct obdo *obdo, - int dv_flags) -{ - struct ptlrpc_request_set *set; - struct obd_info oinfo = { { { 0 } } }; - int rc; - - ENTRY; - - LASSERT(lsm != NULL); - - oinfo.oi_md = lsm; - oinfo.oi_oa = obdo; - oinfo.oi_oa->o_oi = lsm->lsm_oi; - oinfo.oi_oa->o_mode = S_IFREG; - oinfo.oi_oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | - OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | - OBD_MD_FLBLKSZ | OBD_MD_FLATIME | - OBD_MD_FLMTIME | OBD_MD_FLCTIME | - OBD_MD_FLGROUP | OBD_MD_FLDATAVERSION; - oinfo.oi_capa = capa; - if (dv_flags & (LL_DV_WR_FLUSH | LL_DV_RD_FLUSH)) { - oinfo.oi_oa->o_valid |= OBD_MD_FLFLAGS; - oinfo.oi_oa->o_flags |= OBD_FL_SRVLOCK; - if (dv_flags & LL_DV_WR_FLUSH) - oinfo.oi_oa->o_flags |= OBD_FL_FLUSH; - } - - set = ptlrpc_prep_set(); - if (set == NULL) { - CERROR("cannot allocate ptlrpc set: rc = %d\n", -ENOMEM); - rc = -ENOMEM; - } else { - rc = obd_getattr_async(exp, &oinfo, set); - if (rc == 0) - rc = ptlrpc_set_wait(set); - ptlrpc_set_destroy(set); - } - if (rc == 0) { - oinfo.oi_oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | - OBD_MD_FLATIME | OBD_MD_FLMTIME | - OBD_MD_FLCTIME | OBD_MD_FLSIZE | - OBD_MD_FLDATAVERSION | OBD_MD_FLFLAGS); - if (dv_flags & LL_DV_WR_FLUSH && - !(oinfo.oi_oa->o_valid & OBD_MD_FLFLAGS && - oinfo.oi_oa->o_flags & OBD_FL_FLUSH)) - RETURN(-ENOTSUPP); - } - RETURN(rc); -} - int ll_merge_attr(const struct lu_env *env, struct inode *inode) { struct ll_inode_info *lli = ll_i2info(inode); @@ -990,23 +937,6 @@ out_size_unlock: RETURN(rc); } -int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, - lstat_t *st) -{ - struct obdo obdo = { 0 }; - int rc; - - rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, &obdo, 0); - if (rc == 0) { - st->st_size = obdo.o_size; - st->st_blocks = obdo.o_blocks; - st->st_mtime = obdo.o_mtime; - st->st_atime = obdo.o_atime; - st->st_ctime = obdo.o_ctime; - } - return rc; -} - static bool file_is_noatime(const struct file *file) { const struct vfsmount *mnt = file->f_path.mnt; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 9ada5b1..85e3738 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -804,8 +804,6 @@ extern ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits, int ll_file_open(struct inode *inode, struct file *file); int ll_file_release(struct inode *inode, struct file *file); -int ll_glimpse_ioctl(struct ll_sb_info *sbi, - struct lov_stripe_md *lsm, lstat_t *st); int ll_release_openhandle(struct dentry *, struct lookup_intent *); int ll_md_real_close(struct inode *inode, fmode_t fmode); void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 1fd3b19..bc00c56 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1042,65 +1042,6 @@ int lov_getattr_interpret(struct ptlrpc_request_set *rqset, void *data, int rc) RETURN(rc ? rc : err); } -static int lov_getattr_async(struct obd_export *exp, struct obd_info *oinfo, - struct ptlrpc_request_set *rqset) -{ - struct lov_request_set *lovset; - struct lov_obd *lov; - struct list_head *pos; - struct lov_request *req; - int rc = 0, err; - ENTRY; - - LASSERT(oinfo); - ASSERT_LSM_MAGIC(oinfo->oi_md); - - if (!exp || !exp->exp_obd) - RETURN(-ENODEV); - - lov = &exp->exp_obd->u.lov; - - rc = lov_prep_getattr_set(exp, oinfo, &lovset); - if (rc) - RETURN(rc); - - CDEBUG(D_INFO, "objid "DOSTID": %ux%u byte stripes\n", - POSTID(&oinfo->oi_md->lsm_oi), oinfo->oi_md->lsm_stripe_count, - oinfo->oi_md->lsm_stripe_size); - - list_for_each(pos, &lovset->set_list) { - req = list_entry(pos, struct lov_request, rq_link); - - CDEBUG(D_INFO, "objid "DOSTID"[%d] has subobj "DOSTID" at idx" - "%u\n", POSTID(&oinfo->oi_oa->o_oi), req->rq_stripe, - POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx); - rc = obd_getattr_async(lov->lov_tgts[req->rq_idx]->ltd_exp, - &req->rq_oi, rqset); - if (rc) { - CERROR("%s: getattr objid "DOSTID" subobj" - DOSTID" on OST idx %d: rc = %d\n", - exp->exp_obd->obd_name, - POSTID(&oinfo->oi_oa->o_oi), - POSTID(&req->rq_oi.oi_oa->o_oi), - req->rq_idx, rc); - GOTO(out, rc); - } - } - - if (!list_empty(&rqset->set_requests)) { - LASSERT(rc == 0); - LASSERT (rqset->set_interpret == NULL); - rqset->set_interpret = lov_getattr_interpret; - rqset->set_arg = (void *)lovset; - RETURN(rc); - } -out: - if (rc) - atomic_set(&lovset->set_completes, 0); - err = lov_fini_getattr_set(lovset); - RETURN(rc ? rc : err); -} - static int lov_setattr_interpret(struct ptlrpc_request_set *rqset, void *data, int rc) { @@ -1680,7 +1621,6 @@ static struct obd_ops lov_obd_ops = { .o_statfs_async = lov_statfs_async, .o_packmd = lov_packmd, .o_unpackmd = lov_unpackmd, - .o_getattr_async = lov_getattr_async, .o_setattr_async = lov_setattr_async, .o_iocontrol = lov_iocontrol, .o_get_info = lov_get_info, diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 290e4e5..8a7341d 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -439,7 +439,6 @@ void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats) LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr); LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr_async); LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr); - LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr_async); LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw); LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw); LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 2bcc035..4e3a10c 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -164,38 +164,6 @@ out: RETURN(rc); } -static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo, - struct ptlrpc_request_set *set) -{ - struct ptlrpc_request *req; - struct osc_async_args *aa; - int rc; - ENTRY; - - req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR); - if (req == NULL) - RETURN(-ENOMEM); - - osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa); - rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR); - if (rc) { - ptlrpc_request_free(req); - RETURN(rc); - } - - osc_pack_req_body(req, oinfo); - - ptlrpc_request_set_replen(req); - req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_getattr_interpret; - - CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args)); - aa = ptlrpc_req_async_args(req); - aa->aa_oi = oinfo; - - ptlrpc_set_add_req(set, req); - RETURN(0); -} - static int osc_getattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo) { @@ -2969,7 +2937,6 @@ static struct obd_ops osc_obd_ops = { .o_create = osc_create, .o_destroy = osc_destroy, .o_getattr = osc_getattr, - .o_getattr_async = osc_getattr_async, .o_setattr = osc_setattr, .o_setattr_async = osc_setattr_async, .o_iocontrol = osc_iocontrol, diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 47ae129..fa4fe7d 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -3204,14 +3204,13 @@ obd_matches: if (param->fp_mdt_index != OBD_NOT_FOUND) print_failed_tgt(param, path, LL_STATFS_LMV); - if (S_ISDIR(st->st_mode)) + if (dir != NULL) ret = fstat_f(dirfd(dir), st); - else if (dir != NULL) - ret = ioctl(dirfd(dir), IOC_LOV_GETINFO, - (void *)param->fp_lmd); + else if (de != NULL) + ret = fstatat_f(dirfd(parent), de->d_name, st, + AT_SYMLINK_NOFOLLOW); else - ret = ioctl(dirfd(parent), IOC_LOV_GETINFO, - (void *)param->fp_lmd); + ret = lstat_f(path, st); if (ret) { if (errno == ENOENT) { -- 1.8.3.1