Whamcloud - gitweb
LU-7674 lmv: remove unused placement parameter 19/18019/4
authorJohn L. Hammond <john.hammond@intel.com>
Fri, 15 Jan 2016 17:21:43 +0000 (11:21 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Jul 2016 23:54:17 +0000 (23:54 +0000)
Remove the unused lmv.*.placement parameter along with supporting
functions and struct members.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I20274002ad429550d15c4c204899f897f1c69d0f
Reviewed-on: http://review.whamcloud.com/18019
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd.h
lustre/lmv/lmv_obd.c
lustre/lmv/lproc_lmv.c

index b733c58..4231d02 100644 (file)
@@ -407,20 +407,10 @@ struct lmv_tgt_desc {
        unsigned long           ltd_active:1; /* target up for requests */
 };
 
-enum placement_policy {
-        PLACEMENT_CHAR_POLICY   = 0,
-        PLACEMENT_NID_POLICY    = 1,
-        PLACEMENT_INVAL_POLICY  = 2,
-        PLACEMENT_MAX_POLICY
-};
-
-typedef enum placement_policy placement_policy_t;
-
 struct lmv_obd {
        int                     refcount;
        struct lu_client_fld    lmv_fld;
        spinlock_t              lmv_lock;
-       placement_policy_t      lmv_placement;
        struct lmv_desc         desc;
        struct obd_uuid         cluuid;
        struct obd_export       *exp;
index 32ca60e..69479d1 100644 (file)
@@ -1190,51 +1190,6 @@ hsm_req_err:
         RETURN(rc);
 }
 
-#if 0
-static int lmv_all_chars_policy(int count, const char *name,
-                                int len)
-{
-        unsigned int c = 0;
-
-        while (len > 0)
-                c += name[--len];
-        c = c % count;
-        return c;
-}
-
-static int lmv_nid_policy(struct lmv_obd *lmv)
-{
-        struct obd_import *imp;
-        __u32              id;
-
-        /*
-         * XXX: To get nid we assume that underlying obd device is mdc.
-         */
-        imp = class_exp2cliimp(lmv->tgts[0].ltd_exp);
-        id = imp->imp_connection->c_self ^ (imp->imp_connection->c_self >> 32);
-        return id % lmv->desc.ld_tgt_count;
-}
-
-static int lmv_choose_mds(struct lmv_obd *lmv, struct md_op_data *op_data,
-                          placement_policy_t placement)
-{
-        switch (placement) {
-        case PLACEMENT_CHAR_POLICY:
-                return lmv_all_chars_policy(lmv->desc.ld_tgt_count,
-                                            op_data->op_name,
-                                            op_data->op_namelen);
-        case PLACEMENT_NID_POLICY:
-                return lmv_nid_policy(lmv);
-
-        default:
-                break;
-        }
-
-        CERROR("Unsupported placement policy %x\n", placement);
-        return -EINVAL;
-}
-#endif
-
 /**
  * This is _inode_ placement policy function (not name).
  */
@@ -1373,7 +1328,6 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
        lmv->desc.ld_active_tgt_count = 0;
        lmv->max_def_easize = 0;
        lmv->max_easize = 0;
-       lmv->lmv_placement = PLACEMENT_CHAR_POLICY;
 
        spin_lock_init(&lmv->lmv_lock);
        mutex_init(&lmv->lmv_init_mutex);
index 02ea071..b2c4070 100644 (file)
@@ -60,78 +60,6 @@ static int lmv_numobd_seq_show(struct seq_file *m, void *v)
 }
 LPROC_SEQ_FOPS_RO(lmv_numobd);
 
-static const char *placement_name[] = {
-        [PLACEMENT_CHAR_POLICY] = "CHAR",
-       [PLACEMENT_NID_POLICY]  = "NID",
-       [PLACEMENT_INVAL_POLICY]  = "INVAL"
-};
-
-static placement_policy_t placement_name2policy(char *name, int len)
-{
-        int                     i;
-
-        for (i = 0; i < PLACEMENT_MAX_POLICY; i++) {
-                if (!strncmp(placement_name[i], name, len))
-                        return i;
-        }
-        return PLACEMENT_INVAL_POLICY;
-}
-
-static const char *placement_policy2name(placement_policy_t placement)
-{
-        LASSERT(placement < PLACEMENT_MAX_POLICY);
-        return placement_name[placement];
-}
-
-static int lmv_placement_seq_show(struct seq_file *m, void *v)
-{
-       struct obd_device       *dev = (struct obd_device *)m->private;
-        struct lmv_obd          *lmv;
-
-        LASSERT(dev != NULL);
-        lmv = &dev->u.lmv;
-       seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement));
-       return 0;
-}
-
-#define MAX_POLICY_STRING_SIZE 64
-
-static ssize_t lmv_placement_seq_write(struct file *file,
-                                      const char __user *buffer,
-                                      size_t count, loff_t *off)
-{
-       struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
-        char                     dummy[MAX_POLICY_STRING_SIZE + 1];
-        int                      len = count;
-        placement_policy_t       policy;
-        struct lmv_obd          *lmv;
-
-       if (copy_from_user(dummy, buffer, MAX_POLICY_STRING_SIZE))
-                return -EFAULT;
-
-        LASSERT(dev != NULL);
-        lmv = &dev->u.lmv;
-
-        if (len > MAX_POLICY_STRING_SIZE)
-                len = MAX_POLICY_STRING_SIZE;
-
-        if (dummy[len - 1] == '\n')
-                len--;
-        dummy[len] = '\0';
-
-        policy = placement_name2policy(dummy, len);
-        if (policy != PLACEMENT_INVAL_POLICY) {
-               spin_lock(&lmv->lmv_lock);
-               lmv->lmv_placement = policy;
-               spin_unlock(&lmv->lmv_lock);
-        } else {
-                CERROR("Invalid placement policy \"%s\"!\n", dummy);
-                return -EINVAL;
-        }
-        return count;
-}
-LPROC_SEQ_FOPS(lmv_placement);
-
 static int lmv_activeobd_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device       *dev = (struct obd_device *)m->private;
@@ -229,8 +157,6 @@ LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid);
 struct lprocfs_vars lprocfs_lmv_obd_vars[] = {
        { .name =       "numobd",
          .fops =       &lmv_numobd_fops        },
-       { .name =       "placement",
-         .fops =       &lmv_placement_fops     },
        { .name =       "activeobd",
          .fops =       &lmv_activeobd_fops     },
        { .name =       "uuid",