From: John L. Hammond Date: Fri, 7 Nov 2014 15:00:09 +0000 (-0600) Subject: LU-5814 llite: remove ll_objects_destroy() X-Git-Tag: 2.6.91~63 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=be56983d01670119ed88923cc9b5c336f4552302 LU-5814 llite: remove ll_objects_destroy() Remove ll_objects_destroy(). This function is not needed for interoperability with servers of version 2.4 or higher (after lustre commit 5165cdd4). Remove the then unused function lov_destroy() and its supporting functions. Remove the lsm_destroy method of struct lsm_operations. Remove the unused struct lov_stripe_md, MD export, and capa parameters from obd_destroy() and its implementations. Signed-off-by: John L. Hammond Change-Id: If8634b3d88a660d00891219c348622ec45361316 Reviewed-on: http://review.whamcloud.com/12618 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index b938315..1dc0315 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -934,10 +934,8 @@ struct obd_ops { struct lov_mds_md *disk_src, int disk_len); int (*o_create)(const struct lu_env *env, struct obd_export *exp, struct obdo *oa, struct obd_trans_info *oti); - int (*o_destroy)(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *ea, - struct obd_trans_info *oti, struct obd_export *md_exp, - void *capa); + int (*o_destroy)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct obd_trans_info *oti); int (*o_setattr)(const struct lu_env *, struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti); int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo, @@ -1170,8 +1168,6 @@ struct md_ops { struct lsm_operations { void (*lsm_free)(struct lov_stripe_md *); - int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa, - struct obd_export *md_exp); void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, obd_off *, obd_off *); void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, obd_off *, diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 01ea331..7a76fd5 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -780,18 +780,16 @@ static inline int obd_create(const struct lu_env *env, struct obd_export *exp, } static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *obdo, struct lov_stripe_md *ea, - struct obd_trans_info *oti, - struct obd_export *md_exp, void *capa) + struct obdo *obdo, struct obd_trans_info *oti) { - int rc; - ENTRY; + int rc; + ENTRY; - EXP_CHECK_DT_OP(exp, destroy); - EXP_COUNTER_INCREMENT(exp, destroy); + EXP_CHECK_DT_OP(exp, destroy); + EXP_COUNTER_INCREMENT(exp, destroy); - rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp, capa); - RETURN(rc); + rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, oti); + RETURN(rc); } static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp, diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 612312c..eb1a85a 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -194,15 +194,6 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, spin_unlock(&lli->lli_lock); } - if (rc == 0) { - rc = ll_objects_destroy(req, inode); - if (rc) - CERROR("%s: inode "DFID - " ll_objects destroy: rc = %d\n", - ll_i2mdexp(inode)->exp_obd->obd_name, - PFID(ll_inode2fid(inode)), rc); - } - if (rc == 0 && op_data->op_bias & MDS_HSM_RELEASE) { struct mdt_body *body; body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index a3e1ff3..6fae11a 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -791,8 +791,6 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove); /* llite/namei.c */ extern const struct inode_operations ll_special_inode_operations; -int ll_objects_destroy(struct ptlrpc_request *request, - struct inode *dir); struct inode *ll_iget(struct super_block *sb, ino_t hash, struct lustre_md *lic); int ll_test_inode_by_fid(struct inode *inode, void *opaque); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 041e2e1..823fb70 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -1160,82 +1160,6 @@ int ll_rmdir_entry(struct inode *dir, char *name, int namelen) RETURN(rc); } -int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) -{ - struct mdt_body *body; - struct lov_mds_md *eadata; - struct lov_stripe_md *lsm = NULL; - struct obd_trans_info oti = { 0 }; - struct obdo *oa; - struct obd_capa *oc = NULL; - int rc; - ENTRY; - - /* req is swabbed so this is safe */ - body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); - if (!(body->mbo_valid & OBD_MD_FLEASIZE)) - RETURN(0); - - if (body->mbo_eadatasize == 0) { - CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n"); - GOTO(out, rc = -EPROTO); - } - - /* The MDS sent back the EA because we unlinked the last reference - * to this file. Use this EA to unlink the objects on the OST. - * It's opaque so we don't swab here; we leave it to obd_unpackmd() to - * check it is complete and sensible. */ - eadata = req_capsule_server_sized_get(&request->rq_pill, &RMF_MDT_MD, - body->mbo_eadatasize); - LASSERT(eadata != NULL); - - rc = obd_unpackmd(ll_i2dtexp(dir), &lsm, eadata, body->mbo_eadatasize); - if (rc < 0) { - CERROR("obd_unpackmd: %d\n", rc); - GOTO(out, rc); - } - LASSERT(rc >= sizeof(*lsm)); - - OBDO_ALLOC(oa); - if (oa == NULL) - GOTO(out_free_memmd, rc = -ENOMEM); - - oa->o_oi = lsm->lsm_oi; - oa->o_mode = body->mbo_mode & S_IFMT; - oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP; - - if (body->mbo_valid & OBD_MD_FLCOOKIE) { - oa->o_valid |= OBD_MD_FLCOOKIE; - oti.oti_logcookies = - req_capsule_server_sized_get(&request->rq_pill, - &RMF_LOGCOOKIES, - sizeof(struct llog_cookie) * - lsm->lsm_stripe_count); - if (oti.oti_logcookies == NULL) { - oa->o_valid &= ~OBD_MD_FLCOOKIE; - body->mbo_valid &= ~OBD_MD_FLCOOKIE; - } - } - - if (body->mbo_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, - ll_i2mdexp(dir), oc); - capa_put(oc); - if (rc) - CERROR("obd destroy objid "DOSTID" error %d\n", - POSTID(&lsm->lsm_oi), rc); -out_free_memmd: - obd_free_memmd(ll_i2dtexp(dir), &lsm); - OBDO_FREE(oa); -out: - return rc; -} - /* ll_unlink() doesn't update the inode with the new link count. * Instead, ll_ddelete() and ll_d_iput() will update it based upon if * there is any lock existing. They will recycle dentries and inodes @@ -1274,7 +1198,6 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild) ll_update_times(request, dir); ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_UNLINK, 1); - rc = ll_objects_destroy(request, dir); out: ptlrpc_req_finished(request); RETURN(rc); @@ -1318,7 +1241,6 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, ll_update_times(request, src); ll_update_times(request, tgt); ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); - err = ll_objects_destroy(request, src); } ptlrpc_req_finished(request); diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index d55425a..075c491 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -152,12 +152,6 @@ lsm_stripe_by_offset_plain(struct lov_stripe_md *lsm, int *stripeno, *swidth = (obd_off)lsm->lsm_stripe_size * lsm->lsm_stripe_count; } -static int lsm_destroy_plain(struct lov_stripe_md *lsm, struct obdo *oa, - struct obd_export *md_exp) -{ - return 0; -} - /* Find minimum stripe maxbytes value. For inactive or * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. */ static void lov_tgt_maxbytes(struct lov_tgt_desc *tgt, __u64 *stripe_maxbytes) @@ -250,7 +244,6 @@ int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, const struct lsm_operations lsm_v1_ops = { .lsm_free = lsm_free_plain, - .lsm_destroy = lsm_destroy_plain, .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_lmm_verify = lsm_lmm_verify_v1, @@ -340,7 +333,6 @@ int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, const struct lsm_operations lsm_v3_ops = { .lsm_free = lsm_free_plain, - .lsm_destroy = lsm_destroy_plain, .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_lmm_verify = lsm_lmm_verify_v3, diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index 6a222dd..9509ef6 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -156,11 +156,6 @@ int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx); int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, struct lov_request_set **reqset); int lov_fini_getattr_set(struct lov_request_set *set); -int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, - struct obdo *src_oa, struct lov_stripe_md *lsm, - struct obd_trans_info *oti, - struct lov_request_set **reqset); -int lov_fini_destroy_set(struct lov_request_set *set); int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti, struct lov_request_set **reqset); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 9977f64..2ef90db 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1025,65 +1025,6 @@ do { "%p->lsm_magic=%x\n", (lsmp), (lsmp)->lsm_magic); \ } while (0) -static int lov_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *lsm, - struct obd_trans_info *oti, struct obd_export *md_exp, - void *capa) -{ - struct lov_request_set *set; - struct obd_info oinfo; - struct lov_request *req; - struct list_head *pos; - struct lov_obd *lov; - int rc = 0, err = 0; - ENTRY; - - ASSERT_LSM_MAGIC(lsm); - - if (!exp || !exp->exp_obd) - RETURN(-ENODEV); - - if (oa->o_valid & OBD_MD_FLCOOKIE) { - LASSERT(oti); - LASSERT(oti->oti_logcookies); - } - - lov = &exp->exp_obd->u.lov; - obd_getref(exp->exp_obd); - rc = lov_prep_destroy_set(exp, &oinfo, oa, lsm, oti, &set); - if (rc) - GOTO(out, rc); - - list_for_each(pos, &set->set_list) { - req = list_entry(pos, struct lov_request, rq_link); - - if (oa->o_valid & OBD_MD_FLCOOKIE) - oti->oti_logcookies = set->set_cookies + req->rq_stripe; - - err = obd_destroy(env, lov->lov_tgts[req->rq_idx]->ltd_exp, - req->rq_oi.oi_oa, NULL, oti, NULL, capa); - err = lov_update_common_set(set, req, err); - if (err) { - CERROR("%s: destroying objid "DOSTID" subobj " - DOSTID" on OST idx %d: rc = %d\n", - exp->exp_obd->obd_name, POSTID(&oa->o_oi), - POSTID(&req->rq_oi.oi_oa->o_oi), - req->rq_idx, err); - if (!rc) - rc = err; - } - } - - if (rc == 0) { - LASSERT(lsm_op_find(lsm->lsm_magic) != NULL); - rc = lsm_op_find(lsm->lsm_magic)->lsm_destroy(lsm, oa, md_exp); - } - err = lov_fini_destroy_set(set); -out: - obd_putref(exp->exp_obd); - RETURN(rc ? rc : err); -} - static int lov_getattr_interpret(struct ptlrpc_request_set *rqset, void *data, int rc) { @@ -2199,7 +2140,6 @@ static struct obd_ops lov_obd_ops = { .o_statfs_async = lov_statfs_async, .o_packmd = lov_packmd, .o_unpackmd = lov_unpackmd, - .o_destroy = lov_destroy, .o_getattr_async = lov_getattr_async, .o_setattr_async = lov_setattr_async, .o_change_cbdata = lov_change_cbdata, diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 1dc62e4..a4dd6a0 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -326,82 +326,6 @@ out_set: RETURN(rc); } -int lov_fini_destroy_set(struct lov_request_set *set) -{ - ENTRY; - - if (set == NULL) - RETURN(0); - LASSERT(set->set_exp); - if (atomic_read(&set->set_completes)) { - /* FIXME update qos data here */ - } - - lov_put_reqset(set); - - RETURN(0); -} - -int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, - struct obdo *src_oa, struct lov_stripe_md *lsm, - struct obd_trans_info *oti, - struct lov_request_set **reqset) -{ - struct lov_request_set *set; - struct lov_obd *lov = &exp->exp_obd->u.lov; - int rc = 0, i; - ENTRY; - - OBD_ALLOC(set, sizeof(*set)); - if (set == NULL) - RETURN(-ENOMEM); - lov_init_set(set); - - set->set_exp = exp; - set->set_oi = oinfo; - set->set_oi->oi_md = lsm; - set->set_oi->oi_oa = src_oa; - if (oti != NULL && src_oa->o_valid & OBD_MD_FLCOOKIE) - set->set_cookies = oti->oti_logcookies; - - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *loi; - struct lov_request *req; - - loi = lsm->lsm_oinfo[i]; - if (lov_oinfo_is_dummy(loi)) - continue; - - if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) { - CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx); - continue; - } - - OBD_ALLOC(req, sizeof(*req)); - if (req == NULL) - GOTO(out_set, rc = -ENOMEM); - - req->rq_stripe = i; - req->rq_idx = loi->loi_ost_idx; - - OBDO_ALLOC(req->rq_oi.oi_oa); - if (req->rq_oi.oi_oa == NULL) { - OBD_FREE(req, sizeof(*req)); - GOTO(out_set, rc = -ENOMEM); - } - memcpy(req->rq_oi.oi_oa, src_oa, sizeof(*req->rq_oi.oi_oa)); - req->rq_oi.oi_oa->o_oi = loi->loi_oi; - lov_set_add_req(req, set); - } - if (!set->set_count) - GOTO(out_set, rc = -EIO); - *reqset = set; - RETURN(rc); -out_set: - lov_fini_destroy_set(set); - RETURN(rc); -} - int lov_fini_setattr_set(struct lov_request_set *set) { int rc = 0; diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 18dc6a4..db3fa79 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -144,9 +144,7 @@ static int echo_create(const struct lu_env *env, struct obd_export *exp, } static int echo_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *ea, - struct obd_trans_info *oti, struct obd_export *md_exp, - void *capa) + struct obdo *oa, struct obd_trans_info *oti) { struct obd_device *obd = class_exp2obd(exp); diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index cc4feef..30c2195 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2078,7 +2078,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, failed: if (created && rc != 0) - obd_destroy(env, ec->ec_exp, oa, NULL, oti, NULL, NULL); + obd_destroy(env, ec->ec_exp, oa, oti); if (rc != 0) CERROR("create object failed with: rc = %d\n", rc); @@ -2576,8 +2576,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, rc = echo_get_object(&eco, ed, oa); if (rc == 0) { - rc = obd_destroy(env, ec->ec_exp, oa, NULL, - &dummy_oti, NULL, NULL); + rc = obd_destroy(env, ec->ec_exp, oa, &dummy_oti); if (rc == 0) eco->eo_deleted = 1; echo_put_object(eco); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index dfd190f..5656ae9 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -1039,10 +1039,7 @@ int ofd_destroy_by_fid(const struct lu_env *env, struct ofd_device *ofd, * \param[in] env execution environment * \param[in] exp OBD export of OFD device * \param[in] oa obdo structure with FID - * \param[in] md not used in OFD * \param[in] oti not used in OFD - * \param[in] md_exp not used in OFD - * \param[in] capa not used in OFD * * Note: this is OBD API method which is common API for server OBDs and * client OBDs. Thus some parameters used in client OBDs may not be used @@ -1052,9 +1049,7 @@ int ofd_destroy_by_fid(const struct lu_env *env, struct ofd_device *ofd, * \retval negative value on error */ int ofd_echo_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *md, - struct obd_trans_info *oti, struct obd_export *md_exp, - void *capa) + struct obdo *oa, struct obd_trans_info *oti) { struct ofd_device *ofd = ofd_exp(exp); struct lu_fid *fid = &oa->o_oi.oi_fid; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 3eb7c7c..20bec06 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -623,9 +623,7 @@ static int osc_can_send_destroy(struct client_obd *cli) * it will retrieve the llog unlink logs and then sends the log cancellation * cookies to the MDS after committing destroy transactions. */ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *ea, - struct obd_trans_info *oti, struct obd_export *md_export, - void *capa) + struct obdo *oa, struct obd_trans_info *oti) { struct client_obd *cli = &exp->exp_obd->u.cli; struct ptlrpc_request *req; @@ -648,7 +646,7 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, RETURN(-ENOMEM); } - osc_set_capa_size(req, &RMF_CAPA1, (struct obd_capa *)capa); + osc_set_capa_size(req, &RMF_CAPA1, NULL); rc = ldlm_prep_elc_req(exp, req, LUSTRE_OST_VERSION, OST_DESTROY, 0, &cancels, count); if (rc) { @@ -665,7 +663,6 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, LASSERT(body); lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, oa); - osc_pack_capa(req, body, (struct obd_capa *)capa); ptlrpc_request_set_replen(req); /* If osc_destory is for destroying the unlink orphan,