From: alex Date: Thu, 19 May 2005 21:14:53 +0000 (+0000) Subject: b=6358 X-Git-Tag: v1_7_100~1307 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e7ed6aca54354e2066344b50908c2a31fe4066fd b=6358 - simplest mkdir placement to test the idea on mountain --- diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 0aac782..728e152 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -250,7 +250,7 @@ int mds_md_disconnect(struct obd_device *obd, int flags); int mds_try_to_split_dir(struct obd_device *, struct dentry *, struct mea **, int, int); int mds_md_get_attr(struct obd_device *, struct inode *, struct mea **, int *); -int mds_choose_mdsnum(struct obd_device *, const char *, int, int); +int mds_choose_mdsnum(struct obd_device *, const char *, int, int, struct ptlrpc_peer *, struct inode *); int mds_md_postsetup(struct obd_device *); int mds_splitting_expected(struct obd_device *, struct dentry *); int mds_lock_slave_objs(struct obd_device *, struct dentry *, diff --git a/lustre/mds/mds_lmv.c b/lustre/mds/mds_lmv.c index c99a387..8e7ba8b 100644 --- a/lustre/mds/mds_lmv.c +++ b/lustre/mds/mds_lmv.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "mds_internal.h" @@ -915,14 +916,28 @@ int mds_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, RETURN(rc); } -int mds_choose_mdsnum(struct obd_device *obd, const char *name, int len, int flags) +int mds_choose_mdsnum(struct obd_device *obd, const char *name, int len, int flags, + struct ptlrpc_peer *peer, struct inode *parent) { - struct lmv_obd *lmv; struct mds_obd *mds = &obd->u.mds; + struct lmv_obd *lmv; int i = mds->mds_num; - + char peer_str[PTL_NALFMT_SIZE]; if (flags & REC_REINT_CREATE) { i = mds->mds_num; + } else if (mds->mds_md_exp != NULL && peer != NULL) { + LASSERT(parent != NULL); + /* distribute only at root level */ + lmv = &mds->mds_md_exp->exp_obd->u.lmv; + if (parent->i_ino != id_ino(&mds->mds_rootid)) { + i = mds->mds_num; + } else { + __u64 nid = peer->peer_id.nid; + __u64 count = lmv->desc.ld_tgt_count; + i = do_div(nid, count); + CWARN("client from %s creates top dir %*s on mds #%d\n", + ptlrpc_peernid2str(peer, peer_str), len, name, i); + } } else if (mds->mds_md_exp) { lmv = &mds->mds_md_exp->exp_obd->u.lmv; i = raw_name2idx(MEA_MAGIC_LAST_CHAR, lmv->desc.ld_tgt_count, name, len); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 5460124..355eede 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -800,7 +800,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, * new directory's inode in. */ i = mds_choose_mdsnum(obd, rec->ur_name, rec->ur_namelen - 1, - rec->ur_flags); + rec->ur_flags, &req->rq_peer, dir); if (i == mds->mds_num) { /* inode will be created locally */ handle = fsfilt_start(obd, dir, FSFILT_OP_MKDIR, NULL);