Whamcloud - gitweb
LU-2675 lmv: remove lmv_init_{lock,unlock}() 15/12115/3
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 29 Sep 2014 18:12:52 +0000 (13:12 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 4 Dec 2014 02:33:49 +0000 (02:33 +0000)
In struct lmv_obd rename the init_mutex member to
lmv_init_mutex. Remove the compat macros lmv_init_{lock,unlock}() and
use mutex_{lock,unlock}(&lmv->lmv_init_mutex) instead.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Iae1f5d6b7fd1f96ba430d5e7af97c51ce3e042a8
Reviewed-on: http://review.whamcloud.com/12115
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd.h
lustre/lmv/lmv_internal.h
lustre/lmv/lmv_obd.c

index 1dc0315..fa96ced 100644 (file)
@@ -442,7 +442,7 @@ struct lmv_obd {
        struct obd_export       *exp;
        struct proc_dir_entry   *targets_proc_entry;
 
        struct obd_export       *exp;
        struct proc_dir_entry   *targets_proc_entry;
 
-       struct mutex            init_mutex;
+       struct mutex            lmv_init_mutex;
        int                     connected;
        int                     max_easize;
        int                     max_def_easize;
        int                     connected;
        int                     max_easize;
        int                     max_def_easize;
index 1110718..82780bb 100644 (file)
@@ -43,9 +43,6 @@
 
 #define LMV_MAX_TGT_COUNT 128
 
 
 #define LMV_MAX_TGT_COUNT 128
 
-#define lmv_init_lock(lmv)   mutex_lock(&lmv->init_mutex);
-#define lmv_init_unlock(lmv) mutex_unlock(&lmv->init_mutex);
-
 #define LL_IT2STR(it)                                  \
        ((it) ? ldlm_it2str((it)->it_op) : "0")
 
 #define LL_IT2STR(it)                                  \
        ((it) ? ldlm_it2str((it)->it_op) : "0")
 
index 6681ecf..2a0746d 100644 (file)
@@ -435,7 +435,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
 
        CDEBUG(D_CONFIG, "Target uuid: %s. index %d\n", uuidp->uuid, index);
 
 
        CDEBUG(D_CONFIG, "Target uuid: %s. index %d\n", uuidp->uuid, index);
 
-        lmv_init_lock(lmv);
+       mutex_lock(&lmv->lmv_init_mutex);
 
        if (lmv->desc.ld_tgt_count == 0) {
                struct obd_device *mdc_obd;
 
        if (lmv->desc.ld_tgt_count == 0) {
                struct obd_device *mdc_obd;
@@ -443,7 +443,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                mdc_obd = class_find_client_obd(uuidp, LUSTRE_MDC_NAME,
                                                &obd->obd_uuid);
                if (!mdc_obd) {
                mdc_obd = class_find_client_obd(uuidp, LUSTRE_MDC_NAME,
                                                &obd->obd_uuid);
                if (!mdc_obd) {
-                       lmv_init_unlock(lmv);
+                       mutex_unlock(&lmv->lmv_init_mutex);
                        CERROR("%s: Target %s not attached: rc = %d\n",
                               obd->obd_name, uuidp->uuid, -EINVAL);
                        RETURN(-EINVAL);
                        CERROR("%s: Target %s not attached: rc = %d\n",
                               obd->obd_name, uuidp->uuid, -EINVAL);
                        RETURN(-EINVAL);
@@ -455,7 +455,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                CERROR("%s: UUID %s already assigned at LOV target index %d:"
                       " rc = %d\n", obd->obd_name,
                       obd_uuid2str(&tgt->ltd_uuid), index, -EEXIST);
                CERROR("%s: UUID %s already assigned at LOV target index %d:"
                       " rc = %d\n", obd->obd_name,
                       obd_uuid2str(&tgt->ltd_uuid), index, -EEXIST);
-               lmv_init_unlock(lmv);
+               mutex_unlock(&lmv->lmv_init_mutex);
                RETURN(-EEXIST);
        }
 
                RETURN(-EEXIST);
        }
 
@@ -469,7 +469,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                        newsize = newsize << 1;
                OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize);
                if (newtgts == NULL) {
                        newsize = newsize << 1;
                OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize);
                if (newtgts == NULL) {
-                       lmv_init_unlock(lmv);
+                       mutex_unlock(&lmv->lmv_init_mutex);
                        RETURN(-ENOMEM);
                }
 
                        RETURN(-ENOMEM);
                }
 
@@ -492,7 +492,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
 
        OBD_ALLOC_PTR(tgt);
        if (!tgt) {
 
        OBD_ALLOC_PTR(tgt);
        if (!tgt) {
-               lmv_init_unlock(lmv);
+               mutex_unlock(&lmv->lmv_init_mutex);
                RETURN(-ENOMEM);
        }
 
                RETURN(-ENOMEM);
        }
 
@@ -521,7 +521,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                }
        }
 
                }
        }
 
-       lmv_init_unlock(lmv);
+       mutex_unlock(&lmv->lmv_init_mutex);
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
@@ -537,14 +537,14 @@ int lmv_check_connect(struct obd_device *obd)
         if (lmv->connected)
                 RETURN(0);
 
         if (lmv->connected)
                 RETURN(0);
 
-        lmv_init_lock(lmv);
+       mutex_lock(&lmv->lmv_init_mutex);
         if (lmv->connected) {
         if (lmv->connected) {
-                lmv_init_unlock(lmv);
+               mutex_unlock(&lmv->lmv_init_mutex);
                 RETURN(0);
         }
 
         if (lmv->desc.ld_tgt_count == 0) {
                 RETURN(0);
         }
 
         if (lmv->desc.ld_tgt_count == 0) {
-                lmv_init_unlock(lmv);
+               mutex_unlock(&lmv->lmv_init_mutex);
                 CERROR("%s: no targets configured.\n", obd->obd_name);
                 RETURN(-EINVAL);
         }
                 CERROR("%s: no targets configured.\n", obd->obd_name);
                 RETURN(-EINVAL);
         }
@@ -552,7 +552,7 @@ int lmv_check_connect(struct obd_device *obd)
        LASSERT(lmv->tgts != NULL);
 
        if (lmv->tgts[0] == NULL) {
        LASSERT(lmv->tgts != NULL);
 
        if (lmv->tgts[0] == NULL) {
-               lmv_init_unlock(lmv);
+               mutex_unlock(&lmv->lmv_init_mutex);
                CERROR("%s: no target configured for index 0.\n",
                       obd->obd_name);
                RETURN(-EINVAL);
                CERROR("%s: no target configured for index 0.\n",
                       obd->obd_name);
                RETURN(-EINVAL);
@@ -574,7 +574,7 @@ int lmv_check_connect(struct obd_device *obd)
        lmv->connected = 1;
        easize = lmv_mds_md_size(lmv->desc.ld_tgt_count, LMV_MAGIC);
        lmv_init_ea_size(obd->obd_self_export, easize, 0, 0, 0);
        lmv->connected = 1;
        easize = lmv_mds_md_size(lmv->desc.ld_tgt_count, LMV_MAGIC);
        lmv_init_ea_size(obd->obd_self_export, easize, 0, 0, 0);
-       lmv_init_unlock(lmv);
+       mutex_unlock(&lmv->lmv_init_mutex);
        RETURN(0);
 
  out_disc:
        RETURN(0);
 
  out_disc:
@@ -595,7 +595,7 @@ int lmv_check_connect(struct obd_device *obd)
                 }
         }
         class_disconnect(lmv->exp);
                 }
         }
         class_disconnect(lmv->exp);
-        lmv_init_unlock(lmv);
+       mutex_unlock(&lmv->lmv_init_mutex);
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
@@ -1371,7 +1371,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
        lmv->lmv_placement = PLACEMENT_CHAR_POLICY;
 
        spin_lock_init(&lmv->lmv_lock);
        lmv->lmv_placement = PLACEMENT_CHAR_POLICY;
 
        spin_lock_init(&lmv->lmv_lock);
-       mutex_init(&lmv->init_mutex);
+       mutex_init(&lmv->lmv_init_mutex);
 
 #ifdef LPROCFS
        obd->obd_vars = lprocfs_lmv_obd_vars;
 
 #ifdef LPROCFS
        obd->obd_vars = lprocfs_lmv_obd_vars;