Whamcloud - gitweb
- serialize fld reqs on client and server;
authoryury <yury>
Sun, 15 Oct 2006 17:11:20 +0000 (17:11 +0000)
committeryury <yury>
Sun, 15 Oct 2006 17:11:20 +0000 (17:11 +0000)
- cleanups about server fld client. Now it is created in cmm;
- cleanups in split code;

17 files changed:
lustre/cmm/cmm_device.c
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_object.c
lustre/cmm/cmm_split.c
lustre/cmm/mdc_device.c
lustre/fld/fld_handler.c
lustre/fld/fld_index.c
lustre/fld/fld_request.c
lustre/include/lu_object.h
lustre/include/lustre_fld.h
lustre/include/obd.h
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_obd.c
lustre/mdd/mdd_handler.c
lustre/mdt/mdt_handler.c
lustre/osd/osd_handler.c
lustre/tests/sanity-lmv.sh

index da54150..60a6cd2 100644 (file)
@@ -114,11 +114,11 @@ static int cmm_update_capa_key(const struct lu_env *env,
 }
 
 static struct md_device_operations cmm_md_ops = {
-        .mdo_statfs         = cmm_statfs,
-        .mdo_root_get       = cmm_root_get,
-        .mdo_maxsize_get    = cmm_maxsize_get,
-        .mdo_init_capa_ctxt = cmm_init_capa_ctxt,
-        .mdo_update_capa_key= cmm_update_capa_key,
+        .mdo_statfs          = cmm_statfs,
+        .mdo_root_get        = cmm_root_get,
+        .mdo_maxsize_get     = cmm_maxsize_get,
+        .mdo_init_capa_ctxt  = cmm_init_capa_ctxt,
+        .mdo_update_capa_key = cmm_update_capa_key,
 };
 
 extern struct lu_device_type mdc_device_type;
@@ -154,7 +154,6 @@ static int cmm_add_mdc(const struct lu_env *env,
         struct mdc_device *mc, *tmp;
         struct lu_fld_target target;
         struct lu_device *ld;
-        struct lu_site *ls;
         mdsno_t mdc_num;
         int rc;
         ENTRY;
@@ -179,7 +178,7 @@ static int cmm_add_mdc(const struct lu_env *env,
         ld = ldt->ldt_ops->ldto_device_alloc(env, ldt, cfg);
         ld->ld_site = cmm2lu_dev(cm)->ld_site;
 
-        rc = ldt->ldt_ops->ldto_device_init(env, ld, NULL);
+        rc = ldt->ldt_ops->ldto_device_init(env, ld, NULL, NULL);
         if (rc) {
                 ldt->ldt_ops->ldto_device_free(env, ld);
                 RETURN (rc);
@@ -206,17 +205,13 @@ static int cmm_add_mdc(const struct lu_env *env,
 
         lu_device_get(cmm2lu_dev(cm));
 
-        ls = cm->cmm_md_dev.md_lu_dev.ld_site;
-
         target.ft_srv = NULL;
         target.ft_idx = mc->mc_num;
         target.ft_exp = mc->mc_desc.cl_exp;
-
-        fld_client_add_target(ls->ls_client_fld, &target);
+        fld_client_add_target(cm->cmm_fld, &target);
         
-        /* set max md size for the mdc */
+        /* Set max md size for the mdc. */
         rc = cmm_post_init_mdc(env, cm);
-        
         RETURN(rc);
 }
 
@@ -227,7 +222,10 @@ static void cmm_device_shutdown(const struct lu_env *env,
         struct mdc_device *mc, *tmp;
         ENTRY;
 
-        /* finish all mdc devices */
+        /* Remove local target from FLD. */
+        fld_client_del_target(cm->cmm_fld, cm->cmm_local_num);
+
+        /* Finish all mdc devices. */
         spin_lock(&cm->cmm_tgt_guard);
         list_for_each_entry_safe(mc, tmp, &cm->cmm_targets, mc_linkage) {
                 struct lu_device *ld_m = mdc2lu_dev(mc);
@@ -237,6 +235,7 @@ static void cmm_device_shutdown(const struct lu_env *env,
 
         EXIT;
 }
+
 static int cmm_device_mount(const struct lu_env *env,
                             struct cmm_device *m, struct lustre_cfg *cfg)
 {
@@ -264,10 +263,23 @@ static int cmm_process_config(const struct lu_env *env,
 
         switch(cfg->lcfg_command) {
         case LCFG_ADD_MDC:
+                /* On first ADD_MDC add also local target. */
+                if (!(m->cmm_flags & CMM_INITIALIZED)) {
+                        struct lu_site *ls = cmm2lu_dev(m)->ld_site;
+                        struct lu_fld_target target;
+
+                        target.ft_srv = ls->ls_server_fld;
+                        target.ft_idx = m->cmm_local_num;
+                        target.ft_exp = NULL;
+
+                        fld_client_add_target(m->cmm_fld, &target);
+                }
                 err = cmm_add_mdc(env, m, cfg);
-                /* the first ADD_MDC can be counted as setup is finished */
-                if ((m->cmm_flags & CMM_INITIALIZED) == 0)
+                
+                /* The first ADD_MDC can be counted as setup is finished. */
+                if (!(m->cmm_flags & CMM_INITIALIZED))
                         m->cmm_flags |= CMM_INITIALIZED;
+                
                 break;
         case LCFG_SETUP:
         {
@@ -333,7 +345,6 @@ static struct lu_device *cmm_device_alloc(const struct lu_env *env,
 {
         struct lu_device  *l;
         struct cmm_device *m;
-
         ENTRY;
 
         OBD_ALLOC_PTR(m);
@@ -345,9 +356,16 @@ static struct lu_device *cmm_device_alloc(const struct lu_env *env,
                 m->cmm_md_dev.md_upcall.mu_upcall = cmm_upcall;
                l = cmm2lu_dev(m);
                 l->ld_ops = &cmm_lu_ops;
+
+                OBD_ALLOC_PTR(m->cmm_fld);
+                if (!m->cmm_fld)
+                        GOTO(out_free_cmm, l = ERR_PTR(-ENOMEM));
         }
 
-        RETURN (l);
+        RETURN(l);
+out_free_cmm:
+        OBD_FREE_PTR(m);
+        return l;
 }
 
 static void cmm_device_free(const struct lu_env *env, struct lu_device *d)
@@ -356,6 +374,10 @@ static void cmm_device_free(const struct lu_env *env, struct lu_device *d)
 
         LASSERT(m->cmm_tgt_count == 0);
         LASSERT(list_empty(&m->cmm_targets));
+        if (m->cmm_fld != NULL) {
+                OBD_FREE_PTR(m->cmm_fld);
+                m->cmm_fld = NULL;
+        }
        md_device_fini(&m->cmm_md_dev);
         OBD_FREE_PTR(m);
 }
@@ -405,10 +427,11 @@ static void cmm_type_fini(struct lu_device_type *t)
         lu_context_key_degister(&cmm_thread_key);
 }
 
-static int cmm_device_init(const struct lu_env *env,
-                           struct lu_device *d, struct lu_device *next)
+static int cmm_device_init(const struct lu_env *env, struct lu_device *d, 
+                           const char *name, struct lu_device *next)
 {
         struct cmm_device *m = lu2cmm_dev(d);
+        struct lu_site *ls;
         int err = 0;
         ENTRY;
 
@@ -417,6 +440,17 @@ static int cmm_device_init(const struct lu_env *env,
         m->cmm_tgt_count = 0;
         m->cmm_child = lu2md_dev(next);
 
+        err = fld_client_init(m->cmm_fld, name,
+                              LUSTRE_CLI_FLD_HASH_DHT);
+        if (err) {
+                CERROR("Can't init FLD, err %d\n", err);
+                RETURN(err);
+        }
+
+        /* Assign site's fld client ref, needed for asserts in osd. */
+        ls = cmm2lu_dev(m)->ld_site;
+        ls->ls_client_fld = m->cmm_fld;
+        
         RETURN(err);
 }
 
@@ -425,8 +459,10 @@ static struct lu_device *cmm_device_fini(const struct lu_env *env,
 {
        struct cmm_device *cm = lu2cmm_dev(ld);
         struct mdc_device *mc, *tmp;
+        struct lu_site *ls;
         ENTRY;
-        /* finish all mdc devices */
+
+        /* Finish all mdc devices */
         spin_lock(&cm->cmm_tgt_guard);
         list_for_each_entry_safe(mc, tmp, &cm->cmm_targets, mc_linkage) {
                 struct lu_device *ld_m = mdc2lu_dev(mc);
@@ -439,6 +475,10 @@ static struct lu_device *cmm_device_fini(const struct lu_env *env,
         }
         spin_unlock(&cm->cmm_tgt_guard);
 
+        fld_client_fini(cm->cmm_fld);
+        ls = cmm2lu_dev(cm)->ld_site;
+        ls->ls_client_fld = NULL;
+        
         RETURN (md2lu_dev(cm->cmm_child));
 }
 
index 543dd3a..156fc49 100644 (file)
@@ -41,6 +41,8 @@ struct cmm_device {
         __u32                 cmm_flags;
         /* underlaying device in MDS stack, usually MDD */
         struct md_device      *cmm_child;
+        /* FLD client to talk to FLD */
+        struct lu_client_fld *cmm_fld;
         /* other MD servers in cluster */
         mdsno_t               cmm_local_num;
         __u32                 cmm_tgt_count;
index a943593..5d90f89 100644 (file)
@@ -40,16 +40,12 @@ static int cmm_fld_lookup(struct cmm_device *cm,
                           const struct lu_fid *fid, mdsno_t *mds,
                           const struct lu_env *env)
 {
-        struct lu_site *ls;
         int rc = 0;
         ENTRY;
 
         LASSERT(fid_is_sane(fid));
 
-        ls = cm->cmm_md_dev.md_lu_dev.ld_site;
-
-        rc = fld_client_lookup(ls->ls_client_fld,
-                               fid_seq(fid), mds, env);
+        rc = fld_client_lookup(cm->cmm_fld, fid_seq(fid), mds, env);
         if (rc) {
                 CERROR("Can't find mds by seq "LPX64", rc %d\n",
                        fid_seq(fid), rc);
@@ -61,8 +57,8 @@ static int cmm_fld_lookup(struct cmm_device *cm,
                        *mds, cm->cmm_tgt_count);
                 rc = -EINVAL;
         } else {
-                CDEBUG(D_INFO, "CMM: got MDS "LPU64" for sequence: "LPU64"\n",
-                       *mds, fid_seq(fid));
+                CDEBUG(D_INFO, "CMM: got MDS "LPU64" for sequence: "
+                       LPU64"\n", *mds, fid_seq(fid));
         }
 
         RETURN (rc);
index 4ab308f..fe8c0ef 100644 (file)
@@ -138,6 +138,30 @@ static int cmm_object_create(const struct lu_env *env,
         RETURN(rc);
 }
 
+static int cmm_fid_alloc(const struct lu_env *env,
+                         struct cmm_device *cmm,
+                         struct mdc_device *mc,
+                         struct lu_fid *fid)
+{
+        int rc;
+        ENTRY;
+
+        LASSERT(cmm != NULL);
+        LASSERT(mc != NULL);
+        LASSERT(fid != NULL);
+        
+        rc = obd_fid_alloc(mc->mc_desc.cl_exp, fid, NULL);
+        if (rc > 0) {
+                /* Setup FLD for new sequence. */
+                rc = fld_client_create(cmm->cmm_fld,
+                                       fid_seq(fid),
+                                       mc->mc_num, env);
+                if (rc)
+                        CERROR("Can't create fld entry, rc %d\n", rc);
+        }
+        RETURN(rc);
+}
+
 static int cmm_slaves_create(const struct lu_env *env,
                              struct md_object *mo,
                              struct md_attr *ma)
@@ -145,13 +169,13 @@ static int cmm_slaves_create(const struct lu_env *env,
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         struct lmv_stripe_md *lmv = NULL, *slave_lmv = NULL;
         struct lu_fid *lf = cmm2fid(md2cmm_obj(mo));
-        struct  mdc_device *mc, *tmp;
+        struct mdc_device *mc, *tmp;
         int lmv_size, i = 1, rc;
         ENTRY;
 
         lmv_size = cmm_md_size(cmm->cmm_tgt_count + 1);
 
-        /* This lmv will be free after finish splitting. */
+        /* This lmv will free after finish splitting. */
         OBD_ALLOC(lmv, lmv_size);
         if (!lmv)
                 RETURN(-ENOMEM);
@@ -173,19 +197,11 @@ static int cmm_slaves_create(const struct lu_env *env,
 
         list_for_each_entry_safe(mc, tmp, &cmm->cmm_targets, mc_linkage) {
                 /* Alloc fid for slave object. */
-                rc = obd_fid_alloc(mc->mc_desc.cl_exp, &lmv->mea_ids[i], NULL);
-                if (rc > 0) {
-                        struct lu_site *ls;
-
-                        /* Setup FLD for new sequence. */
-                        ls = cmm->cmm_md_dev.md_lu_dev.ld_site;
-                        rc = fld_client_create(ls->ls_client_fld,
-                                               fid_seq(&lmv->mea_ids[i]),
-                                               mc->mc_num, env);
-                        if (rc) {
-                                CERROR("Can't create fld entry, rc %d\n", rc);
-                                GOTO(cleanup, rc);
-                        }
+                rc = cmm_fid_alloc(env, cmm, mc, &lmv->mea_ids[i]);
+                if (rc) {
+                        CERROR("Can't alloc fid for slave "LPU64", rc %d\n",
+                               mc->mc_num, rc);
+                        GOTO(cleanup, rc);
                 }
 
                 /* Create slave on remote MDT. */
index 7cd6110..49a902b 100644 (file)
@@ -210,8 +210,8 @@ void mdc_init_ea_size(const struct lu_env *env, struct mdc_device *mc,
         obd->u.cli.cl_max_mds_cookiesize = max_cookiesize;
 }
 
-static int mdc_device_init(const struct lu_env *env,
-                           struct lu_device *ld, struct lu_device *next)
+static int mdc_device_init(const struct lu_env *env, struct lu_device *ld, 
+                           const char *name, struct lu_device *next)
 {
         return 0;
 }
index 2b858e5..357a83d 100644 (file)
@@ -140,19 +140,21 @@ static int fld_server_handle(struct lu_server_fld *fld,
         int rc;
         ENTRY;
 
+        down(&fld->lsf_sem);
+        
         switch (opc) {
         case FLD_CREATE:
                 rc = fld_server_create(fld, env,
                                        mf->mf_seq, mf->mf_mds);
 
-                /* do not return -EEXIST error for resent case */
+                /* Do not return -EEXIST error for resent case */
                 if ((info->fti_flags & MSG_RESENT) && rc == -EEXIST)
                         rc = 0;
                 break;
         case FLD_DELETE:
                 rc = fld_server_delete(fld, env, mf->mf_seq);
 
-                /* do not return -ENOENT error for resent case */
+                /* Do not return -ENOENT error for resent case */
                 if ((info->fti_flags & MSG_RESENT) && rc == -ENOENT)
                         rc = 0;
                 break;
@@ -164,9 +166,13 @@ static int fld_server_handle(struct lu_server_fld *fld,
                 rc = -EINVAL;
                 break;
         }
+
+        up(&fld->lsf_sem);
+        
         CDEBUG(D_INFO|D_WARNING, "%s: FLD req handle: error %d (opc: %d, seq: "
-               LPX64", mds: "LPU64")\n", fld->lsf_name, rc,
-               opc, mf->mf_seq, mf->mf_mds);
+               LPX64", mds: "LPU64")\n", fld->lsf_name, rc, opc, mf->mf_seq,
+               mf->mf_mds);
+        
         RETURN(rc);
 
 }
@@ -231,8 +237,8 @@ static void fld_thread_info_fini(struct fld_thread_info *info)
 
 static int fld_handle(struct ptlrpc_request *req)
 {
-        const struct lu_env *env;
         struct fld_thread_info *info;
+        const struct lu_env *env;
         int rc;
 
         env = req->rq_svc_thread->t_env;
@@ -333,6 +339,8 @@ int fld_server_init(struct lu_server_fld *fld, struct dt_device *dt,
         snprintf(fld->lsf_name, sizeof(fld->lsf_name),
                  "srv-%s", prefix);
 
+        sema_init(&fld->lsf_sem, 1);
+        
         rc = fld_index_init(fld, env, dt);
         if (rc)
                 GOTO(out, rc);
index 267dbfa..f669cf6 100644 (file)
@@ -117,8 +117,8 @@ int fld_index_create(struct lu_server_fld *fld,
         if (!IS_ERR(th)) {
                 rc = dt_obj->do_index_ops->dio_insert(env, dt_obj,
                                                       fld_rec(env, mds),
-                                                      fld_key(env, seq), th,
-                                                      BYPASS_CAPA);
+                                                      fld_key(env, seq),
+                                                      th, BYPASS_CAPA);
                 dt_dev->dd_ops->dt_trans_stop(env, th);
         } else
                 rc = PTR_ERR(th);
index 159dad0..926c102 100644 (file)
@@ -305,7 +305,7 @@ int fld_client_init(struct lu_client_fld *fld,
         LASSERT(fld != NULL);
 
         snprintf(fld->lcf_name, sizeof(fld->lcf_name),
-                 "cli-%s", prefix);
+                 "cli-srv-%s", prefix);
 
         if (!hash_is_sane(hash)) {
                 CERROR("%s: Wrong hash function %#x\n",
@@ -315,6 +315,7 @@ int fld_client_init(struct lu_client_fld *fld,
 
         fld->lcf_count = 0;
         spin_lock_init(&fld->lcf_lock);
+        sema_init(&fld->lcf_sem, 1);
         fld->lcf_hash = &fld_hash[hash];
         INIT_LIST_HEAD(&fld->lcf_targets);
 
@@ -443,6 +444,8 @@ int fld_client_create(struct lu_client_fld *fld,
         int rc;
         ENTRY;
 
+        down(&fld->lcf_sem);
+        
         target = fld_client_get_target(fld, seq);
         LASSERT(target != NULL);
 
@@ -475,6 +478,8 @@ int fld_client_create(struct lu_client_fld *fld,
                 CERROR("%s: Can't create FLD entry, rc %d\n",
                        fld->lcf_name, rc);
         }
+        up(&fld->lcf_sem);
+        
         RETURN(rc);
 }
 EXPORT_SYMBOL(fld_client_create);
@@ -487,6 +492,8 @@ int fld_client_delete(struct lu_client_fld *fld, seqno_t seq,
         int rc;
         ENTRY;
 
+        down(&fld->lcf_sem);
+        
         fld_cache_delete(fld->lcf_cache, seq);
 
         target = fld_client_get_target(fld, seq);
@@ -509,6 +516,7 @@ int fld_client_delete(struct lu_client_fld *fld, seqno_t seq,
         }
 #endif
 
+        up(&fld->lcf_sem);
         RETURN(rc);
 }
 EXPORT_SYMBOL(fld_client_delete);
@@ -522,10 +530,14 @@ int fld_client_lookup(struct lu_client_fld *fld,
         int rc;
         ENTRY;
 
+        down(&fld->lcf_sem);
+        
         /* Lookup it in the cache */
         rc = fld_cache_lookup(fld->lcf_cache, seq, mds);
-        if (rc == 0)
+        if (rc == 0) {
+                up(&fld->lcf_sem);
                 RETURN(0);
+        }
 
         /* Can not find it in the cache */
         target = fld_client_get_target(fld, seq);
@@ -556,6 +568,7 @@ int fld_client_lookup(struct lu_client_fld *fld,
                  */
                 fld_cache_insert(fld->lcf_cache, seq, *mds);
         }
+        up(&fld->lcf_sem);
         RETURN(rc);
 }
 EXPORT_SYMBOL(fld_client_lookup);
index ab2de0b..83c2223 100644 (file)
@@ -303,7 +303,8 @@ struct lu_device_type_operations {
          * Initialize the devices after allocation
          */
         int  (*ldto_device_init)(const struct lu_env *env,
-                                 struct lu_device *, struct lu_device *);
+                                 struct lu_device *, const char *,
+                                 struct lu_device *);
         /*
          * Finalize device. Dual to ->ldto_device_init(). Returns pointer to
          * the next device in the stack.
index 24c06da..b36d090 100644 (file)
@@ -69,6 +69,9 @@ struct lu_server_fld {
         /* /fld file object device */
         struct dt_object        *lsf_obj;
 
+        /* Protect index modifications */
+        struct semaphore         lsf_sem;
+        
         /* fld service name in form "fld-MDTXXX" */
         char                     lsf_name[80];
 };
@@ -125,13 +128,16 @@ struct lu_client_fld {
         /* lock protecting exports list and fld_hash */
         spinlock_t               lcf_lock;
 
+        /* protect fld req + cache modification */
+        struct semaphore         lcf_sem;
+
         /* client FLD cache */
         struct fld_cache_info   *lcf_cache;
 
         /* client fld proc entry name */
         char                     lcf_name[80];
 
-        const struct lu_context       *lcf_ctx;
+        const struct lu_context *lcf_ctx;
 };
 
 int fld_query(struct com_thread_info *info);
index b3f01af..b32f33e 100644 (file)
@@ -715,7 +715,7 @@ struct lu_placement_hint {
         struct qstr   *ph_pname;
         struct lu_fid *ph_pfid;
         struct qstr   *ph_cname;
-        int           ph_opc;
+        int            ph_opc;
 };
 
 #define LUSTRE_FLD_NAME         "fld"
index b5a1a76..ddf39d7 100644 (file)
@@ -254,7 +254,7 @@ repeat:
                         it->d.lustre.it_data = 0;
                         *reqp = NULL;
 
-                        /* We shoudld reallocate the FID for the object */
+                        /* We should reallocate child FID. */
                         rc = lmv_alloc_fid_for_split(obd, &rpid, op_data,
                                                      &sop_data->fid2);
                         if (rc)
index 854ac17..a9cae35 100644 (file)
@@ -730,18 +730,20 @@ static int lmv_placement_policy(struct obd_device *obd,
 
         LASSERT(mds != NULL);
 
-        /* here are some policies to allocate new fid */
+        /* Here are some policies to allocate new fid */
         if (lmv_fids_balanced(obd)) {
-                /* allocate new fid basing on its name in the case fids are
+                /*
+                 * Allocate new fid basing on its name in the case fids are
                  * balanced, that is all sequences have more or less equal
-                 * number of objects created. */
+                 * number of objects created.
+                 */
                 if (hint->ph_cname && (hint->ph_opc == LUSTRE_OPC_MKDIR)) {
 #if 1
                         *mds = lmv_all_chars_policy(lmv->desc.ld_tgt_count,
                                                     hint->ph_cname);
                         rc = 0;
 #else
-                        /* stress policy for tests - to use non-parent MDS */
+                        /* Stress policy for tests - to use non-parent MDS */
                         LASSERT(fid_is_sane(hint->ph_pfid));
                         rc = lmv_fld_lookup(lmv, hint->ph_pfid, mds);
                         if (rc)
@@ -755,8 +757,9 @@ static int lmv_placement_policy(struct obd_device *obd,
 
                         obj = lmv_obj_grab(obd, hint->ph_pfid);
                         if (obj) {
-                                /* If the dir got split, alloc fid according
-                                 * to its hash
+                                /*
+                                 * If the dir got split, alloc fid according to
+                                 * its hash
                                  */
                                 struct lu_fid *rpid;
 
@@ -765,33 +768,35 @@ static int lmv_placement_policy(struct obd_device *obd,
                                                     hint->ph_cname->name,
                                                     hint->ph_cname->len);
                                 rpid = &obj->lo_inodes[*mds].li_fid;
+                                lmv_obj_put(obj);
+                                
                                 rc = lmv_fld_lookup(lmv, rpid, mds);
-                                if (rc) {
-                                        lmv_obj_put(obj);
+                                if (rc)
                                         GOTO(exit, rc);
-                                }
+
                                 CDEBUG(D_INODE, "The obj "DFID" has been"
                                        "split, got MDS at "LPU64" by name %s\n",
                                        PFID(hint->ph_pfid), *mds,
                                        hint->ph_cname->name);
-                                lmv_obj_put(obj);
                                 rc = 0;
                         } else {
-                                /* default policy is to use parent MDS */
+                                /* Default policy is to use parent MDS */
                                 rc = lmv_fld_lookup(lmv, hint->ph_pfid, mds);
                         }
 
                 }
         } else {
-                /* sequences among all tgts are not well balanced, allocate new
+                /*
+                 * Sequences among all tgts are not well balanced, allocate new
                  * fid taking this into account to balance them. Not implemented
-                 * yet! */
+                 * yet!
+                 */
                 *mds = 0;
                 rc = -EINVAL;
         }
 exit:
         if (rc) {
-                CERROR("cannot choose MDS, err = %d\n", rc);
+                CERROR("Can't choose MDS, err = %d\n", rc);
         } else {
                 LASSERT(*mds < lmv->desc.ld_tgt_count);
         }
index 6bbb19c..690422b 100644 (file)
@@ -824,8 +824,8 @@ static int mdd_txn_commit_cb(const struct lu_env *env,
         return 0;
 }
 
-static int mdd_device_init(const struct lu_env *env,
-                           struct lu_device *d, struct lu_device *next)
+static int mdd_device_init(const struct lu_env *env, struct lu_device *d, 
+                           const char *name, struct lu_device *next)
 {
         struct mdd_device *mdd = lu2mdd_dev(d);
         struct dt_device  *dt;
index 986bf19..91c5108 100644 (file)
@@ -2695,12 +2695,6 @@ static int mdt_fld_fini(const struct lu_env *env,
                 ls->ls_server_fld = NULL;
         }
 
-        if (ls && ls->ls_client_fld != NULL) {
-                fld_client_fini(ls->ls_client_fld);
-                OBD_FREE_PTR(ls->ls_client_fld);
-                ls->ls_client_fld = NULL;
-        }
-
         RETURN(0);
 }
 
@@ -2708,7 +2702,6 @@ static int mdt_fld_init(const struct lu_env *env,
                         const char *uuid,
                         struct mdt_device *m)
 {
-        struct lu_fld_target target;
         struct lu_site *ls;
         int rc;
         ENTRY;
@@ -2724,30 +2717,10 @@ static int mdt_fld_init(const struct lu_env *env,
         if (rc) {
                 OBD_FREE_PTR(ls->ls_server_fld);
                 ls->ls_server_fld = NULL;
+                RETURN(rc);
         }
 
-        OBD_ALLOC_PTR(ls->ls_client_fld);
-        if (!ls->ls_client_fld)
-                GOTO(out_fld_fini, rc = -ENOMEM);
-
-        rc = fld_client_init(ls->ls_client_fld, uuid,
-                             LUSTRE_CLI_FLD_HASH_DHT);
-        if (rc) {
-                CERROR("can't init FLD, err %d\n",  rc);
-                OBD_FREE_PTR(ls->ls_client_fld);
-                GOTO(out_fld_fini, rc);
-        }
-
-        target.ft_srv = ls->ls_server_fld;
-        target.ft_idx = ls->ls_node_id;
-        target.ft_exp = NULL;
-
-        fld_client_add_target(ls->ls_client_fld, &target);
-        EXIT;
-out_fld_fini:
-        if (rc)
-                mdt_fld_fini(env, m);
-        return rc;
+        RETURN(0);
 }
 
 /* device init/fini methods */
@@ -3055,6 +3028,7 @@ static struct lu_device *mdt_layer_setup(const struct lu_env *env,
                                          struct lu_device *child,
                                          struct lustre_cfg *cfg)
 {
+        const char            *dev = lustre_cfg_string(cfg, 0);
         struct obd_type       *type;
         struct lu_device_type *ldt;
         struct lu_device      *d;
@@ -3099,7 +3073,7 @@ static struct lu_device *mdt_layer_setup(const struct lu_env *env,
         d->ld_site = child->ld_site;
 
         type->typ_refcnt++;
-        rc = ldt->ldt_ops->ldto_device_init(env, d, child);
+        rc = ldt->ldt_ops->ldto_device_init(env, d, dev, child);
         if (rc) {
                 CERROR("can't init device '%s', rc %d\n", typename, rc);
                 GOTO(out_alloc, rc);
@@ -3197,6 +3171,7 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
         mdt_seq_fini(env, m);
         mdt_seq_fini_cli(m);
         mdt_fld_fini(env, m);
+        lprocfs_obd_cleanup(d->ld_obd);
 
         if (m->mdt_rootsquash_info) {
                 OBD_FREE_PTR(m->mdt_rootsquash_info);
@@ -3287,7 +3262,7 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
         LASSERT(info != NULL);
 
         obd = class_name2obd(dev);
-        LASSERT(obd);
+        LASSERT(obd != NULL);
 
         spin_lock_init(&m->mdt_transno_lock);
 
@@ -3344,17 +3319,17 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
                 GOTO(err_fini_site, rc);
         }
 
+        /* set server index */
+        LASSERT(num);
+        s->ls_node_id = simple_strtol(num, NULL, 10);
+
         /* init the stack */
         rc = mdt_stack_init(env, m, cfg);
         if (rc) {
                 CERROR("can't init device stack, rc %d\n", rc);
-                GOTO(err_fini_site, rc);
+                GOTO(err_fini_proc, rc);
         }
 
-        /* set server index */
-        LASSERT(num);
-        s->ls_node_id = simple_strtol(num, NULL, 10);
-
         rc = mdt_fld_init(env, obd->obd_name, m);
         if (rc)
                 GOTO(err_fini_stack, rc);
@@ -3439,6 +3414,8 @@ err_fini_fld:
         mdt_fld_fini(env, m);
 err_fini_stack:
         mdt_stack_fini(env, m, md2lu_dev(m->mdt_child));
+err_fini_proc:
+        lprocfs_obd_cleanup(obd);
 err_fini_site:
         lu_site_fini(s);
 err_free_site:
index 9623329..305cb01 100644 (file)
@@ -146,7 +146,8 @@ static void  osd_key_exit      (const struct lu_context *ctx,
 static int   osd_has_index     (const struct osd_object *obj);
 static void  osd_object_init0  (struct osd_object *obj);
 static int   osd_device_init   (const struct lu_env *env,
-                                struct lu_device *d, struct lu_device *);
+                                struct lu_device *d, const char *, 
+                                struct lu_device *);
 static int   osd_fid_lookup    (const struct lu_env *env,
                                 struct osd_object *obj,
                                 const struct lu_fid *fid);
@@ -2141,8 +2142,8 @@ static void osd_key_exit(const struct lu_context *ctx,
         LASSERT(info->oti_txns    == 0);
 }
 
-static int osd_device_init(const struct lu_env *env,
-                           struct lu_device *d, struct lu_device *next)
+static int osd_device_init(const struct lu_env *env, struct lu_device *d, 
+                           const char *name, struct lu_device *next)
 {
         return lu_env_init(&osd_dev(d)->od_env_for_commit, NULL, LCT_MD_THREAD);
 }
index 70e4d80..94f3ce6 100644 (file)
@@ -356,7 +356,7 @@ test_3c() {
        rm -rf $DIR/3c1 || error
 }
 
-run_test 3c " dir splitting via lfs stripe ============================="
+#run_test 3c " dir splitting via lfs stripe ============================="
 
 test_4a() {
        let rr=0