Whamcloud - gitweb
- cleanups in cmobd and others:
authoryury <yury>
Mon, 11 Jul 2005 17:18:36 +0000 (17:18 +0000)
committeryury <yury>
Mon, 11 Jul 2005 17:18:36 +0000 (17:18 +0000)
  - change LUSTRE_MDC_NAME (and others) to form like OBD_MDC_DEVICENAME to be coherent with
    OBD_LMV_DEVICENAME and others. Because some OBDs used one form and others used another one.

  - removed different guesses of OBD types from name of some functions in cmobd. Say
    cmobd_find_master() now is called cmobd_find_obd() as all it does is finds obd
    by uuid and may be used not only for finding master. Also cmobd_lmv_obd() is renamed to
    cmobd_md_obd() etc. Improved function (a bit smaller of code) wich looks for master.

- in memory leaks detector do not remove memory track in case of freeing memory chunk different
  of size. marking it instead as such to show in final log of leaks with special hint.

- fixes in lconf. COBD and CMOBD should use LMV and LOV devices with diffrent names to avoid
  issues in the case when both they run on the same node (like in test 45) and try to setup
  and clanup the same device twise (from lconf).

24 files changed:
lustre/cmobd/cm_obd.c
lustre/cobd/cache_obd.c
lustre/include/linux/lustre_cmobd.h
lustre/include/linux/lustre_mds.h
lustre/include/linux/lustre_mgmt.h
lustre/include/linux/obd_class.h
lustre/include/linux/obd_ost.h
lustre/include/linux/obd_support.h
lustre/ldlm/ldlm_lib.c
lustre/llite/llite_lib.c
lustre/lmv/lmv_obd.c
lustre/lov/lov_obd.c
lustre/lvfs/lvfs_linux.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/mds/mds_lov.c
lustre/mds/mds_reint.c
lustre/obdclass/confobd.c
lustre/obdclass/llog_obd.c
lustre/obdclass/llog_test.c
lustre/obdclass/uuid.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/utils/lconf

index 15bbb36..b44903f 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/lustre_cmobd.h>
 #include <linux/lprocfs_status.h>
 #include <linux/obd_lov.h>
 #include <linux/lustre_cmobd.h>
 #include <linux/lprocfs_status.h>
 #include <linux/obd_lov.h>
+#include <linux/obd_ost.h>
 #include <linux/obd_lmv.h>
 
 #include "cm_internal.h"
 #include <linux/obd_lmv.h>
 
 #include "cm_internal.h"
@@ -50,18 +51,19 @@ static int cmobd_detach(struct obd_device *obd)
         return lprocfs_obd_detach(obd);
 }
 
         return lprocfs_obd_detach(obd);
 }
 
-static inline int cmobd_lmv_obd(struct obd_device *obd)
+static inline int cmobd_md_obd(struct obd_device *obd)
 {
 {
-        if (!strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) ||
+        if (!strcmp(obd->obd_type->typ_name, OBD_MDC_DEVICENAME) ||
             !strcmp(obd->obd_type->typ_name, OBD_LMV_DEVICENAME))
                 return 1;
 
         return 0;
 }
 
             !strcmp(obd->obd_type->typ_name, OBD_LMV_DEVICENAME))
                 return 1;
 
         return 0;
 }
 
-static inline int cmobd_lov_obd(struct obd_device *obd)
+static inline int cmobd_dt_obd(struct obd_device *obd)
 {
 {
-        if (!strcmp(obd->obd_type->typ_name, OBD_LOV_DEVICENAME))
+        if (!strcmp(obd->obd_type->typ_name, OBD_LOV_DEVICENAME) ||
+            !strcmp(obd->obd_type->typ_name, OBD_OSC_DEVICENAME))
                 return 1;
 
         return 0;
                 return 1;
 
         return 0;
@@ -88,26 +90,28 @@ static void cmobd_init_ea_size(struct obd_device *obd)
         EXIT;
 }
 
         EXIT;
 }
 
+static char *types[] = {
+        OBD_LMV_DEVICENAME, OBD_MDC_DEVICENAME,
+        OBD_LOV_DEVICENAME, OBD_OSC_DEVICENAME
+};
+
 static struct obd_device *
 static struct obd_device *
-find_master_obd(struct obd_device *obd, struct obd_uuid *uuid)
+cmobd_find_obd(struct obd_device *obd, struct obd_uuid *uuid)
 {
 {
-        struct obd_device *master;
+        struct obd_device *res;
+        int i = 0;
+        ENTRY;
 
         CWARN("%s: looking for client obd %s\n",
               obd->obd_uuid.uuid, uuid->uuid);
 
 
         CWARN("%s: looking for client obd %s\n",
               obd->obd_uuid.uuid, uuid->uuid);
 
-        master = class_find_client_obd(NULL, OBD_LOV_DEVICENAME,
-                                       uuid);
-        if (master)
-                return master;
-
-        master = class_find_client_obd(NULL, OBD_LMV_DEVICENAME,
-                                       uuid);
-        if (master)
-                return master;
-
-        return class_find_client_obd(NULL, LUSTRE_MDC_NAME,
-                                     uuid);
+        for (i = 0; i < sizeof(types); i++) {
+                res = class_find_client_obd(NULL, types[i],
+                                            uuid);
+                if (res)
+                        RETURN(res);
+        }
+        RETURN(NULL);
 }
 
 static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
 }
 
 static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
@@ -137,9 +141,9 @@ static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
         obd_str2uuid(&cache_uuid, lustre_cfg_string(lcfg, 2));
 
         /* getting master obd */
         obd_str2uuid(&cache_uuid, lustre_cfg_string(lcfg, 2));
 
         /* getting master obd */
-        cmobd->master_obd = find_master_obd(obd, &master_uuid);
+        cmobd->master_obd = cmobd_find_obd(obd, &master_uuid);
         if (!cmobd->master_obd) {
         if (!cmobd->master_obd) {
-                CERROR("can't find master obd by uuid %s\n",
+                CERROR("can't find master client obd by uuid %s\n",
                        master_uuid.uuid);
                 RETURN(-EINVAL);
         }
                        master_uuid.uuid);
                 RETURN(-EINVAL);
         }
@@ -167,8 +171,8 @@ static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
                 GOTO(put_master, rc);
         cmobd->cache_exp = class_conn2export(&conn);
         
                 GOTO(put_master, rc);
         cmobd->cache_exp = class_conn2export(&conn);
         
-        if (cmobd_lov_obd(cmobd->master_exp->exp_obd)) {
-                /* for master osc remove the recovery flag. */
+        if (cmobd_dt_obd(cmobd->master_exp->exp_obd)) {
+                /* for master dt device remove the recovery flag. */
                 rc = obd_set_info(cmobd->master_exp, strlen("unrecovery"),
                                   "unrecovery", 0, NULL); 
                 if (rc)
                 rc = obd_set_info(cmobd->master_exp, strlen("unrecovery"),
                                   "unrecovery", 0, NULL); 
                 if (rc)
@@ -182,7 +186,7 @@ static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
                 cmobd->write_srv = NULL;
         }
 
                 cmobd->write_srv = NULL;
         }
 
-        if (cmobd_lmv_obd(cmobd->master_exp->exp_obd)) {
+        if (cmobd_md_obd(cmobd->master_exp->exp_obd)) {
                 /*
                  * making sure, that both obds are ready. This is especially
                  * important in the case of using LMV as master.
                 /*
                  * making sure, that both obds are ready. This is especially
                  * important in the case of using LMV as master.
@@ -314,14 +318,14 @@ static int __init cmobd_init(void)
 
         lprocfs_init_vars(cmobd, &lvars);
         rc = class_register_type(&cmobd_ops, NULL, lvars.module_vars,
 
         lprocfs_init_vars(cmobd, &lvars);
         rc = class_register_type(&cmobd_ops, NULL, lvars.module_vars,
-                                 LUSTRE_CMOBD_NAME);
+                                 OBD_CMOBD_DEVICENAME);
         if (rc)
                 RETURN(rc);
         cmobd_extent_slab = kmem_cache_create("cmobd_extents",
                                                sizeof(struct cmobd_extent_info), 0,
                                                SLAB_HWCACHE_ALIGN, NULL, NULL);
         if (cmobd_extent_slab == NULL) {
         if (rc)
                 RETURN(rc);
         cmobd_extent_slab = kmem_cache_create("cmobd_extents",
                                                sizeof(struct cmobd_extent_info), 0,
                                                SLAB_HWCACHE_ALIGN, NULL, NULL);
         if (cmobd_extent_slab == NULL) {
-                class_unregister_type(LUSTRE_CMOBD_NAME);
+                class_unregister_type(OBD_CMOBD_DEVICENAME);
                 RETURN(-ENOMEM);
         }
         RETURN(0);
                 RETURN(-ENOMEM);
         }
         RETURN(0);
@@ -329,7 +333,7 @@ static int __init cmobd_init(void)
 
 static void __exit cmobd_exit(void)
 {
 
 static void __exit cmobd_exit(void)
 {
-        class_unregister_type(LUSTRE_CMOBD_NAME);
+        class_unregister_type(OBD_CMOBD_DEVICENAME);
         if (kmem_cache_destroy(cmobd_extent_slab) != 0)
                 CERROR("couldn't free cmobd extent slab\n");
 }
         if (kmem_cache_destroy(cmobd_extent_slab) != 0)
                 CERROR("couldn't free cmobd extent slab\n");
 }
index 9cbcd9f..dc0902c 100644 (file)
@@ -98,7 +98,7 @@ static int cobd_setup(struct obd_device *obd, obd_count len, void *buf)
                 OBD_FREE(cobd->master_name, mname_len);
                 RETURN(-ENOMEM);
         } 
                 OBD_FREE(cobd->master_name, mname_len);
                 RETURN(-ENOMEM);
         } 
-        if(inst_len)
+        if (inst_len)
                 sprintf(cobd->cache_name, "%s-%s", lustre_cfg_string(lcfg, 2), 
                         lustre_cfg_string(lcfg, 3));
         else 
                 sprintf(cobd->cache_name, "%s-%s", lustre_cfg_string(lcfg, 2), 
                         lustre_cfg_string(lcfg, 3));
         else 
index 47b2e34..71dc9f1 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <linux/obd_class.h>
 
 
 #include <linux/obd_class.h>
 
-#define LUSTRE_CMOBD_NAME       "cmobd"
+#define OBD_CMOBD_DEVICENAME    "cmobd"
 
 #define CMOBD_MAX_THREADS       32UL
 
 
 #define CMOBD_MAX_THREADS       32UL
 
index e089d26..2c6bcbb 100644 (file)
@@ -49,9 +49,9 @@ struct ptlrpc_request;
 struct obd_device;
 struct ll_file_data;
 
 struct obd_device;
 struct ll_file_data;
 
-#define LUSTRE_MDS_NAME "mds"
-#define LUSTRE_MDT_NAME "mdt"
-#define LUSTRE_MDC_NAME "mdc"
+#define OBD_MDS_DEVICENAME "mds"
+#define OBD_MDT_DEVICENAME "mdt"
+#define OBD_MDC_DEVICENAME "mdc"
 
 struct mds_update_record {
         __u32               ur_opcode;
 
 struct mds_update_record {
         __u32               ur_opcode;
index 91a8113..feec630 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef LUSTRE_MGMT_H
 #define LUSTRE_MGMT_H
 
 #ifndef LUSTRE_MGMT_H
 #define LUSTRE_MGMT_H
 
-#define LUSTRE_MGMTCLI_NAME "mgmt_cli"
+#define OBD_MGMTCLI_DEVICENAME "mgmt_cli"
 
 /* For the convenience and type-safety of inter_module_getters. */
 
 
 /* For the convenience and type-safety of inter_module_getters. */
 
index 6e7beb0..f96ae3a 100644 (file)
@@ -44,6 +44,8 @@
 #include <linux/lprocfs_status.h>
 #include <linux/lustre_log.h>
 
 #include <linux/lprocfs_status.h>
 #include <linux/lustre_log.h>
 
+#define OBD_CONF_DEVICENAME "confobd"
+
 /* OBD Device Declarations */
 #define MAX_OBD_DEVICES 256
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
 /* OBD Device Declarations */
 #define MAX_OBD_DEVICES 256
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
index edb7009..d1af9df 100644 (file)
 
 #include <linux/obd_class.h>
 
 
 #include <linux/obd_class.h>
 
-#define LUSTRE_OST_NAME "ost"
-#define LUSTRE_OSC_NAME "osc"
-#define LUSTRE_SANOSC_NAME "sanosc"
-#define LUSTRE_SANOST_NAME "sanost"
+#define OBD_OST_DEVICENAME "ost"
+#define OBD_OSC_DEVICENAME "osc"
+#define OBD_SANOSC_DEVICENAME "sanosc"
+#define OBD_SANOST_DEVICENAME "sanost"
 
 struct osc_brw_async_args {
         struct obdo     *aa_oa;
 
 struct osc_brw_async_args {
         struct obdo     *aa_oa;
index 0d2d445..f6508c0 100644 (file)
@@ -324,11 +324,14 @@ static inline void OBD_FAIL_WRITE(int id, struct super_block *sb)
 extern atomic_t portal_kmemory;
 
 #if defined (CONFIG_DEBUG_MEMORY) && defined(__KERNEL__)
 extern atomic_t portal_kmemory;
 
 #if defined (CONFIG_DEBUG_MEMORY) && defined(__KERNEL__)
+
+#define MT_FLAGS_WRONG_SIZE (1 << 0)
 #define MEM_LOC_LEN 128
 
 struct mem_track {
         struct hlist_node m_hash;
         char m_loc[MEM_LOC_LEN];
 #define MEM_LOC_LEN 128
 
 struct mem_track {
         struct hlist_node m_hash;
         char m_loc[MEM_LOC_LEN];
+        int m_flags;
         void *m_ptr;
         int m_size;
 };
         void *m_ptr;
         int m_size;
 };
@@ -356,6 +359,7 @@ __new_mem_track(void *ptr, int size,
 
         mt->m_size = size;
         mt->m_ptr = ptr;
 
         mt->m_size = size;
         mt->m_ptr = ptr;
+        mt->m_flags = 0;
         return mt;
 }
 
         return mt;
 }
 
@@ -396,11 +400,13 @@ __put_mem_track(void *ptr, int size,
                 return 0;
         } else {
                 if (mt->m_size != size) {
                 return 0;
         } else {
                 if (mt->m_size != size) {
+                        mt->m_flags |= MT_FLAGS_WRONG_SIZE;
                         CWARN("freeing memory chunk of different size "
                               "than allocated (%d != %d) at %s:%d\n",
                               mt->m_size, size, file, line);
                         CWARN("freeing memory chunk of different size "
                               "than allocated (%d != %d) at %s:%d\n",
                               mt->m_size, size, file, line);
+                } else {
+                        __free_mem_track(mt);
                 }
                 }
-                __free_mem_track(mt);
                 return 1;
         }
 }
                 return 1;
         }
 }
index 249ed21..366bef3 100644 (file)
@@ -185,15 +185,15 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf)
 
         /* In a more perfect world, we would hang a ptlrpc_client off of
          * obd_type and just use the values from there. */
 
         /* In a more perfect world, we would hang a ptlrpc_client off of
          * obd_type and just use the values from there. */
-        if (!strcmp(name, LUSTRE_OSC_NAME)) {
+        if (!strcmp(name, OBD_OSC_DEVICENAME)) {
                 rq_portal = OST_REQUEST_PORTAL;
                 rp_portal = OSC_REPLY_PORTAL;
                 connect_op = OST_CONNECT;
                 rq_portal = OST_REQUEST_PORTAL;
                 rp_portal = OSC_REPLY_PORTAL;
                 connect_op = OST_CONNECT;
-        } else if (!strcmp(name, LUSTRE_MDC_NAME)) {
+        } else if (!strcmp(name, OBD_MDC_DEVICENAME)) {
                 rq_portal = MDS_REQUEST_PORTAL;
                 rp_portal = MDC_REPLY_PORTAL;
                 connect_op = MDS_CONNECT;
                 rq_portal = MDS_REQUEST_PORTAL;
                 rp_portal = MDC_REPLY_PORTAL;
                 connect_op = MDS_CONNECT;
-        } else if (!strcmp(name, LUSTRE_MGMTCLI_NAME)) {
+        } else if (!strcmp(name, OBD_MGMTCLI_DEVICENAME)) {
                 rq_portal = MGMT_REQUEST_PORTAL;
                 rp_portal = MGMT_REPLY_PORTAL;
                 connect_op = MGMT_CONNECT;
                 rq_portal = MGMT_REQUEST_PORTAL;
                 rp_portal = MGMT_REPLY_PORTAL;
                 connect_op = MGMT_CONNECT;
@@ -561,7 +561,7 @@ int target_check_deny_sec(struct obd_device *target, struct ptlrpc_request *req)
 
         flavor = req->rq_req_secflvr;
 
 
         flavor = req->rq_req_secflvr;
 
-        if (!strcmp(target->obd_type->typ_name, LUSTRE_MDS_NAME)) {
+        if (!strcmp(target->obd_type->typ_name, OBD_MDS_DEVICENAME)) {
                 spin_lock(&target->u.mds.mds_denylist_lock);
                 rc = check_deny_list(&target->u.mds.mds_denylist, flavor);
                 spin_unlock(&target->u.mds.mds_denylist_lock);
                 spin_lock(&target->u.mds.mds_denylist_lock);
                 rc = check_deny_list(&target->u.mds.mds_denylist, flavor);
                 spin_unlock(&target->u.mds.mds_denylist_lock);
index 8e52be4..84f3263 100644 (file)
@@ -599,7 +599,7 @@ static int lustre_process_log(struct lustre_mount_data *lmd, char *profile,
                 GOTO(out_del_conn, err);
 
         lustre_cfg_bufs_reset(&bufs, name);
                 GOTO(out_del_conn, err);
 
         lustre_cfg_bufs_reset(&bufs, name);
-        lustre_cfg_bufs_set_string(&bufs, 1, LUSTRE_MDC_NAME);
+        lustre_cfg_bufs_set_string(&bufs, 1, OBD_MDC_DEVICENAME);
         lustre_cfg_bufs_set_string(&bufs, 2, (char *)lmv_uuid.uuid);
 
         lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
         lustre_cfg_bufs_set_string(&bufs, 2, (char *)lmv_uuid.uuid);
 
         lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
index 13f11a6..31066d8 100644 (file)
@@ -110,7 +110,7 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct obd_uuid *uuid,
         CDEBUG(D_INFO, "Found OBD %s=%s device %d (%p) type %s at LMV idx %d\n",
                obd->obd_name, obd->obd_uuid.uuid, obd->obd_minor, obd,
                obd->obd_type->typ_name, i);
         CDEBUG(D_INFO, "Found OBD %s=%s device %d (%p) type %s at LMV idx %d\n",
                obd->obd_name, obd->obd_uuid.uuid, obd->obd_minor, obd,
                obd->obd_type->typ_name, i);
-        LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0);
+        LASSERT(strcmp(obd->obd_type->typ_name, OBD_MDC_DEVICENAME) == 0);
 
         if (tgt->active == activate) {
                 CDEBUG(D_INFO, "OBD %p already %sactive!\n", obd,
 
         if (tgt->active == activate) {
                 CDEBUG(D_INFO, "OBD %p already %sactive!\n", obd,
@@ -137,7 +137,7 @@ static int lmv_notify(struct obd_device *obd, struct obd_device *watched,
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
-        if (strcmp(watched->obd_type->typ_name, LUSTRE_MDC_NAME)) {
+        if (strcmp(watched->obd_type->typ_name, OBD_MDC_DEVICENAME)) {
                 CERROR("unexpected notification of %s %s!\n",
                        watched->obd_type->typ_name,
                        watched->obd_name);
                 CERROR("unexpected notification of %s %s!\n",
                        watched->obd_type->typ_name,
                        watched->obd_name);
@@ -316,7 +316,7 @@ int lmv_check_connect(struct obd_device *obd)
 
                 LASSERT(tgts != NULL);
 
 
                 LASSERT(tgts != NULL);
 
-                tgt_obd = class_find_client_obd(&tgts->uuid, LUSTRE_MDC_NAME, 
+                tgt_obd = class_find_client_obd(&tgts->uuid, OBD_MDC_DEVICENAME, 
                                                 &obd->obd_uuid);
                 if (!tgt_obd) {
                         CERROR("target %s not attached\n", tgts->uuid.uuid);
                                                 &obd->obd_uuid);
                 if (!tgt_obd) {
                         CERROR("target %s not attached\n", tgts->uuid.uuid);
@@ -601,7 +601,7 @@ static int lmv_setup(struct obd_device *obd, obd_count len, void *buf)
                 OBD_FREE(lmv->tgts, lmv->tgts_size);
         }
 
                 OBD_FREE(lmv->tgts, lmv->tgts_size);
         }
 
-        tgt_obd = class_find_client_obd(&lmv->tgts->uuid, LUSTRE_MDC_NAME,
+        tgt_obd = class_find_client_obd(&lmv->tgts->uuid, OBD_MDC_DEVICENAME,
                                         &obd->obd_uuid);
         if (!tgt_obd) {
                 CERROR("Target %s not attached\n", lmv->tgts->uuid.uuid);
                                         &obd->obd_uuid);
         if (!tgt_obd) {
                 CERROR("Target %s not attached\n", lmv->tgts->uuid.uuid);
@@ -1942,7 +1942,7 @@ int lmv_set_info(struct obd_export *exp, obd_count keylen,
                                 struct obd_device *tgt_obd;
 
                                 tgt_obd = class_find_client_obd(&tgt->uuid,
                                 struct obd_device *tgt_obd;
 
                                 tgt_obd = class_find_client_obd(&tgt->uuid,
-                                                                LUSTRE_MDC_NAME,
+                                                                OBD_MDC_DEVICENAME,
                                                                 &obd->obd_uuid);
                                 if (!tgt_obd) {
                                         CERROR("can't set info %s, "
                                                                 &obd->obd_uuid);
                                 if (!tgt_obd) {
                                         CERROR("can't set info %s, "
index ade5056..891c132 100644 (file)
@@ -69,7 +69,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
-        tgt_obd = class_find_client_obd(tgt_uuid, LUSTRE_OSC_NAME,
+        tgt_obd = class_find_client_obd(tgt_uuid, OBD_OSC_DEVICENAME,
                                         &obd->obd_uuid);
 
         if (!tgt_obd) {
                                         &obd->obd_uuid);
 
         if (!tgt_obd) {
@@ -374,7 +374,7 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
-        if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) {
+        if (strcmp(watched->obd_type->typ_name, OBD_OSC_DEVICENAME)) {
                 CERROR("unexpected notification of %s %s!\n",
                        watched->obd_type->typ_name,
                        watched->obd_name);
                 CERROR("unexpected notification of %s %s!\n",
                        watched->obd_type->typ_name,
                        watched->obd_name);
@@ -2064,7 +2064,7 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen,
                         struct obd_device *tgt_obd;
 
                         tgt_obd = class_find_client_obd(tgt_uuid,
                         struct obd_device *tgt_obd;
 
                         tgt_obd = class_find_client_obd(tgt_uuid,
-                                                        LUSTRE_OSC_NAME,
+                                                        OBD_OSC_DEVICENAME,
                                                         &obddev->obd_uuid);
                         if (!tgt_obd) {
                                 CERROR("Target %s not attached\n",
                                                         &obddev->obd_uuid);
                         if (!tgt_obd) {
                                 CERROR("Target %s not attached\n",
@@ -2108,7 +2108,7 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen,
                                 struct obd_device *tgt_obd;
 
                                 tgt_obd = class_find_client_obd(&tgt->uuid,
                                 struct obd_device *tgt_obd;
 
                                 tgt_obd = class_find_client_obd(&tgt->uuid,
-                                                                LUSTRE_OSC_NAME,
+                                                                OBD_OSC_DEVICENAME,
                                                                 &obddev->obd_uuid);
                                 if (!tgt_obd) {
                                         CERROR("can't set security flavor, "
                                                                 &obddev->obd_uuid);
                                 if (!tgt_obd) {
                                         CERROR("can't set security flavor, "
index 2c61a1c..b4fb970 100644 (file)
@@ -598,7 +598,9 @@ void lvfs_memdbg_show(void)
                 for (i = 0, head = obd_memtable; i < obd_memtable_size; i++, head++) {
                         hlist_for_each(node, head) {
                                 mt = hlist_entry(node, struct mem_track, m_hash);
                 for (i = 0, head = obd_memtable; i < obd_memtable_size; i++, head++) {
                         hlist_for_each(node, head) {
                                 mt = hlist_entry(node, struct mem_track, m_hash);
-                                CWARN("  ptr: 0x%p, size: %d, src at \"%s\"\n",
+                                CWARN("  [%s] ptr: 0x%p, size: %d, src at \"%s\"\n",
+                                      ((mt->m_flags & MT_FLAGS_WRONG_SIZE) ?
+                                       "wrong ck size" : "leaked memory"),
                                       mt->m_ptr, mt->m_size, mt->m_loc);
                         }
                 }
                                       mt->m_ptr, mt->m_size, mt->m_loc);
                         }
                 }
index dad57ef..dab2bb2 100644 (file)
@@ -1480,15 +1480,16 @@ struct md_ops mdc_md_ops = {
 int __init mdc_init(void)
 {
         struct lprocfs_static_vars lvars;
 int __init mdc_init(void)
 {
         struct lprocfs_static_vars lvars;
+        
         lprocfs_init_vars(mdc, &lvars);
         lprocfs_init_vars(mdc, &lvars);
-        return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
-                                   LUSTRE_MDC_NAME);
+        return class_register_type(&mdc_obd_ops, &mdc_md_ops,
+                                   lvars.module_vars, OBD_MDC_DEVICENAME);
 }
 
 #ifdef __KERNEL__
 static void /*__exit*/ mdc_exit(void)
 {
 }
 
 #ifdef __KERNEL__
 static void /*__exit*/ mdc_exit(void)
 {
-        class_unregister_type(LUSTRE_MDC_NAME);
+        class_unregister_type(OBD_MDC_DEVICENAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
index c2ead6b..eb4eead 100644 (file)
@@ -1353,7 +1353,7 @@ static int mds_getattr_lock(struct ptlrpc_request *req, int offset,
         char *name = NULL;
         ENTRY;
 
         char *name = NULL;
         ENTRY;
 
-        LASSERT(!strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME));
+        LASSERT(!strcmp(obd->obd_type->typ_name, OBD_MDS_DEVICENAME));
         MD_COUNTER_INCREMENT(obd, getattr_lock);
 
         rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
         MD_COUNTER_INCREMENT(obd, getattr_lock);
 
         rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
@@ -2570,7 +2570,6 @@ static int mdt_set_info(struct ptlrpc_request *req)
 
 static void mds_revoke_export_locks(struct obd_export *exp)
 {
 
 static void mds_revoke_export_locks(struct obd_export *exp)
 {
-        struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
         struct list_head *locklist = &exp->exp_ldlm_data.led_held_locks;
         struct list_head work;
         struct ldlm_lock *lock, *next;
         struct list_head *locklist = &exp->exp_ldlm_data.led_held_locks;
         struct list_head work;
         struct ldlm_lock *lock, *next;
@@ -4266,10 +4265,10 @@ static int __init mds_init(void)
 
         lprocfs_init_multi_vars(0, &lvars);
         class_register_type(&mds_obd_ops, NULL, lvars.module_vars,
 
         lprocfs_init_multi_vars(0, &lvars);
         class_register_type(&mds_obd_ops, NULL, lvars.module_vars,
-                            LUSTRE_MDS_NAME);
+                            OBD_MDS_DEVICENAME);
         lprocfs_init_multi_vars(1, &lvars);
         class_register_type(&mdt_obd_ops, NULL, lvars.module_vars,
         lprocfs_init_multi_vars(1, &lvars);
         class_register_type(&mdt_obd_ops, NULL, lvars.module_vars,
-                            LUSTRE_MDT_NAME);
+                            OBD_MDT_DEVICENAME);
 
         return 0;
 }
 
         return 0;
 }
@@ -4278,8 +4277,8 @@ static void /*__exit*/ mds_exit(void)
 {
         mds_cleanup_lsd_cache();
 
 {
         mds_cleanup_lsd_cache();
 
-        class_unregister_type(LUSTRE_MDS_NAME);
-        class_unregister_type(LUSTRE_MDT_NAME);
+        class_unregister_type(OBD_MDS_DEVICENAME);
+        class_unregister_type(OBD_MDT_DEVICENAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
index a1f624a..30bd1a6 100644 (file)
@@ -748,10 +748,10 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
         if (!active)
                 RETURN(0);
 
         if (!active)
                 RETURN(0);
 
-        if (!strcmp(watched->obd_type->typ_name, LUSTRE_MDC_NAME))
+        if (!strcmp(watched->obd_type->typ_name, OBD_MDC_DEVICENAME))
                 RETURN(0);
 
                 RETURN(0);
 
-        if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) {
+        if (strcmp(watched->obd_type->typ_name, OBD_OSC_DEVICENAME)) {
                 CERROR("unexpected notification of %s %s!\n",
                        watched->obd_type->typ_name, watched->obd_name);
                 RETURN(-EINVAL);
                 CERROR("unexpected notification of %s %s!\n",
                        watched->obd_type->typ_name, watched->obd_name);
                 RETURN(-EINVAL);
index fa802cf..c69d9e5 100644 (file)
@@ -698,7 +698,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
         LASSERT(offset == 1);
         
         LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name,
         LASSERT(offset == 1);
         
         LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name,
-                        LUSTRE_MDS_NAME));
+                        OBD_MDS_DEVICENAME));
 
         DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %s mode %o",
                   id_ino(rec->ur_id1), id_gen(rec->ur_id1),
 
         DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %s mode %o",
                   id_ino(rec->ur_id1), id_gen(rec->ur_id1),
index 076b91c..d48366b 100644 (file)
@@ -34,8 +34,6 @@
 #include <linux/obd_class.h>
 #include <linux/lprocfs_status.h>
 
 #include <linux/obd_class.h>
 #include <linux/lprocfs_status.h>
 
-#define LUSTRE_CONFOBD_NAME "confobd"
-
 static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
 static struct lprocfs_vars lprocfs_obd_vars[] = { {0} };
 
 static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
 static struct lprocfs_vars lprocfs_obd_vars[] = { {0} };
 
@@ -420,13 +418,14 @@ static int __init confobd_init(void)
         ENTRY;
 
         lprocfs_init_vars(confobd, &lvars);
         ENTRY;
 
         lprocfs_init_vars(confobd, &lvars);
-        RETURN(class_register_type(&conf_obd_ops, NULL, lvars.module_vars,
-                                   LUSTRE_CONFOBD_NAME));
+        RETURN(class_register_type(&conf_obd_ops, NULL,
+                                   lvars.module_vars,
+                                   OBD_CONF_DEVICENAME));
 }
 
 static void __exit confobd_exit(void)
 {
 }
 
 static void __exit confobd_exit(void)
 {
-        class_unregister_type(LUSTRE_CONFOBD_NAME);
+        class_unregister_type(OBD_CONF_DEVICENAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
index 259bcbc..fac3dd5 100644 (file)
@@ -55,11 +55,11 @@ int obd_llog_setup(struct obd_device *obd, struct obd_llogs *llogs,
         if (op->lop_close == llog_lvfs_ops.lop_close) {
                 ctxt->loc_fsops = disk_obd->obd_fsops;
                 ctxt->loc_lvfs_ctxt = &disk_obd->obd_lvfs_ctxt;
         if (op->lop_close == llog_lvfs_ops.lop_close) {
                 ctxt->loc_fsops = disk_obd->obd_fsops;
                 ctxt->loc_lvfs_ctxt = &disk_obd->obd_lvfs_ctxt;
-                if (!strcmp(disk_obd->obd_type->typ_name, LUSTRE_MDS_NAME)) {
+                if (!strcmp(disk_obd->obd_type->typ_name, OBD_MDS_DEVICENAME)) {
                         struct mds_obd *mds = &disk_obd->u.mds;
                         ctxt->loc_objects_dir = mds->mds_objects_dir;
                         ctxt->loc_logs_dir = mds->mds_logs_dir;
                         struct mds_obd *mds = &disk_obd->u.mds;
                         ctxt->loc_objects_dir = mds->mds_objects_dir;
                         ctxt->loc_logs_dir = mds->mds_logs_dir;
-                } else if (!strcmp(disk_obd->obd_type->typ_name, "confobd")) {
+                } else if (!strcmp(disk_obd->obd_type->typ_name, OBD_CONF_DEVICENAME)) {
                         struct conf_obd *confobd = &disk_obd->u.conf;
                         ctxt->loc_objects_dir = confobd->cfobd_objects_dir;
                         ctxt->loc_logs_dir = confobd->cfobd_logs_dir;
                         struct conf_obd *confobd = &disk_obd->u.conf;
                         ctxt->loc_objects_dir = confobd->cfobd_objects_dir;
                         ctxt->loc_logs_dir = confobd->cfobd_logs_dir;
index 8c2756b..f6d86a7 100644 (file)
@@ -458,7 +458,7 @@ static int llog_test_6(struct obd_device *obd, char *name)
         mds_uuid = &ctxt->loc_exp->exp_obd->obd_uuid;
 
         CWARN("6a: re-open log %s using client API\n", name);
         mds_uuid = &ctxt->loc_exp->exp_obd->obd_uuid;
 
         CWARN("6a: re-open log %s using client API\n", name);
-        mdc_obd = class_find_client_obd(mds_uuid, LUSTRE_MDC_NAME, NULL);
+        mdc_obd = class_find_client_obd(mds_uuid, OBD_MDC_DEVICENAME, NULL);
         if (mdc_obd == NULL) {
                 CERROR("6: no MDC devices connected to %s found.\n",
                        mds_uuid->uuid);
         if (mdc_obd == NULL) {
                 CERROR("6: no MDC devices connected to %s found.\n",
                        mds_uuid->uuid);
index 44269a4..6f1c9c8 100644 (file)
@@ -150,10 +150,10 @@ struct obd_device *client_tgtuuid2obd(struct obd_uuid *tgtuuid)
                 struct obd_device *obd = &obd_dev[i];
                 if (obd->obd_type == NULL)
                         continue;
                 struct obd_device *obd = &obd_dev[i];
                 if (obd->obd_type == NULL)
                         continue;
-                if ((strncmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME,
-                             sizeof LUSTRE_OSC_NAME) == 0) ||
-                    (strncmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME,
-                             sizeof LUSTRE_MDC_NAME) == 0)) {
+                if ((strncmp(obd->obd_type->typ_name, OBD_OSC_DEVICENAME,
+                             sizeof(OBD_OSC_DEVICENAME)) == 0) ||
+                    (strncmp(obd->obd_type->typ_name, OBD_MDC_DEVICENAME,
+                             sizeof(OBD_MDC_DEVICENAME)) == 0)) {
                         struct client_obd *cli = &obd->u.cli;
                         struct obd_import *imp = cli->cl_import;
                         if (strncmp((char *)tgtuuid->uuid, (char *)imp->imp_target_uuid.uuid,
                         struct client_obd *cli = &obd->u.cli;
                         struct obd_import *imp = cli->cl_import;
                         if (strncmp((char *)tgtuuid->uuid, (char *)imp->imp_target_uuid.uuid,
index edc83ec..694ecba 100644 (file)
@@ -3260,15 +3260,15 @@ int __init osc_init(void)
 #endif
 
         rc = class_register_type(&osc_obd_ops, NULL, lvars.module_vars,
 #endif
 
         rc = class_register_type(&osc_obd_ops, NULL, lvars.module_vars,
-                                 LUSTRE_OSC_NAME);
+                                 OBD_OSC_DEVICENAME);
         if (rc)
                 RETURN(rc);
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
         rc = class_register_type(&sanosc_obd_ops, NULL, sanlvars.module_vars,
         if (rc)
                 RETURN(rc);
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
         rc = class_register_type(&sanosc_obd_ops, NULL, sanlvars.module_vars,
-                                 LUSTRE_SANOSC_NAME);
+                                 OBD_SANOSC_DEVICENAME);
         if (rc)
         if (rc)
-                class_unregister_type(LUSTRE_OSC_NAME);
+                class_unregister_type(OBD_OSC_DEVICENAME);
 #endif
 
         RETURN(rc);
 #endif
 
         RETURN(rc);
@@ -3278,9 +3278,9 @@ int __init osc_init(void)
 static void /*__exit*/ osc_exit(void)
 {
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 static void /*__exit*/ osc_exit(void)
 {
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        class_unregister_type(LUSTRE_SANOSC_NAME);
+        class_unregister_type(OBD_SANOSC_DEVICENAME);
 #endif
 #endif
-        class_unregister_type(LUSTRE_OSC_NAME);
+        class_unregister_type(OBD_OSC_DEVICENAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
index 9902402..c329af0 100644 (file)
@@ -363,7 +363,7 @@ static void ost_stime_record(struct ptlrpc_request *req, struct timeval *start,
         int ind = rw *3 + phase;
          
         if (obd && obd->obd_type && obd->obd_type->typ_name) {
         int ind = rw *3 + phase;
          
         if (obd && obd->obd_type && obd->obd_type->typ_name) {
-                if (!strcmp(obd->obd_type->typ_name, LUSTRE_OST_NAME)) {
+                if (!strcmp(obd->obd_type->typ_name, OBD_OST_DEVICENAME)) {
                         struct ost_obd *ost = NULL;
                         
                         ost = &obd->u.ost;
                         struct ost_obd *ost = NULL;
                         
                         ost = &obd->u.ost;
@@ -1360,12 +1360,12 @@ static int __init ost_init(void)
 
         lprocfs_init_vars(ost,&lvars);
         RETURN(class_register_type(&ost_obd_ops, NULL, lvars.module_vars,
 
         lprocfs_init_vars(ost,&lvars);
         RETURN(class_register_type(&ost_obd_ops, NULL, lvars.module_vars,
-                                   LUSTRE_OST_NAME));
+                                   OBD_OST_DEVICENAME));
 }
 
 static void /*__exit*/ ost_exit(void)
 {
 }
 
 static void /*__exit*/ ost_exit(void)
 {
-        class_unregister_type(LUSTRE_OST_NAME);
+        class_unregister_type(OBD_OST_DEVICENAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
index 6bb9ed7..c84cd07 100755 (executable)
@@ -2552,24 +2552,27 @@ class CMOBD(Module):
 
        if master_class == 'ost' or master_class == 'lov':
            client_uuid = "%s_lov_master_UUID" % (self.name)
 
        if master_class == 'ost' or master_class == 'lov':
            client_uuid = "%s_lov_master_UUID" % (self.name)
-            self.master = LOV(master_obd, client_uuid, self.name);
+            self.master = LOV(master_obd, client_uuid, self.name,
+                             "master_%s" % (self.name));
         elif master_class == 'mds':
            self.master = get_mdc(db, self.name, self.master_uuid) 
         elif master_class == 'lmv':
         elif master_class == 'mds':
            self.master = get_mdc(db, self.name, self.master_uuid) 
         elif master_class == 'lmv':
-           #tmp fix: cobd and cmobd will use same uuid, so use const name here
-           client_uuid = "%s_lmv_master_UUID" % "master" 
-            self.master = LMV(master_obd, client_uuid, self.name);
+           client_uuid = "%s_lmv_master_UUID" % (self.name)
+            self.master = LMV(master_obd, client_uuid, self.name, 
+                             "master_%s" % (self.name));
        else:
            panic("unknown master obd class '%s'" %(master_class))
            
        if cache_class == 'ost' or cache_class == 'lov':
            client_uuid = "%s_lov_cache_UUID" % (self.name)
        else:
            panic("unknown master obd class '%s'" %(master_class))
            
        if cache_class == 'ost' or cache_class == 'lov':
            client_uuid = "%s_lov_cache_UUID" % (self.name)
-            self.cache = LOV(cache_obd, client_uuid, self.name);
+            self.cache = LOV(cache_obd, client_uuid, self.name,
+                            "cache_%s" % (self.name));
         elif cache_class == 'mds':
            self.cache = get_mdc(db, self.name, self.cache_uuid)
         elif cache_class == 'lmv':
            client_uuid = "%s_lmv_cache_UUID" % (self.name) 
         elif cache_class == 'mds':
            self.cache = get_mdc(db, self.name, self.cache_uuid)
         elif cache_class == 'lmv':
            client_uuid = "%s_lmv_cache_UUID" % (self.name) 
-            self.cache = LMV(cache_obd, client_uuid, self.name);
+            self.cache = LMV(cache_obd, client_uuid, self.name, 
+                            "cache_%s" % (self.name));
        else:
            panic("unknown cache obd class '%s'" %(cache_class))
 
        else:
            panic("unknown cache obd class '%s'" %(cache_class))
 
@@ -2632,24 +2635,27 @@ class COBD(Module):
 
        if master_class == 'ost' or master_class == 'lov':
            client_uuid = "%s_lov_master_UUID" % (self.name)
 
        if master_class == 'ost' or master_class == 'lov':
            client_uuid = "%s_lov_master_UUID" % (self.name)
-            self.master = LOV(master_obd, client_uuid, name);
+            self.master = LOV(master_obd, client_uuid, name,
+                             "master_%s" % (self.name));
         elif master_class == 'mds':
             self.master = get_mdc(db, name, self.master_uuid) 
         elif master_class == 'lmv':
         elif master_class == 'mds':
             self.master = get_mdc(db, name, self.master_uuid) 
         elif master_class == 'lmv':
-           #tmp fix: cobd and cmobd will use same uuid, so use const name here
-           client_uuid = "%s_lmv_master_UUID" % "master" 
-            self.master = LMV(master_obd, client_uuid, self.name);
+           client_uuid = "%s_lmv_master_UUID" % (self.name)
+            self.master = LMV(master_obd, client_uuid, self.name, 
+                             "master_%s" % (self.name));
        else:
            panic("unknown master obd class '%s'" %(master_class))
            
        if cache_class == 'ost' or cache_class == 'lov':
            client_uuid = "%s_lov_cache_UUID" % (self.name)
        else:
            panic("unknown master obd class '%s'" %(master_class))
            
        if cache_class == 'ost' or cache_class == 'lov':
            client_uuid = "%s_lov_cache_UUID" % (self.name)
-            self.cache = LOV(cache_obd, client_uuid, name);
+            self.cache = LOV(cache_obd, client_uuid, name,
+                            "cache_%s" % (self.name));
         elif cache_class == 'mds':
             self.cache = get_mdc(db, name, self.cache_uuid)
         elif cache_class == 'lmv':
         elif cache_class == 'mds':
             self.cache = get_mdc(db, name, self.cache_uuid)
         elif cache_class == 'lmv':
-           client_uuid = "%s_lmv_cache_UUID" % "cache" 
-            self.cache = LMV(cache_obd, client_uuid, self.name);
+           client_uuid = "%s_lmv_cache_UUID" % (self.name)
+            self.cache = LMV(cache_obd, client_uuid, self.name, 
+                            "cache_%s" % (self.name));
        else:
            panic("unknown cache obd class '%s'" %(cache_class))
            
        else:
            panic("unknown cache obd class '%s'" %(cache_class))