From: alex Date: Sat, 24 Sep 2005 01:23:23 +0000 (+0000) Subject: - minor optimization to avoid extra expenses related to OST A/M/D in the X-Git-Tag: v1_7_100~605 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e687a7c8b21be6f0b5156f071334d66670b7aeb9 - minor optimization to avoid extra expenses related to OST A/M/D in the path of LOV EA revalidation --- diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 25fad02..543f539 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -179,7 +179,7 @@ int mds_dt_update_config(struct obd_device *obd, int transno); int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode, struct lov_mds_md *lmm, int lmm_size); int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry, - struct lustre_msg *msg, int offset); + struct lustre_msg *msg, int offset, int *changed); void mds_dt_update_objids(struct obd_device *obd, obd_id *ids); void mds_dt_save_objids(struct obd_device *obd, obd_id *ids); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index c69e8b7..6586f6d 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -932,7 +932,7 @@ conv_end: /* Must be called with i_sem held */ int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry, - struct lustre_msg *msg, int offset) + struct lustre_msg *msg, int offset, int *changed) { struct mds_obd *mds = &obd->u.mds; struct obd_export *dt_exp = mds->mds_dt_exp; @@ -948,6 +948,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry, void *handle; ENTRY; + *changed = 0; LASSERT(down_trylock(&inode->i_sem) != 0); ll_id2str(idname, inode->i_ino, inode->i_generation); @@ -998,6 +999,7 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct dentry *dentry, GOTO(out_oa, rc); } + *changed = 1; rc = obd_packmd(dt_exp, &lmm, lsm); if (rc < 0) GOTO(out_oa, rc); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index beda3a3..c411f71 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -766,16 +766,21 @@ static int mds_finish_open(struct ptlrpc_request *req, struct dentry *dchild, if (S_ISREG(dchild->d_inode->i_mode) && (body->valid & OBD_MD_FLEASIZE)) { - rc = mds_revalidate_lov_ea(obd,dchild,req->rq_repmsg,2); + int changed; + rc = mds_revalidate_lov_ea(obd, dchild, + req->rq_repmsg, 2, + &changed); if (!rc) { rc = mds_pack_md(obd, req->rq_repmsg, 2, body, dchild->d_inode, 0, 0); /* after ost add/delete, lov ea can change * along with size/blocks, which we have * to update as well */ - body->size = dchild->d_inode->i_size; - body->blocks = dchild->d_inode->i_blocks; - *cancel_update_lock = 1; + if (changed) { + body->size = dchild->d_inode->i_size; + body->blocks = dchild->d_inode->i_blocks; + *cancel_update_lock = 1; + } } if (rc) { up(&dchild->d_inode->i_sem);