Whamcloud - gitweb
LU-5814 lov: use obd_get_info() to get def/max LOV EA sizes 95/13695/12
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 26 Mar 2015 04:44:31 +0000 (21:44 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 25 May 2015 02:57:07 +0000 (02:57 +0000)
Use obd_get_info() to get the default and maximum LOV EA sizes (along
with maximum cookiesize) from LOV. Remove the then unused function
obd_size_diskmd() and the unused get info key KEY_LOVDESC. When
computing the maximum LOV EA size use the active OST count
(ld_active_tgt_count) rather than the OST count (ld_tgt_count).

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I4a7eb158d9cb8f4828f5cb272df8d1c843f2eb6b
Reviewed-on: http://review.whamcloud.com/13695
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd.h
lustre/include/obd_class.h
lustre/llite/lcommon_misc.c
lustre/llite/llite_lib.c
lustre/lov/lov_obd.c

index 5613fc4..7568dec 100644 (file)
@@ -722,7 +722,6 @@ enum obd_cleanup_stage {
 #define KEY_INTERMDS            "inter_mds"
 #define KEY_LAST_ID             "last_id"
 #define KEY_LAST_FID           "last_fid"
-#define KEY_LOVDESC             "lovdesc"
 #define KEY_MAX_EASIZE         "max_easize"
 #define KEY_DEFAULT_EASIZE     "default_easize"
 #define KEY_MGSSEC              "mgssec"
index c4ba2fc..c72a60e 100644 (file)
@@ -705,12 +705,6 @@ static inline int obd_packmd(struct obd_export *exp,
         RETURN(rc);
 }
 
-static inline int obd_size_diskmd(struct obd_export *exp,
-                                  struct lov_stripe_md *mem_src)
-{
-        return obd_packmd(exp, NULL, mem_src);
-}
-
 static inline int obd_free_diskmd(struct obd_export *exp,
                                  struct lov_mds_md **disk_tgt)
 {
index a0b0260..6bd4d3e 100644 (file)
  * calculate this (via a call into the LOV + OSCs) each time we make an RPC. */
 static int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
 {
-       struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC_V3 };
-       __u32 valsize = sizeof(struct lov_desc);
-       int rc, easize, def_easize;
-       struct lov_desc desc;
-       __u16 stripes, def_stripes;
+       u32 val_size;
+       u32 max_easize;
+       u32 def_easize;
+       int rc;
        ENTRY;
 
-       rc = obd_get_info(NULL, dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC,
-                         &valsize, &desc);
-        if (rc)
-                RETURN(rc);
+       val_size = sizeof(max_easize);
+       rc = obd_get_info(NULL, dt_exp, sizeof(KEY_MAX_EASIZE), KEY_MAX_EASIZE,
+                         &val_size, &max_easize);
+       if (rc != 0)
+               RETURN(rc);
 
-        stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
-        lsm.lsm_stripe_count = stripes;
-        easize = obd_size_diskmd(dt_exp, &lsm);
+       val_size = sizeof(def_easize);
+       rc = obd_get_info(NULL, dt_exp, sizeof(KEY_DEFAULT_EASIZE),
+                         KEY_DEFAULT_EASIZE, &val_size, &def_easize);
+       if (rc != 0)
+               RETURN(rc);
 
-       def_stripes = min_t(__u32, desc.ld_default_stripe_count,
-                           LOV_MAX_STRIPE_COUNT);
-       lsm.lsm_stripe_count = def_stripes;
-       def_easize = obd_size_diskmd(dt_exp, &lsm);
+       /* default cookiesize is 0 because from 2.4 server doesn't send
+        * llog cookies to client. */
+       CDEBUG(D_HA, "updating def/max_easize: %d/%d\n",
+              def_easize, max_easize);
 
-       CDEBUG(D_HA, "updating def/max_easize: %d/%d\n", def_easize, easize);
-
-       rc = md_init_ea_size(md_exp, easize, def_easize);
+       rc = md_init_ea_size(md_exp, max_easize, def_easize);
        RETURN(rc);
 }
 
index 381fdc4..81d70f3 100644 (file)
@@ -631,7 +631,15 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
 {
        int size, rc;
 
-       *lmmsize = obd_size_diskmd(sbi->ll_dt_exp, NULL);
+       size = sizeof(*lmmsize);
+       rc = obd_get_info(NULL, sbi->ll_dt_exp, sizeof(KEY_MAX_EASIZE),
+                         KEY_MAX_EASIZE, &size, lmmsize);
+       if (rc != 0) {
+               CERROR("%s: cannot get max LOV EA size: rc = %d\n",
+                      sbi->ll_dt_exp->exp_obd->obd_name, rc);
+               RETURN(rc);
+       }
+
        size = sizeof(int);
        rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_MAX_EASIZE),
                          KEY_MAX_EASIZE, &size, lmmsize);
index 354f9ff..fcdfbca 100644 (file)
@@ -1298,29 +1298,34 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp,
 {
        struct obd_device *obddev = class_exp2obd(exp);
        struct lov_obd *lov = &obddev->u.lov;
-       int rc;
-        ENTRY;
+       struct lov_desc *ld = &lov->desc;
+       int rc = 0;
+       ENTRY;
 
-        if (!vallen || !val)
-                RETURN(-EFAULT);
+       if (vallen == NULL || val == NULL)
+               RETURN(-EFAULT);
 
-        obd_getref(obddev);
+       obd_getref(obddev);
 
-       if (KEY_IS(KEY_LOVDESC)) {
-                struct lov_desc *desc_ret = val;
-                *desc_ret = lov->desc;
+       if (KEY_IS(KEY_MAX_EASIZE)) {
+               u32 max_stripe_count = min_t(u32, ld->ld_active_tgt_count,
+                                            LOV_MAX_STRIPE_COUNT);
 
-                GOTO(out, rc = 0);
-        } else if (KEY_IS(KEY_TGT_COUNT)) {
-                *((int *)val) = lov->desc.ld_tgt_count;
-                GOTO(out, rc = 0);
-        }
+               *((u32 *)val) = lov_mds_md_size(max_stripe_count, LOV_MAGIC_V3);
+       } else if (KEY_IS(KEY_DEFAULT_EASIZE)) {
+               u32 def_stripe_count = min_t(u32, ld->ld_default_stripe_count,
+                                            LOV_MAX_STRIPE_COUNT);
 
-        rc = -EINVAL;
+               *((u32 *)val) = lov_mds_md_size(def_stripe_count, LOV_MAGIC_V3);
+       } else if (KEY_IS(KEY_TGT_COUNT)) {
+               *((int *)val) = lov->desc.ld_tgt_count;
+       } else {
+               rc = -EINVAL;
+       }
 
-out:
-        obd_putref(obddev);
-        RETURN(rc);
+       obd_putref(obddev);
+
+       RETURN(rc);
 }
 
 static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,