Whamcloud - gitweb
b=6358
authoralex <alex>
Thu, 19 May 2005 21:14:53 +0000 (21:14 +0000)
committeralex <alex>
Thu, 19 May 2005 21:14:53 +0000 (21:14 +0000)
 - simplest mkdir placement to test the idea on mountain

lustre/mds/mds_internal.h
lustre/mds/mds_lmv.c
lustre/mds/mds_reint.c

index 0aac782..728e152 100644 (file)
@@ -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_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 *,
 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 *,
index c99a387..8e7ba8b 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/lustre_lib.h>
 #include <linux/lustre_fsfilt.h>
 #include <linux/lustre_lite.h>
 #include <linux/lustre_lib.h>
 #include <linux/lustre_fsfilt.h>
 #include <linux/lustre_lite.h>
+#include <asm/div64.h>
 
 #include "mds_internal.h"
 
 
 #include "mds_internal.h"
 
@@ -915,14 +916,28 @@ int mds_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
         RETURN(rc);
 }
 
         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 mds_obd *mds = &obd->u.mds;
+        struct lmv_obd *lmv;
         int i = mds->mds_num;
         int i = mds->mds_num;
-
+        char peer_str[PTL_NALFMT_SIZE];
         if (flags & REC_REINT_CREATE) { 
                 i = mds->mds_num;
         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);
         } 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);
index 5460124..355eede 100644 (file)
@@ -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, 
                  * 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);
                 if (i == mds->mds_num) {
                         /* inode will be created locally */
                         handle = fsfilt_start(obd, dir, FSFILT_OP_MKDIR, NULL);