Whamcloud - gitweb
LU-3222 ofd: use of ofd_XXX helpers 80/8780/5
authorEmoly Liu <emoly.liu@intel.com>
Wed, 21 May 2014 14:48:32 +0000 (10:48 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 30 May 2014 04:00:33 +0000 (04:00 +0000)
Replace explicit use of some obd fields by ofd helpers.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I83bf64f0f41eac834b47c216d02f9cac8d505207
Reviewed-on: http://review.whamcloud.com/8780
Tested-by: Jenkins
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_grant.c
lustre/ofd/ofd_io.c
lustre/ofd/ofd_lvb.c
lustre/ofd/ofd_obd.c

index 0f0d51a..ae96044 100644 (file)
@@ -81,7 +81,7 @@ static int ofd_connect_to_next(const struct lu_env *env, struct ofd_device *m,
        obd = class_name2obd(next);
        if (obd == NULL) {
                CERROR("%s: can't locate next device: %s\n",
        obd = class_name2obd(next);
        if (obd == NULL) {
                CERROR("%s: can't locate next device: %s\n",
-                      m->ofd_dt_dev.dd_lu_dev.ld_obd->obd_name, next);
+                      ofd_name(m), next);
                GOTO(out, rc = -ENOTCONN);
        }
 
                GOTO(out, rc = -ENOTCONN);
        }
 
@@ -91,7 +91,7 @@ static int ofd_connect_to_next(const struct lu_env *env, struct ofd_device *m,
        rc = obd_connect(NULL, exp, obd, &obd->obd_uuid, data, NULL);
        if (rc) {
                CERROR("%s: cannot connect to next dev %s: rc = %d\n",
        rc = obd_connect(NULL, exp, obd, &obd->obd_uuid, data, NULL);
        if (rc) {
                CERROR("%s: cannot connect to next dev %s: rc = %d\n",
-                      m->ofd_dt_dev.dd_lu_dev.ld_obd->obd_name, next, rc);
+                      ofd_name(m), next, rc);
                GOTO(out, rc);
        }
 
                GOTO(out, rc);
        }
 
@@ -405,7 +405,7 @@ static int ofd_lfsck_out_notify(const struct lu_env *env, void *data,
        }
        default:
                CERROR("%s: unknown lfsck event: rc = %d\n",
        }
        default:
                CERROR("%s: unknown lfsck event: rc = %d\n",
-                      ofd_obd(ofd)->obd_name, event);
+                      ofd_name(ofd), event);
                return -EINVAL;
        }
 
                return -EINVAL;
        }
 
index d662ec2..a1819fc 100644 (file)
@@ -955,7 +955,7 @@ int ofd_grant_create(const struct lu_env *env, struct obd_export *exp, int *nr)
            (ofd->ofd_osfs.os_blocks >> 10)) {
                spin_unlock(&ofd->ofd_grant_lock);
                CDEBUG(D_RPCTRACE, "%s: not enough space for create "LPU64"\n",
            (ofd->ofd_osfs.os_blocks >> 10)) {
                spin_unlock(&ofd->ofd_grant_lock);
                CDEBUG(D_RPCTRACE, "%s: not enough space for create "LPU64"\n",
-                      ofd_obd(ofd)->obd_name,
+                      ofd_name(ofd),
                       ofd->ofd_osfs.os_bavail * ofd->ofd_osfs.os_blocks);
                RETURN(-ENOSPC);
        }
                       ofd->ofd_osfs.os_bavail * ofd->ofd_osfs.os_blocks);
                RETURN(-ENOSPC);
        }
index cdc5940..fcb1c8d 100644 (file)
@@ -74,8 +74,7 @@ static void ofd_inconsistency_verify_one(const struct lu_env *env,
                        CDEBUG(D_LFSCK, "%s: fail to verify OST local stored "
                               "PFID xattr for "DFID", the client given PFID "
                               DFID", OST local stored PFID "DFID": rc = %d\n",
                        CDEBUG(D_LFSCK, "%s: fail to verify OST local stored "
                               "PFID xattr for "DFID", the client given PFID "
                               DFID", OST local stored PFID "DFID": rc = %d\n",
-                              ofd_obd(ofd)->obd_name,
-                              PFID(&fo->ofo_header.loh_fid),
+                              ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
                               PFID(&oii->oii_pfid), PFID(pfid), rc);
                else
                        fo->ofo_pfid_verified = 1;
                               PFID(&oii->oii_pfid), PFID(pfid), rc);
                else
                        fo->ofo_pfid_verified = 1;
@@ -88,16 +87,14 @@ static void ofd_inconsistency_verify_one(const struct lu_env *env,
                        CDEBUG(D_LFSCK, "%s: fail to verify the client given "
                               "PFID for "DFID", the client given PFID "DFID
                               ", local stored PFID "DFID": rc = %d\n",
                        CDEBUG(D_LFSCK, "%s: fail to verify the client given "
                               "PFID for "DFID", the client given PFID "DFID
                               ", local stored PFID "DFID": rc = %d\n",
-                              ofd_obd(ofd)->obd_name,
-                              PFID(&fo->ofo_header.loh_fid),
+                              ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
                               PFID(&oii->oii_pfid), PFID(pfid), rc);
                else
                        CDEBUG(D_LFSCK, "%s: both the client given PFID and "
                               "the OST local stored PFID are stale for the "
                               "OST-object "DFID", client given PFID is "DFID
                               ", local stored PFID is "DFID"\n",
                               PFID(&oii->oii_pfid), PFID(pfid), rc);
                else
                        CDEBUG(D_LFSCK, "%s: both the client given PFID and "
                               "the OST local stored PFID are stale for the "
                               "OST-object "DFID", client given PFID is "DFID
                               ", local stored PFID is "DFID"\n",
-                              ofd_obd(ofd)->obd_name,
-                              PFID(&fo->ofo_header.loh_fid),
+                              ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
                               PFID(&oii->oii_pfid), PFID(pfid));
                break;
        case LPVS_INCONSISTENT_TOFIX:
                               PFID(&oii->oii_pfid), PFID(pfid));
                break;
        case LPVS_INCONSISTENT_TOFIX:
@@ -107,15 +104,13 @@ static void ofd_inconsistency_verify_one(const struct lu_env *env,
                        CDEBUG(D_LFSCK, "%s: fixed the staled OST PFID xattr "
                               "for "DFID", with the client given PFID "DFID
                               ", the old stored PFID "DFID"\n",
                        CDEBUG(D_LFSCK, "%s: fixed the staled OST PFID xattr "
                               "for "DFID", with the client given PFID "DFID
                               ", the old stored PFID "DFID"\n",
-                              ofd_obd(ofd)->obd_name,
-                              PFID(&fo->ofo_header.loh_fid),
+                              ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
                               PFID(&oii->oii_pfid), PFID(pfid));
                } else {
                        CDEBUG(D_LFSCK, "%s: fail to fix the OST PFID xattr "
                               "for "DFID", client given PFID "DFID", local "
                               "stored PFID "DFID": rc = %d\n",
                               PFID(&oii->oii_pfid), PFID(pfid));
                } else {
                        CDEBUG(D_LFSCK, "%s: fail to fix the OST PFID xattr "
                               "for "DFID", client given PFID "DFID", local "
                               "stored PFID "DFID": rc = %d\n",
-                              ofd_obd(ofd)->obd_name,
-                              PFID(&fo->ofo_header.loh_fid),
+                              ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
                               PFID(&oii->oii_pfid), PFID(pfid), rc);
                }
                *pfid = oii->oii_pfid;
                               PFID(&oii->oii_pfid), PFID(pfid), rc);
                }
                *pfid = oii->oii_pfid;
@@ -233,7 +228,7 @@ int ofd_start_inconsistency_verification_thread(struct ofd_device *ofd)
        if (IS_ERR(task)) {
                rc = PTR_ERR(task);
                CERROR("%s: cannot start self_repair thread: rc = %d\n",
        if (IS_ERR(task)) {
                rc = PTR_ERR(task);
                CERROR("%s: cannot start self_repair thread: rc = %d\n",
-                      ofd_obd(ofd)->obd_name, rc);
+                      ofd_name(ofd), rc);
        } else {
                rc = 0;
                l_wait_event(thread->t_ctl_waitq,
        } else {
                rc = 0;
                l_wait_event(thread->t_ctl_waitq,
@@ -279,7 +274,7 @@ static void ofd_add_inconsistency_item(const struct lu_env *env,
                CERROR("%s: cannot alloc memory for verify OST-object "
                       "consistency for "DFID", client given PFID "DFID
                       ", local stored PFID "DFID"\n",
                CERROR("%s: cannot alloc memory for verify OST-object "
                       "consistency for "DFID", client given PFID "DFID
                       ", local stored PFID "DFID"\n",
-                      ofd_obd(ofd)->obd_name, PFID(&fo->ofo_header.loh_fid),
+                      ofd_name(ofd), PFID(&fo->ofo_header.loh_fid),
                       oa->o_parent_seq, oa->o_parent_oid, oa->o_stripe_idx,
                       PFID(&fo->ofo_pfid));
 
                       oa->o_parent_seq, oa->o_parent_oid, oa->o_stripe_idx,
                       PFID(&fo->ofo_pfid));
 
index 8fedc75..3105174 100644 (file)
@@ -154,7 +154,7 @@ static int ofd_lvbo_update(struct ldlm_resource *res,
        lvb = res->lr_lvb_data;
        if (lvb == NULL) {
                CERROR("%s: no LVB data for "DFID"\n",
        lvb = res->lr_lvb_data;
        if (lvb == NULL) {
                CERROR("%s: no LVB data for "DFID"\n",
-                      ofd_obd(ofd)->obd_name, PFID(&info->fti_fid));
+                      ofd_name(ofd), PFID(&info->fti_fid));
                GOTO(out_env, rc = 0);
        }
 
                GOTO(out_env, rc = 0);
        }
 
index 9c62c8b..4255c04 100644 (file)
@@ -312,7 +312,7 @@ out:
 
 int ofd_obd_disconnect(struct obd_export *exp)
 {
 
 int ofd_obd_disconnect(struct obd_export *exp)
 {
-       struct ofd_device       *ofd = ofd_dev(exp->exp_obd->obd_lu_dev);
+       struct ofd_device       *ofd = ofd_exp(exp);
        struct lu_env            env;
        int                      rc;
 
        struct lu_env            env;
        int                      rc;
 
@@ -370,7 +370,7 @@ static int ofd_init_export(struct obd_export *exp)
 
 static int ofd_destroy_export(struct obd_export *exp)
 {
 
 static int ofd_destroy_export(struct obd_export *exp)
 {
-       struct ofd_device *ofd = ofd_dev(exp->exp_obd->obd_lu_dev);
+       struct ofd_device *ofd = ofd_exp(exp);
 
        if (exp->exp_filter_data.fed_pending)
                CERROR("%s: cli %s/%p has %lu pending on destroyed export"
 
        if (exp->exp_filter_data.fed_pending)
                CERROR("%s: cli %s/%p has %lu pending on destroyed export"
@@ -413,14 +413,14 @@ int ofd_postrecov(const struct lu_env *env, struct ofd_device *ofd)
        struct lfsck_start_param lsp;
        int rc;
 
        struct lfsck_start_param lsp;
        int rc;
 
-       CDEBUG(D_HA, "%s: recovery is over\n", ofd_obd(ofd)->obd_name);
+       CDEBUG(D_HA, "%s: recovery is over\n", ofd_name(ofd));
 
        lsp.lsp_start = NULL;
        lsp.lsp_index_valid = 0;
        rc = lfsck_start(env, ofd->ofd_osd, &lsp);
        if (rc != 0 && rc != -EALREADY)
                CWARN("%s: auto trigger paused LFSCK failed: rc = %d\n",
 
        lsp.lsp_start = NULL;
        lsp.lsp_index_valid = 0;
        rc = lfsck_start(env, ofd->ofd_osd, &lsp);
        if (rc != 0 && rc != -EALREADY)
                CWARN("%s: auto trigger paused LFSCK failed: rc = %d\n",
-                     ofd_obd(ofd)->obd_name, rc);
+                     ofd_name(ofd), rc);
 
        return ldev->ld_ops->ldo_recovery_complete(env, ldev);
 }
 
        return ldev->ld_ops->ldo_recovery_complete(env, ldev);
 }
@@ -606,7 +606,7 @@ int ofd_statfs(const struct lu_env *env,  struct obd_export *exp,
               struct obd_statfs *osfs, __u64 max_age, __u32 flags)
 {
         struct obd_device      *obd = class_exp2obd(exp);
               struct obd_statfs *osfs, __u64 max_age, __u32 flags)
 {
         struct obd_device      *obd = class_exp2obd(exp);
-       struct ofd_device       *ofd = ofd_dev(exp->exp_obd->obd_lu_dev);
+       struct ofd_device       *ofd = ofd_exp(exp);
        int                      rc;
 
        ENTRY;
        int                      rc;
 
        ENTRY;