From a3a6d677f39160a9c7c714b4fa9248ce78a1dd2a Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 27 Oct 2014 17:26:04 -0500 Subject: [PATCH] LU-5814 lov: remove unused {get,set}_info handlers In LOV and OSC remove handlers for the obsolete get and set info keys: KEY_CAPA_KEY, KEY_CONNECT_FLAG, KEY_EVICT_BY_NID, KEY_LAST_ID, KEY_LOCK_TO_STRIPE, KEY_MDS_CONN, KEY_NEXT_ID. Signed-off-by: John L. Hammond Change-Id: Iab1adaffc4ea860ea6ce2a2614b5ab6f6444e34b Reviewed-on: http://review.whamcloud.com/12445 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Tested-by: Maloo --- lustre/include/obd.h | 4 -- lustre/lov/lov_obd.c | 147 +++++------------------------------------------ lustre/osc/osc_request.c | 43 +------------- 3 files changed, 15 insertions(+), 179 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 6488d08..5d1dde4 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -743,22 +743,18 @@ enum obd_cleanup_stage { #define KEY_INTERMDS "inter_mds" #define KEY_LAST_ID "last_id" #define KEY_LAST_FID "last_fid" -#define KEY_LOCK_TO_STRIPE "lock_to_stripe" #define KEY_LOVDESC "lovdesc" #define KEY_MAX_EASIZE "max_easize" #define KEY_DEFAULT_EASIZE "default_easize" #define KEY_MAX_COOKIESIZE "max_cookiesize" #define KEY_DEFAULT_COOKIESIZE "default_cookiesize" -#define KEY_MDS_CONN "mds_conn" #define KEY_MGSSEC "mgssec" -#define KEY_NEXT_ID "next_id" #define KEY_READ_ONLY "read-only" #define KEY_REGISTER_TARGET "register_target" #define KEY_SET_FS "set_fs" #define KEY_TGT_COUNT "tgt_count" /* KEY_SET_INFO in lustre_idl.h */ #define KEY_SPTLRPC_CONF "sptlrpc_conf" -#define KEY_CONNECT_FLAG "connect_flags" #define KEY_CACHE_SET "cache_set" #define KEY_CACHE_LRU_SHRINK "cache_lru_shrink" diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index b5df73c..9977f64 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1973,12 +1973,12 @@ out: } static int lov_get_info(const struct lu_env *env, struct obd_export *exp, - __u32 keylen, void *key, __u32 *vallen, void *val, - struct lov_stripe_md *lsm) + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm) { - struct obd_device *obddev = class_exp2obd(exp); - struct lov_obd *lov = &obddev->u.lov; - int i, rc; + struct obd_device *obddev = class_exp2obd(exp); + struct lov_obd *lov = &obddev->u.lov; + int rc; ENTRY; if (!vallen || !val) @@ -1986,57 +1986,7 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp, obd_getref(obddev); - if (KEY_IS(KEY_LOCK_TO_STRIPE)) { - struct { - char name[16]; - struct ldlm_lock *lock; - } *data = key; - struct ldlm_res_id *res_id = &data->lock->l_resource->lr_name; - struct lov_oinfo *loi; - __u32 *stripe = val; - - if (*vallen < sizeof(*stripe)) - GOTO(out, rc = -EFAULT); - *vallen = sizeof(*stripe); - - /* XXX This is another one of those bits that will need to - * change if we ever actually support nested LOVs. It uses - * the lock's export to find out which stripe it is. */ - /* XXX - it's assumed all the locks for deleted OSTs have - * been cancelled. Also, the export for deleted OSTs will - * be NULL and won't match the lock's export. */ - for (i = 0; i < lsm->lsm_stripe_count; i++) { - loi = lsm->lsm_oinfo[i]; - if (lov_oinfo_is_dummy(loi)) - continue; - - if (!lov->lov_tgts[loi->loi_ost_idx]) - continue; - if (lov->lov_tgts[loi->loi_ost_idx]->ltd_exp == - data->lock->l_conn_export && - ostid_res_name_eq(&loi->loi_oi, res_id)) { - *stripe = i; - GOTO(out, rc = 0); - } - } - LDLM_ERROR(data->lock, "lock on inode without such object"); - dump_lsm(D_ERROR, lsm); - GOTO(out, rc = -ENXIO); - } else if (KEY_IS(KEY_LAST_ID)) { - struct obd_id_info *info = val; - __u32 size = sizeof(obd_id); - struct lov_tgt_desc *tgt; - - LASSERT(*vallen == sizeof(struct obd_id_info)); - tgt = lov->lov_tgts[info->idx]; - - if (!tgt || !tgt->ltd_active) - GOTO(out, rc = -ESRCH); - - rc = obd_get_info(env, tgt->ltd_exp, keylen, key, - &size, info->data, NULL); - GOTO(out, rc = 0); - } else if (KEY_IS(KEY_LOVDESC)) { + if (KEY_IS(KEY_LOVDESC)) { struct lov_desc *desc_ret = val; *desc_ret = lov->desc; @@ -2044,19 +1994,6 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp, } else if (KEY_IS(KEY_FIEMAP)) { rc = lov_fiemap(lov, keylen, key, vallen, val, lsm); GOTO(out, rc); - } else if (KEY_IS(KEY_CONNECT_FLAG)) { - struct lov_tgt_desc *tgt; - __u64 ost_idx = *((__u64*)val); - - LASSERT(*vallen == sizeof(__u64)); - LASSERT(ost_idx < lov->desc.ld_tgt_count); - tgt = lov->lov_tgts[ost_idx]; - - if (!tgt || !tgt->ltd_exp) - GOTO(out, rc = -ESRCH); - - *((__u64 *)val) = exp_connect_flags(tgt->ltd_exp); - GOTO(out, rc = 0); } else if (KEY_IS(KEY_TGT_COUNT)) { *((int *)val) = lov->desc.ld_tgt_count; GOTO(out, rc = 0); @@ -2078,12 +2015,10 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, obd_count count; int i, rc = 0, err; struct lov_tgt_desc *tgt; - unsigned incr, check_uuid, - do_inactive, no_set; - unsigned next_id = 0, mds_con = 0, capa = 0; + int do_inactive = 0; + int no_set = 0; ENTRY; - incr = check_uuid = do_inactive = no_set = 0; if (set == NULL) { no_set = 1; set = ptlrpc_prep_set(); @@ -2094,32 +2029,17 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, obd_getref(obddev); count = lov->desc.ld_tgt_count; - if (KEY_IS(KEY_NEXT_ID)) { - count = vallen / sizeof(struct obd_id_info); - vallen = sizeof(obd_id); - incr = sizeof(struct obd_id_info); - do_inactive = 1; - next_id = 1; - } else if (KEY_IS(KEY_CHECKSUM)) { + if (KEY_IS(KEY_CHECKSUM)) { do_inactive = 1; - } else if (KEY_IS(KEY_EVICT_BY_NID)) { - /* use defaults: do_inactive = incr = 0; */ - } else if (KEY_IS(KEY_MDS_CONN)) { - mds_con = 1; - } else if (KEY_IS(KEY_CAPA_KEY)) { - capa = 1; } else if (KEY_IS(KEY_CACHE_SET)) { LASSERT(lov->lov_cache == NULL); lov->lov_cache = val; do_inactive = 1; } - for (i = 0; i < count; i++, val = (char *)val + incr) { - if (next_id) { - tgt = lov->lov_tgts[((struct obd_id_info*)val)->idx]; - } else { - tgt = lov->lov_tgts[i]; - } + for (i = 0; i < count; i++) { + tgt = lov->lov_tgts[i]; + /* OST was disconnected */ if (!tgt || !tgt->ltd_exp) continue; @@ -2128,47 +2048,8 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp, if (!tgt->ltd_active && !do_inactive) continue; - if (mds_con) { - struct mds_group_info *mgi; - - LASSERT(vallen == sizeof(*mgi)); - mgi = (struct mds_group_info *)val; - - /* Only want a specific OSC */ - if (mgi->uuid && !obd_uuid_equals(mgi->uuid, - &tgt->ltd_uuid)) - continue; - - err = obd_set_info_async(env, tgt->ltd_exp, - keylen, key, sizeof(int), - &mgi->group, set); - } else if (next_id) { - err = obd_set_info_async(env, tgt->ltd_exp, - keylen, key, vallen, - ((struct obd_id_info*)val)->data, set); - } else if (capa) { - struct mds_capa_info *info = (struct mds_capa_info*)val; - - LASSERT(vallen == sizeof(*info)); - - /* Only want a specific OSC */ - if (info->uuid && - !obd_uuid_equals(info->uuid, &tgt->ltd_uuid)) - continue; - - err = obd_set_info_async(env, tgt->ltd_exp, keylen, - key, sizeof(*info->capa), - info->capa, set); - } else { - /* Only want a specific OSC */ - if (check_uuid && - !obd_uuid_equals(val, &tgt->ltd_uuid)) - continue; - - err = obd_set_info_async(env, tgt->ltd_exp, - keylen, key, vallen, val, set); - } - + err = obd_set_info_async(env, tgt->ltd_exp, keylen, key, + vallen, val, set); if (!rc) rc = err; } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index c708dfe..63653fa 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2646,48 +2646,7 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, if (!vallen || !val) RETURN(-EFAULT); - if (KEY_IS(KEY_LOCK_TO_STRIPE)) { - __u32 *stripe = val; - *vallen = sizeof(*stripe); - *stripe = 0; - RETURN(0); - } else if (KEY_IS(KEY_LAST_ID)) { - struct ptlrpc_request *req; - obd_id *reply; - char *tmp; - int rc; - - req = ptlrpc_request_alloc(class_exp2cliimp(exp), - &RQF_OST_GET_INFO_LAST_ID); - if (req == NULL) - RETURN(-ENOMEM); - - req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY, - RCL_CLIENT, keylen); - rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GET_INFO); - if (rc) { - ptlrpc_request_free(req); - RETURN(rc); - } - - tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY); - memcpy(tmp, key, keylen); - - req->rq_no_delay = req->rq_no_resend = 1; - ptlrpc_request_set_replen(req); - rc = ptlrpc_queue_wait(req); - if (rc) - GOTO(out, rc); - - reply = req_capsule_server_get(&req->rq_pill, &RMF_OBD_ID); - if (reply == NULL) - GOTO(out, rc = -EPROTO); - - *((obd_id *)val) = *reply; - out: - ptlrpc_req_finished(req); - RETURN(rc); - } else if (KEY_IS(KEY_FIEMAP)) { + if (KEY_IS(KEY_FIEMAP)) { struct ll_fiemap_info_key *fm_key = (struct ll_fiemap_info_key *)key; struct ldlm_res_id res_id; -- 1.8.3.1