From c22e84f5e56fb47b620182e69713ab2290e4d7c5 Mon Sep 17 00:00:00 2001 From: yury Date: Sun, 10 Dec 2006 10:37:31 +0000 Subject: [PATCH] - yet smaller number of fld lookups in lmv in create paths. FLD lookups number is decreased by factor 1.25. --- lustre/include/lustre/lustre_idl.h | 5 +++-- lustre/llite/llite_lib.c | 1 + lustre/lmv/lmv_intent.c | 9 +++++++-- lustre/lmv/lmv_internal.h | 7 +++---- lustre/lmv/lmv_obd.c | 23 ++++++++++++++++++----- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index d1322ae..905de8d 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -688,8 +688,9 @@ enum { }; struct md_op_data { - struct lu_fid op_fid1; - struct lu_fid op_fid2; + struct lu_fid op_fid1; /* operation fid1 (usualy parent) */ + struct lu_fid op_fid2; /* operation fid2 (usualy child) */ + mdsno_t op_mds; /* what mds server open will go to */ struct lustre_handle op_handle; __u64 op_mod_time; const char *op_name; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index e8ef86d..de96562 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2315,6 +2315,7 @@ ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, op_data->op_cap = current->cap_effective; op_data->op_bias = MDS_CHECK_SPLIT; op_data->op_opc = opc; + op_data->op_mds = 0; return op_data; } diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 21fd015..150c084 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -218,13 +218,18 @@ repeat: rpid = obj->lo_inodes[mea_idx].li_fid; - tgt_exp = lmv_get_export(lmv, obj->lo_inodes[mea_idx].li_mds); + sop_data->op_mds = obj->lo_inodes[mea_idx].li_mds; + tgt_exp = lmv_get_export(lmv, sop_data->op_mds); sop_data->op_bias &= ~MDS_CHECK_SPLIT; lmv_obj_put(obj); CDEBUG(D_OTHER, "Choose slave dir ("DFID")\n", PFID(&rpid)); } else { - tgt_exp = lmv_find_export(lmv, &rpid); + struct lmv_tgt_desc *tgt; + sop_data->op_bias |= MDS_CHECK_SPLIT; + tgt = lmv_find_target(lmv, &rpid); + sop_data->op_mds = tgt->ltd_idx; + tgt_exp = tgt->ltd_exp; } if (IS_ERR(tgt_exp)) GOTO(out_free_sop_data, rc = PTR_ERR(tgt_exp)); diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 0f13de9..7e8510f 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -207,15 +207,14 @@ lmv_find_export(struct lmv_obd *lmv, const struct lu_fid *fid) { struct lmv_tgt_desc *tgt = lmv_find_target(lmv, fid); if (IS_ERR(tgt)) - return (struct obd_export*)tgt; - else - return tgt->ltd_exp; + return (struct obd_export *)tgt; + return tgt->ltd_exp; } static inline void lmv_update_body(struct mdt_body *body, struct lmv_inode *lino) { - /* update size */ + /* update object size */ body->size += lino->li_size; } diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index e1e4e3c..2264e4c 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -806,13 +806,21 @@ static int lmv_placement_policy(struct obd_device *obd, } /* - * Allocate new fid on same mds where parent fid is located. In - * case of split dir, ->op_fid1 here will contain fid of slave - * directory object (assgined by caller). + * Allocate new fid on same mds where parent fid is located and + * where operation will be sent. In case of split dir, ->op_fid1 + * and ->op_mds here will contain fid and mds of slave directory + * object (assigned by caller). */ + *mds = op_data->op_mds; + rc = 0; + +#if 0 + /* XXX: This should be removed later wehn we sure it is not + * needed. */ rc = lmv_fld_lookup(lmv, &op_data->op_fid1, mds); if (rc) GOTO(out, rc); +#endif } else { /* * Parent directory is not split and we want to create a @@ -1340,11 +1348,16 @@ repeat: op_data->op_name, op_data->op_namelen); op_data->op_fid1 = obj->lo_inodes[mea_idx].li_fid; op_data->op_bias &= ~MDS_CHECK_SPLIT; - tgt_exp = lmv_get_export(lmv, obj->lo_inodes[mea_idx].li_mds); + op_data->op_mds = obj->lo_inodes[mea_idx].li_mds; + tgt_exp = lmv_get_export(lmv, op_data->op_mds); lmv_obj_put(obj); } else { - tgt_exp = lmv_find_export(lmv, &op_data->op_fid1); + struct lmv_tgt_desc *tgt; + + tgt = lmv_find_target(lmv, &op_data->op_fid1); op_data->op_bias |= MDS_CHECK_SPLIT; + op_data->op_mds = tgt->ltd_idx; + tgt_exp = tgt->ltd_exp; } if (IS_ERR(tgt_exp)) -- 1.8.3.1