Whamcloud - gitweb
LU-8837 lustre: remove target declarations from obd.h 52/41952/11
authorMr NeilBrown <neilb@suse.de>
Wed, 23 Nov 2022 21:35:25 +0000 (16:35 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 6 Dec 2022 02:43:00 +0000 (02:43 +0000)
lu_target.h and obd_target.h are only needed in obd.h
for some structs in obd_device.u.  We don't really need to mention
these structs in the union as they are all quite small.

So we can define accessor function that cast a pointer to the union
into the required type, and then we can completely remove these
includes from obd.h

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I9b314b0bfc1baae03ccb8eadf134964ea308f638
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/41952
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
30 files changed:
lustre/fld/fld_handler.c
lustre/include/lu_target.h
lustre/include/lustre_quota.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/include/obd_target.h
lustre/ldlm/ldlm_lib.c
lustre/lfsck/lfsck_bookmark.c
lustre/lfsck/lfsck_lib.c
lustre/lfsck/lfsck_namespace.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_object.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_lproc.c
lustre/mgs/mgs_fs.c
lustre/mgs/mgs_handler.c
lustre/obdclass/lprocfs_jobstats.c
lustre/obdclass/lprocfs_status_server.c
lustre/obdecho/echo.c
lustre/ofd/lproc_ofd.c
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_internal.h
lustre/ost/ost_handler.c
lustre/ptlrpc/nodemap_storage.c
lustre/quota/lquota_internal.h
lustre/target/tgt_fmd.c
lustre/target/tgt_grant.c
lustre/target/tgt_lastrcvd.c
lustre/target/tgt_main.c
lustre/target/tgt_mount.c

index 6f01007..7b2bcf9 100644 (file)
@@ -44,6 +44,7 @@
 
 #include <obd.h>
 #include <obd_support.h>
+#include <lu_target.h>
 #include <lustre_fid.h>
 #include <lustre_fld.h>
 #include <lustre_req_layout.h>
index f2286c5..43f015d 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef _LUSTRE_LU_TARGET_H
 #define _LUSTRE_LU_TARGET_H
 
-#include <dt_object.h>
+#include <lustre_quota.h>
 #include <lustre_export.h>
 #include <lustre_update.h>
 #include <lustre_disk.h>
index c1d5828..58d3b88 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/quota.h>
 #include <linux/quotaops.h>
 #include <linux/sort.h>
-#include <dt_object.h>
 #include <lustre_fid.h>
 #include <lustre_dlm.h>
 
index f556eb9..5ce322b 100644 (file)
 
 #include <uapi/linux/lustre/lustre_idl.h>
 #include <lustre_lib.h>
-#ifdef HAVE_SERVER_SUPPORT
-# include <lu_target.h>
-# include <obd_target.h>
-# include <lustre_quota.h>
-#endif
 #include <lu_ref.h>
 #include <lustre_export.h>
 #include <lustre_fid.h>
@@ -714,12 +709,6 @@ struct obd_device {
        struct list_head                obd_final_req_queue;
 
        union {
-#ifdef HAVE_SERVER_SUPPORT
-               struct obd_device_target obt;
-               struct filter_obd filter;
-               struct ost_obd ost;
-               struct echo_obd echo;
-#endif
                struct client_obd cli;
                struct echo_client_obd echo_client;
                struct lov_obd lov;
index 35ae464..a86e274 100644 (file)
 #include <lustre_lib.h>
 #include <uapi/linux/lustre/lustre_idl.h>
 #include <lprocfs_status.h>
+#ifdef HAVE_SERVER_SUPPORT
+#include <lu_target.h>
+#include <obd_target.h>
 #include <dt_object.h>
+#endif
 
 #define OBD_STATFS_NODELAY     0x0001  /* requests should be send without delay
                                         * and resends for avoid deadlocks */
@@ -388,16 +392,21 @@ static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
 #ifdef HAVE_SERVER_SUPPORT
 static inline struct lu_target *class_exp2tgt(struct obd_export *exp)
 {
-        LASSERT(exp->exp_obd);
-       if (exp->exp_obd->u.obt.obt_magic != OBT_MAGIC)
+       struct obd_device_target *obt;
+
+       LASSERT(exp->exp_obd);
+       obt = (void *)&exp->exp_obd->u;
+       if (obt->obt_magic != OBT_MAGIC)
                return NULL;
-        return exp->exp_obd->u.obt.obt_lut;
+       return obt->obt_lut;
 }
 
 static inline struct lr_server_data *class_server_data(struct obd_device *obd)
 {
-        LASSERT(obd->u.obt.obt_lut);
-        return &obd->u.obt.obt_lut->lut_lsd;
+       struct obd_device_target *obt = obd2obt(obd);
+
+       LASSERT(obt);
+       return &obt->obt_lut->lut_lsd;
 }
 #endif
 
@@ -559,9 +568,11 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
                        if (!IS_ERR(dev)) {
                                obd->obd_lu_dev = dev;
                                dev->ld_obd = obd;
+#ifdef HAVE_SERVER_SUPPORT
                                if (lu_device_is_dt(dev) &&
                                    lu2dt_dev(dev)->dd_rdonly)
                                        obd->obd_read_only = 1;
+#endif
                                rc = 0;
                        } else
                                rc = PTR_ERR(dev);
index 60337ca..567be84 100644 (file)
@@ -31,6 +31,7 @@
 #ifndef __OBD_TARGET_H
 #define __OBD_TARGET_H
 #include <lprocfs_status.h>
+#include <obd.h>
 
 /* server-side individual type definitions */
 
@@ -47,11 +48,6 @@ struct obd_device_target {
 
 #define OBJ_SUBDIR_COUNT 32 /* set to zero for no subdirs */
 
-struct filter_obd {
-       /* NB this field MUST be first */
-       struct obd_device_target         fo_obt;
-};
-
 struct echo_obd {
        struct obd_device_target        eo_obt;
        struct obdo                     eo_oa;
@@ -70,4 +66,54 @@ struct ost_obd {
        struct mutex             ost_health_mutex;
 };
 
+static inline struct obd_device_target *obd2obt(struct obd_device *obd)
+{
+       struct obd_device_target *obt;
+
+       BUILD_BUG_ON(sizeof(obd->u) < sizeof(*obt));
+
+       if (!obd)
+               return NULL;
+       obt = (void *)&obd->u;
+       LASSERT(obt->obt_magic == OBT_MAGIC);
+       return obt;
+}
+
+static inline struct obd_device_target *obd_obt_init(struct obd_device *obd)
+{
+       struct obd_device_target *obt;
+
+       obt = (void *)&obd->u;
+       obt->obt_magic = OBT_MAGIC;
+       obt->obt_instance = 0;
+
+       return obt;
+}
+
+static inline struct echo_obd *obd2echo(struct obd_device *obd)
+{
+       struct echo_obd *echo;
+
+       BUILD_BUG_ON(sizeof(obd->u) < sizeof(*echo));
+
+       if (!obd)
+               return NULL;
+       echo = (void *)&obd->u;
+
+       return echo;
+}
+
+static inline struct ost_obd *obd2ost(struct obd_device *obd)
+{
+       struct ost_obd *ost;
+
+       BUILD_BUG_ON(sizeof(obd->u) < sizeof(*ost));
+
+       if (!obd)
+               return NULL;
+       ost = (void *)&obd->u;
+
+       return ost;
+}
+
 #endif /* __OBD_TARGET_H */
index 9eea19a..cbca1a6 100644 (file)
@@ -1472,8 +1472,7 @@ dont_check_exports:
        if (rc)
                GOTO(out, rc);
 
-       LASSERT(target->u.obt.obt_magic == OBT_MAGIC);
-       data->ocd_instance = target->u.obt.obt_instance;
+       data->ocd_instance = obd2obt(target)->obt_instance;
 
        /*
         * Return only the parts of obd_connect_data that we understand, so the
@@ -2026,7 +2025,7 @@ check_and_start_recovery_timer(struct obd_device *obd,
                               int new_client)
 {
        timeout_t service_timeout = lustre_msg_get_service_timeout(req->rq_reqmsg);
-       struct obd_device_target *obt = &obd->u.obt;
+       struct obd_device_target *obt = obd2obt(obd);
 
        if (!new_client && service_timeout)
                /*
index e8f1ec9..88753b1 100644 (file)
@@ -33,6 +33,7 @@
 #include <lu_object.h>
 #include <dt_object.h>
 #include <lustre_fid.h>
+#include <lu_target.h>
 
 #include "lfsck_internal.h"
 
index 2830920..421e65f 100644 (file)
@@ -41,6 +41,7 @@
 #include <lustre_lib.h>
 #include <lustre_net.h>
 #include <lustre_lfsck.h>
+#include <lu_target.h>
 
 #include "lfsck_internal.h"
 
index 0929245..34a3ed5 100644 (file)
@@ -36,6 +36,7 @@
 #include <lustre_fid.h>
 #include <lustre_lib.h>
 #include <lustre_net.h>
+#include <lu_target.h>
 
 #include "lfsck_internal.h"
 
index 7082b41..b295a0d 100644 (file)
@@ -1153,10 +1153,12 @@ static void mdd_device_shutdown(const struct lu_env *env, struct mdd_device *m,
        mdd_changelog_fini(env, m);
        mdd_orphan_index_fini(env, m);
        mdd_dot_lustre_cleanup(env, m);
-       if (mdd2obd_dev(m)->u.obt.obt_nodemap_config_file) {
+       if (obd2obt(mdd2obd_dev(m))->obt_nodemap_config_file) {
+               struct obd_device_target *obt = obd2obt(mdd2obd_dev(m));
+
                nm_config_file_deregister_tgt(env,
-                               mdd2obd_dev(m)->u.obt.obt_nodemap_config_file);
-               mdd2obd_dev(m)->u.obt.obt_nodemap_config_file = NULL;
+                                             obt->obt_nodemap_config_file);
+               obt->obt_nodemap_config_file = NULL;
        }
        if (m->mdd_los != NULL) {
                local_oid_storage_fini(env, m->mdd_los);
@@ -1276,7 +1278,7 @@ static int mdd_prepare(const struct lu_env *env,
        struct mdd_device *mdd = lu2mdd_dev(cdev);
        struct lu_device *next = &mdd->mdd_child->dd_lu_dev;
        struct nm_config_file *nodemap_config;
-       struct obd_device_target *obt = &mdd2obd_dev(mdd)->u.obt;
+       struct obd_device_target *obt = obd2obt(mdd2obd_dev(mdd));
        struct dt_object *root = NULL;
        struct thandle *th = NULL;
        struct lu_fid fid;
index 033b95a..0144b28 100644 (file)
@@ -271,6 +271,7 @@ struct lu_object *mdd_object_alloc(const struct lu_env *env,
                                   const struct lu_object_header *hdr,
                                   struct lu_device *d)
 {
+       struct mdd_device *mdd = lu2mdd_dev(d);
        struct mdd_object *mdd_obj;
        struct lu_object *o;
 
@@ -283,6 +284,7 @@ struct lu_object *mdd_object_alloc(const struct lu_env *env,
        mdd_obj->mod_obj.mo_ops = &mdd_obj_ops;
        mdd_obj->mod_obj.mo_dir_ops = &mdd_dir_ops;
        mdd_obj->mod_count = 0;
+       obd_obt_init(mdd2obd_dev(mdd));
        o->lo_ops = &mdd_lu_obj_ops;
        INIT_LIST_HEAD(&mdd_obj->mod_users);
 
index ae06dbf..4b6e3b5 100644 (file)
@@ -5979,7 +5979,7 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
                if (rc)
                        RETURN(rc);
 
-               obd->u.obt.obt_magic = OBT_MAGIC;
+               obd_obt_init(obd);
                if (lsi->lsi_lmd->lmd_flags & LMD_FLG_SKIP_LFSCK)
                        m->mdt_skip_lfsck = 1;
        }
@@ -6981,7 +6981,7 @@ static int mdt_destroy_export(struct obd_export *exp)
         */
        tgt_grant_discard(exp);
        if (exp_connect_flags(exp) & OBD_CONNECT_GRANT)
-               exp->exp_obd->u.obt.obt_lut->lut_tgd.tgd_tot_granted_clients--;
+               obd2obt(exp->exp_obd)->obt_lut->lut_tgd.tgd_tot_granted_clients--;
 
        if (!(exp->exp_flags & OBD_OPT_FORCE))
                tgt_grant_sanity_check(exp->exp_obd, __func__);
index a43fe90..0965d34 100644 (file)
@@ -543,7 +543,7 @@ static ssize_t local_recovery_show(struct kobject *kobj,
                                              obd_kset.kobj);
 
        return scnprintf(buf, PAGE_SIZE, "%u\n",
-                        obd->u.obt.obt_lut->lut_local_recovery);
+                        obd2obt(obd)->obt_lut->lut_local_recovery);
 }
 
 static ssize_t local_recovery_store(struct kobject *kobj,
@@ -559,7 +559,7 @@ static ssize_t local_recovery_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       obd->u.obt.obt_lut->lut_local_recovery = !!val;
+       obd2obt(obd)->obt_lut->lut_local_recovery = !!val;
        return count;
 }
 LUSTRE_RW_ATTR(local_recovery);
@@ -949,7 +949,7 @@ static ssize_t sync_count_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *tgt = obd->u.obt.obt_lut;
+       struct lu_target *tgt = obd2obt(obd)->obt_lut;
 
        return scnprintf(buf, PAGE_SIZE, "%d\n",
                         atomic_read(&tgt->lut_sync_count));
@@ -960,7 +960,7 @@ static ssize_t sync_count_store(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *tgt = obd->u.obt.obt_lut;
+       struct lu_target *tgt = obd2obt(obd)->obt_lut;
        int val;
        int rc;
 
@@ -1400,7 +1400,7 @@ static ssize_t checksum_t10pi_enforce_show(struct kobject *kobj,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
 
        return scnprintf(buf, PAGE_SIZE, "%u\n", lut->lut_cksum_t10pi_enforce);
 }
@@ -1432,7 +1432,7 @@ static ssize_t checksum_t10pi_enforce_store(struct kobject *kobj,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
        bool enforce;
        int rc;
 
@@ -1462,8 +1462,7 @@ static int mdt_checksum_type_seq_show(struct seq_file *m, void *data)
        if (!obd)
                return 0;
 
-       lut = obd->u.obt.obt_lut;
-
+       lut = obd2obt(obd)->obt_lut;
        /* select fastest checksum type on the server */
        pref = obd_cksum_type_select(obd->obd_name,
                                     lut->lut_cksum_types_supported, 0);
@@ -1625,7 +1624,7 @@ void mdt_counter_incr(struct ptlrpc_request *req, int opcode, long amount)
        if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats != NULL)
                lprocfs_counter_add(exp->exp_nid_stats->nid_stats, opcode,
                                    amount);
-       if (exp->exp_obd && exp->exp_obd->u.obt.obt_jobstats.ojs_hash &&
+       if (exp->exp_obd && obd2obt(exp->exp_obd)->obt_jobstats.ojs_hash &&
            (exp_connect_flags(exp) & OBD_CONNECT_JOBSTATS))
                lprocfs_job_stats_log(exp->exp_obd,
                                      lustre_msg_get_jobid(req->rq_reqmsg),
index d2bc246..880b374 100644 (file)
@@ -190,7 +190,7 @@ int mgs_fs_setup(const struct lu_env *env, struct mgs_device *mgs)
                       mgs->mgs_obd->obd_name, PTR_ERR(nm_config_file));
                GOTO(out_configs, rc = PTR_ERR(nm_config_file));
        }
-       mgs->mgs_obd->u.obt.obt_nodemap_config_file = nm_config_file;
+       obd2obt(mgs->mgs_obd)->obt_nodemap_config_file = nm_config_file;
 
        /* create directory to store nid table versions */
        o = local_file_find_or_create(env, mgs->mgs_los, root, MGS_NIDTBL_DIR,
@@ -203,7 +203,7 @@ int mgs_fs_setup(const struct lu_env *env, struct mgs_device *mgs)
 out_nm:
        if (rc < 0) {
                nm_config_file_deregister_mgs(env, nm_config_file);
-               mgs->mgs_obd->u.obt.obt_nodemap_config_file = NULL;
+               obd2obt(mgs->mgs_obd)->obt_nodemap_config_file = NULL;
        }
 out_configs:
        if (rc < 0) {
@@ -255,12 +255,12 @@ int mgs_fs_cleanup(const struct lu_env *env, struct mgs_device *mgs)
                dt_object_put(env, mgs->mgs_nidtbl_dir);
                mgs->mgs_nidtbl_dir = NULL;
        }
-       if (mgs->mgs_obd->u.obt.obt_nodemap_config_file != NULL) {
+       if (obd2obt(mgs->mgs_obd)->obt_nodemap_config_file != NULL) {
                struct nm_config_file *ncf;
 
-               ncf = mgs->mgs_obd->u.obt.obt_nodemap_config_file;
+               ncf = obd2obt(mgs->mgs_obd)->obt_nodemap_config_file;
                nm_config_file_deregister_mgs(env, ncf);
-               mgs->mgs_obd->u.obt.obt_nodemap_config_file = NULL;
+               obd2obt(mgs->mgs_obd)->obt_nodemap_config_file = NULL;
        }
 
        if (mgs->mgs_los) {
index cf4d69f..768fa9e 100644 (file)
@@ -1283,8 +1283,7 @@ static int mgs_init0(const struct lu_env *env, struct mgs_device *mgs,
        mgs->mgs_obd = obd;
        mgs->mgs_obd->obd_lu_dev = &mgs->mgs_dt_dev.dd_lu_dev;
 
-       obd->u.obt.obt_magic = OBT_MAGIC;
-       obd->u.obt.obt_instance = 0;
+       obd_obt_init(obd);
 
        /* namespace for mgs llog */
        obd->obd_namespace = ldlm_namespace_new(obd ,"MGS",
index 5eca82e..df1e152 100644 (file)
@@ -276,7 +276,7 @@ static struct job_stat *job_alloc(char *jobid, struct obd_job_stats *jobs)
 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
                          int event, long amount)
 {
-       struct obd_job_stats *stats = &obd->u.obt.obt_jobstats;
+       struct obd_job_stats *stats = &obd2obt(obd)->obt_jobstats;
        struct job_stat *job, *job2;
        ENTRY;
 
@@ -335,7 +335,7 @@ EXPORT_SYMBOL(lprocfs_job_stats_log);
 
 void lprocfs_job_stats_fini(struct obd_device *obd)
 {
-       struct obd_job_stats *stats = &obd->u.obt.obt_jobstats;
+       struct obd_job_stats *stats = &obd2obt(obd)->obt_jobstats;
 
        if (stats->ojs_hash == NULL)
                return;
@@ -617,7 +617,7 @@ int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
                       obd->obd_name, obd->obd_type->typ_name, -EINVAL);
                RETURN(-EINVAL);
        }
-       stats = &obd->u.obt.obt_jobstats;
+       stats = &obd2obt(obd)->obt_jobstats;
 
        LASSERT(stats->ojs_hash == NULL);
        stats->ojs_hash = cfs_hash_create("JOB_STATS",
@@ -660,7 +660,7 @@ ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
        struct obd_job_stats *stats;
        struct timespec64 ts;
 
-       stats = &obd->u.obt.obt_jobstats;
+       stats = &obd2obt(obd)->obt_jobstats;
        ts = ktime_to_timespec64(stats->ojs_cleanup_interval);
 
        return scnprintf(buf, PAGE_SIZE, "%lld\n", (long long)ts.tv_sec * 2);
@@ -677,7 +677,7 @@ ssize_t job_cleanup_interval_store(struct kobject *kobj,
        unsigned int val;
        int rc;
 
-       stats = &obd->u.obt.obt_jobstats;
+       stats = &obd2obt(obd)->obt_jobstats;
 
        rc = kstrtouint(buffer, 0, &val);
        if (rc)
index fe1dabe..6c3230e 100644 (file)
@@ -925,7 +925,7 @@ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
                goto out;
        }
 
-       tdtd = obd->u.obt.obt_lut->lut_tdtd;
+       tdtd = obd2obt(obd)->obt_lut->lut_tdtd;
        if (tdtd && tdtd->tdtd_show_update_logs_retrievers) {
                char *buf;
                int size = 0;
@@ -1112,10 +1112,10 @@ ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct obd_device_target *target = &obd->u.obt;
+       struct obd_device_target *target = obd2obt(obd);
 
        LASSERT(target->obt_magic == OBT_MAGIC);
-       return scnprintf(buf, PAGE_SIZE, "%u\n", obd->u.obt.obt_instance);
+       return scnprintf(buf, PAGE_SIZE, "%u\n", obd2obt(obd)->obt_instance);
 }
 EXPORT_SYMBOL(instance_show);
 
index 720b0e3..6243709 100644 (file)
@@ -122,10 +122,11 @@ static int echo_destroy_export(struct obd_export *exp)
 static u64 echo_next_id(struct obd_device *obd)
 {
        u64 id;
+       struct echo_obd *echo = obd2echo(obd);
 
-       spin_lock(&obd->u.echo.eo_lock);
-       id = ++obd->u.echo.eo_lastino;
-       spin_unlock(&obd->u.echo.eo_lock);
+       spin_lock(&echo->eo_lock);
+       id = ++echo->eo_lastino;
+       spin_unlock(&echo->eo_lock);
 
        return id;
 }
@@ -344,7 +345,7 @@ static int echo_preprw(const struct lu_env *env, int cmd,
                }
        }
 
-       atomic_add(*pages, &obd->u.echo.eo_prep);
+       atomic_add(*pages, &obd2echo(obd)->eo_prep);
 
        if (cmd & OBD_BRW_READ)
                lprocfs_counter_add(obd->obd_stats, LPROC_ECHO_READ_BYTES,
@@ -354,7 +355,7 @@ static int echo_preprw(const struct lu_env *env, int cmd,
                                    tot_bytes);
 
        CDEBUG(D_PAGE, "%d pages allocated after prep\n",
-              atomic_read(&obd->u.echo.eo_prep));
+              atomic_read(&obd2echo(obd)->eo_prep));
 
        RETURN(0);
 
@@ -374,7 +375,7 @@ preprw_cleanup:
                 */
                __free_page(res[i].lnb_page);
                res[i].lnb_page = NULL;
-               atomic_dec(&obd->u.echo.eo_prep);
+               atomic_dec(&obd2echo(obd)->eo_prep);
        }
 
        return rc;
@@ -434,14 +435,14 @@ static int echo_commitrw(const struct lu_env *env, int cmd,
                }
        }
 
-       atomic_sub(pgs, &obd->u.echo.eo_prep);
+       atomic_sub(pgs, &obd2echo(obd)->eo_prep);
 
        CDEBUG(D_PAGE, "%d pages remain after commit\n",
-              atomic_read(&obd->u.echo.eo_prep));
+              atomic_read(&obd2echo(obd)->eo_prep));
        RETURN(rc);
 
 commitrw_cleanup:
-       atomic_sub(pgs, &obd->u.echo.eo_prep);
+       atomic_sub(pgs, &obd2echo(obd)->eo_prep);
 
        CERROR("cleaning up %d pages (%d obdos)\n",
               niocount - pgs - 1, objcount);
@@ -454,7 +455,7 @@ commitrw_cleanup:
 
                /* NB see comment above regarding persistent pages */
                __free_page(page);
-               atomic_dec(&obd->u.echo.eo_prep);
+               atomic_dec(&obd2echo(obd)->eo_prep);
        }
        return rc;
 }
@@ -562,7 +563,7 @@ static int esd_destroy_hdl(struct tgt_session_info *tsi)
 
        repbody = req_capsule_server_get(tsi->tsi_pill, &RMF_OST_BODY);
 
-       if (ostid_id(&oa->o_oi) > obd->u.echo.eo_lastino ||
+       if (ostid_id(&oa->o_oi) > obd2echo(obd)->eo_lastino ||
            ostid_id(&oa->o_oi) < ECHO_INIT_OID) {
                CERROR("%s: bad objid to destroy: "DOSTID"\n",
                       tsi->tsi_exp->exp_obd->obd_name, POSTID(&oa->o_oi));
@@ -609,7 +610,7 @@ static int esd_getattr_hdl(struct tgt_session_info *tsi)
        repbody->oa.o_oi = oa->o_oi;
        repbody->oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
 
-       obdo_cpy_md(&repbody->oa, &obd->u.echo.eo_oa, oa->o_valid);
+       obdo_cpy_md(&repbody->oa, &obd2echo(obd)->eo_oa, oa->o_valid);
 
        repbody->oa.o_valid |= OBD_MD_FLFLAGS;
        repbody->oa.o_flags = OBD_FL_FLUSH;
@@ -650,7 +651,7 @@ static int esd_setattr_hdl(struct tgt_session_info *tsi)
        repbody->oa.o_oi = body->oa.o_oi;
        repbody->oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
 
-       obd->u.echo.eo_oa = body->oa;
+       obd2echo(obd)->eo_oa = body->oa;
 
        RETURN(0);
 }
@@ -746,8 +747,8 @@ static int echo_srv_init0(const struct lu_env *env,
                RETURN(-ENODEV);
        }
 
-       spin_lock_init(&obd->u.echo.eo_lock);
-       obd->u.echo.eo_lastino = ECHO_INIT_OID;
+       spin_lock_init(&obd2echo(obd)->eo_lock);
+       obd2echo(obd)->eo_lastino = ECHO_INIT_OID;
 
        esd->esd_dev.ld_ops = &echo_srv_lu_ops;
        esd->esd_dev.ld_obd = obd;
@@ -846,7 +847,7 @@ static void echo_srv_fini(const struct lu_env *env,
        lprocfs_obd_cleanup(obd);
        lprocfs_free_obd_stats(obd);
 
-       leaked = atomic_read(&obd->u.echo.eo_prep);
+       leaked = atomic_read(&obd2echo(obd)->eo_prep);
        if (leaked != 0)
                CERROR("%d prep/commitrw pages leaked\n", leaked);
 
index f6cec47..fbcac34 100644 (file)
@@ -486,8 +486,7 @@ static int ofd_checksum_type_seq_show(struct seq_file *m, void *data)
        if (!obd)
                return 0;
 
-       lut = obd->u.obt.obt_lut;
-
+       lut = obd2obt(obd)->obt_lut;
        /* select fastest checksum type on the server */
        pref = obd_cksum_type_select(obd->obd_name,
                                     lut->lut_cksum_types_supported, 0);
@@ -846,7 +845,7 @@ static ssize_t checksum_t10pi_enforce_show(struct kobject *kobj,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
 
        return scnprintf(buf, PAGE_SIZE, "%u\n", lut->lut_cksum_t10pi_enforce);
 }
@@ -878,7 +877,7 @@ static ssize_t checksum_t10pi_enforce_store(struct kobject *kobj,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
        bool enforce;
        int rc;
 
index 535196a..d69ff06 100644 (file)
@@ -3012,8 +3012,7 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
        if (rc != 0)
                RETURN(rc);
 
-       obt = &obd->u.obt;
-       obt->obt_magic = OBT_MAGIC;
+       obt = obd_obt_init(obd);
 
        spin_lock_init(&m->ofd_flags_lock);
        m->ofd_raid_degraded = 0;
@@ -3192,8 +3191,9 @@ static void ofd_fini(const struct lu_env *env, struct ofd_device *m)
        ofd_stop_inconsistency_verification_thread(m);
        lfsck_degister(env, m->ofd_osd);
        ofd_fs_cleanup(env, m);
-       nm_config_file_deregister_tgt(env, obd->u.obt.obt_nodemap_config_file);
-       obd->u.obt.obt_nodemap_config_file = NULL;
+       nm_config_file_deregister_tgt(env,
+                                     obd2obt(obd)->obt_nodemap_config_file);
+       obd2obt(obd)->obt_nodemap_config_file = NULL;
 
        if (m->ofd_namespace != NULL) {
                ldlm_namespace_free_post(m->ofd_namespace);
index dc476cb..06d1934 100644 (file)
@@ -84,7 +84,7 @@ static inline void ofd_counter_incr(struct obd_export *exp, int opcode,
        if (exp->exp_obd && exp->exp_obd->obd_stats)
                lprocfs_counter_add(exp->exp_obd->obd_stats, opcode, amount);
 
-       if (exp->exp_obd && exp->exp_obd->u.obt.obt_jobstats.ojs_hash &&
+       if (exp->exp_obd && obd2obt(exp->exp_obd)->obt_jobstats.ojs_hash &&
            (exp_connect_flags(exp) & OBD_CONNECT_JOBSTATS))
                lprocfs_job_stats_log(exp->exp_obd, jobid, opcode, amount);
 
index 33d2706..8793404 100644 (file)
@@ -81,7 +81,7 @@ static struct cfs_cpt_table *ost_io_cptable;
 static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
        static struct ptlrpc_service_conf svc_conf;
-       struct ost_obd *ost = &obd->u.ost;
+       struct ost_obd *ost = obd2ost(obd);
        nodemask_t *mask;
        int rc;
 
@@ -360,7 +360,7 @@ out_lprocfs:
 
 static int ost_cleanup(struct obd_device *obd)
 {
-       struct ost_obd *ost = &obd->u.ost;
+       struct ost_obd *ost = obd2ost(obd);
        int err = 0;
 
        ENTRY;
@@ -398,7 +398,7 @@ static int ost_cleanup(struct obd_device *obd)
 
 static int ost_health_check(const struct lu_env *env, struct obd_device *obd)
 {
-       struct ost_obd *ost = &obd->u.ost;
+       struct ost_obd *ost = obd2ost(obd);
        int rc = 0;
 
        mutex_lock(&ost->ost_health_mutex);
index fcdc7cd..af9e3a7 100644 (file)
@@ -1547,7 +1547,7 @@ int nodemap_get_config_req(struct obd_device *mgs_obd,
        nodemap_ii.ii_attrs = body->mcb_nm_cur_pass;
 
        bytes = nodemap_index_read(req->rq_svc_thread->t_env,
-                                  mgs_obd->u.obt.obt_nodemap_config_file,
+                                  obd2obt(mgs_obd)->obt_nodemap_config_file,
                                   &nodemap_ii, &rdpg);
        if (bytes < 0)
                GOTO(out, rc = bytes);
index 442b19e..c03020b 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <obd.h>
+#include <dt_object.h>
 #include <lustre_quota.h>
 
 #ifndef _LQUOTA_INTERNAL_H
index afbf668..af2ce7f 100644 (file)
@@ -110,7 +110,7 @@ static void tgt_fmd_expire_nolock(struct obd_export *exp,
                                  struct tgt_fmd_data *keep)
 {
        struct tg_export_data *ted = &exp->exp_target_data;
-       struct lu_target *lut = exp->exp_obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(exp->exp_obd)->obt_lut;
        time64_t now = ktime_get_seconds();
        struct tgt_fmd_data *fmd, *tmp;
 
@@ -161,7 +161,7 @@ static struct tgt_fmd_data *tgt_fmd_find_nolock(struct obd_export *exp,
 {
        struct tg_export_data *ted = &exp->exp_target_data;
        struct tgt_fmd_data *found = NULL, *fmd;
-       struct lu_target *lut = exp->exp_obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(exp->exp_obd)->obt_lut;
        time64_t now = ktime_get_seconds();
 
        assert_spin_locked(&ted->ted_fmd_lock);
index ac1757e..024c23f 100644 (file)
@@ -184,7 +184,7 @@ static int tgt_check_export_grants(struct obd_export *exp, u64 *dirty,
  */
 void tgt_grant_sanity_check(struct obd_device *obd, const char *func)
 {
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
        struct tg_grants_data *tgd = &lut->lut_tgd;
        struct obd_export *exp;
        struct tg_export_data *ted;
@@ -395,7 +395,7 @@ static void tgt_grant_statfs(const struct lu_env *env, struct obd_export *exp,
                             int force, int *from_cache)
 {
        struct obd_device       *obd = exp->exp_obd;
-       struct lu_target        *lut = obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        struct tgt_thread_info  *tti;
        struct obd_statfs       *osfs;
@@ -438,7 +438,7 @@ static void tgt_grant_statfs(const struct lu_env *env, struct obd_export *exp,
 static u64 tgt_grant_space_left(struct obd_export *exp)
 {
        struct obd_device       *obd = exp->exp_obd;
-       struct lu_target        *lut = obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        u64                      tot_granted;
        u64                      left;
@@ -507,7 +507,7 @@ static void tgt_grant_incoming(const struct lu_env *env, struct obd_export *exp,
 {
        struct tg_export_data   *ted = &exp->exp_target_data;
        struct obd_device       *obd = exp->exp_obd;
-       struct tg_grants_data   *tgd = &obd->u.obt.obt_lut->lut_tgd;
+       struct tg_grants_data   *tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        long long                dirty, dropped;
        ENTRY;
 
@@ -603,7 +603,7 @@ static void tgt_grant_shrink(struct obd_export *exp, struct obdo *oa,
 {
        struct tg_export_data   *ted = &exp->exp_target_data;
        struct obd_device       *obd = exp->exp_obd;
-       struct tg_grants_data   *tgd = &obd->u.obt.obt_lut->lut_tgd;
+       struct tg_grants_data   *tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        long                     grant_shrink;
 
        assert_spin_locked(&tgd->tgd_grant_lock);
@@ -720,7 +720,7 @@ static void tgt_grant_check(const struct lu_env *env, struct obd_export *exp,
 {
        struct tg_export_data   *ted = &exp->exp_target_data;
        struct obd_device       *obd = exp->exp_obd;
-       struct lu_target        *lut = obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        unsigned long            ungranted = 0;
        unsigned long            granted = 0;
@@ -906,7 +906,7 @@ static long tgt_grant_alloc(struct obd_export *exp, u64 curgrant,
                            bool conservative)
 {
        struct obd_device       *obd = exp->exp_obd;
-       struct tg_grants_data   *tgd = &obd->u.obt.obt_lut->lut_tgd;
+       struct tg_grants_data   *tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        struct tg_export_data   *ted = &exp->exp_target_data;
        u64                      grant;
 
@@ -1015,7 +1015,7 @@ static long tgt_grant_alloc(struct obd_export *exp, u64 curgrant,
 void tgt_grant_connect(const struct lu_env *env, struct obd_export *exp,
                       struct obd_connect_data *data, bool new_conn)
 {
-       struct lu_target        *lut = exp->exp_obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(exp->exp_obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        struct tg_export_data   *ted = &exp->exp_target_data;
        u64                      left = 0;
@@ -1160,7 +1160,7 @@ EXPORT_SYMBOL(tgt_grant_discard);
 void tgt_grant_prepare_read(const struct lu_env *env,
                            struct obd_export *exp, struct obdo *oa)
 {
-       struct lu_target        *lut = exp->exp_obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(exp->exp_obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        int                      do_shrink;
        u64                      left = 0;
@@ -1245,7 +1245,7 @@ void tgt_grant_prepare_write(const struct lu_env *env,
                             struct niobuf_remote *rnb, int niocount)
 {
        struct obd_device       *obd = exp->exp_obd;
-       struct lu_target        *lut = obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        u64                      left;
        int                      from_cache;
@@ -1347,7 +1347,7 @@ EXPORT_SYMBOL(tgt_grant_prepare_write);
  */
 long tgt_grant_create(const struct lu_env *env, struct obd_export *exp, s64 *nr)
 {
-       struct lu_target        *lut = exp->exp_obd->u.obt.obt_lut;
+       struct lu_target        *lut = obd2obt(exp->exp_obd)->obt_lut;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        struct tg_export_data   *ted = &exp->exp_target_data;
        u64                      left = 0;
@@ -1442,7 +1442,7 @@ EXPORT_SYMBOL(tgt_grant_create);
 void tgt_grant_commit(struct obd_export *exp, unsigned long pending,
                      int rc)
 {
-       struct tg_grants_data *tgd = &exp->exp_obd->u.obt.obt_lut->lut_tgd;
+       struct tg_grants_data *tgd = &obd2obt(exp->exp_obd)->obt_lut->lut_tgd;
 
        ENTRY;
 
@@ -1592,7 +1592,7 @@ ssize_t tot_dirty_show(struct kobject *kobj, struct attribute *attr,
                                              obd_kset.kobj);
        struct tg_grants_data *tgd;
 
-       tgd = &obd->u.obt.obt_lut->lut_tgd;
+       tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        return scnprintf(buf, PAGE_SIZE, "%llu\n", tgd->tgd_tot_dirty);
 }
 EXPORT_SYMBOL(tot_dirty_show);
@@ -1614,7 +1614,7 @@ ssize_t tot_granted_show(struct kobject *kobj, struct attribute *attr,
                                              obd_kset.kobj);
        struct tg_grants_data *tgd;
 
-       tgd = &obd->u.obt.obt_lut->lut_tgd;
+       tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        return scnprintf(buf, PAGE_SIZE, "%llu\n", tgd->tgd_tot_granted);
 }
 EXPORT_SYMBOL(tot_granted_show);
@@ -1636,7 +1636,7 @@ ssize_t tot_pending_show(struct kobject *kobj, struct attribute *attr,
                                              obd_kset.kobj);
        struct tg_grants_data *tgd;
 
-       tgd = &obd->u.obt.obt_lut->lut_tgd;
+       tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        return scnprintf(buf, PAGE_SIZE, "%llu\n", tgd->tgd_tot_pending);
 }
 EXPORT_SYMBOL(tot_pending_show);
@@ -1661,7 +1661,7 @@ ssize_t grant_compat_disable_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct tg_grants_data *tgd = &obd->u.obt.obt_lut->lut_tgd;
+       struct tg_grants_data *tgd = &obd2obt(obd)->obt_lut->lut_tgd;
 
        return scnprintf(buf, PAGE_SIZE, "%u\n", tgd->tgd_grant_compat_disable);
 }
@@ -1689,7 +1689,7 @@ ssize_t grant_compat_disable_store(struct kobject *kobj,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct tg_grants_data *tgd = &obd->u.obt.obt_lut->lut_tgd;
+       struct tg_grants_data *tgd = &obd2obt(obd)->obt_lut->lut_tgd;
        bool val;
        int rc;
 
index 035d35d..8a8a587 100644 (file)
@@ -449,7 +449,8 @@ void tgt_client_free(struct obd_export *exp)
 
        /* Target may have been freed (see LU-7430)
         * Slot may be not yet assigned */
-       if (exp->exp_obd->u.obt.obt_magic != OBT_MAGIC ||
+       if (((struct obd_device_target *)(&exp->exp_obd->u))->obt_magic !=
+           OBT_MAGIC ||
            ted->ted_lr_idx < 0)
                return;
 
@@ -701,7 +702,7 @@ int tgt_server_data_update(const struct lu_env *env, struct lu_target *tgt,
 
        CDEBUG(D_SUPER,
               "%s: mount_count is %llu, last_transno is %llu\n",
-              tgt->lut_lsd.lsd_uuid, tgt->lut_obd->u.obt.obt_mount_count,
+              tgt->lut_lsd.lsd_uuid, obd2obt(tgt->lut_obd)->obt_mount_count,
               tgt->lut_last_transno);
 
        /* Always save latest transno to keep it fresh */
@@ -1900,8 +1901,8 @@ int tgt_server_data_init(const struct lu_env *env, struct lu_target *tgt)
        tgt->lut_obd->obd_last_committed = tgt->lut_last_transno;
        spin_unlock(&tgt->lut_translock);
 
-       tgt->lut_obd->u.obt.obt_mount_count = lsd->lsd_mount_count;
-       tgt->lut_obd->u.obt.obt_instance = (__u32)lsd->lsd_mount_count;
+       obd2obt(tgt->lut_obd)->obt_mount_count = lsd->lsd_mount_count;
+       obd2obt(tgt->lut_obd)->obt_instance = (__u32)lsd->lsd_mount_count;
 
        /* save it, so mount count and last_transno is current */
        rc = tgt_server_data_update(env, tgt, 0);
index 5c7342d..cef0a5d 100644 (file)
@@ -34,6 +34,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <obd.h>
+#include <obd_target.h>
 #include <obd_cksum.h>
 #include "tgt_internal.h"
 #include "../ptlrpc/ptlrpc_internal.h"
@@ -61,7 +62,7 @@ ssize_t sync_lock_cancel_show(struct kobject *kobj,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *tgt = obd->u.obt.obt_lut;
+       struct lu_target *tgt = obd2obt(obd)->obt_lut;
 
        return sprintf(buf, "%s\n",
                       sync_lock_cancel_states[tgt->lut_sync_lock_cancel]);
@@ -94,7 +95,7 @@ ssize_t sync_lock_cancel_store(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *tgt = obd->u.obt.obt_lut;
+       struct lu_target *tgt = obd2obt(obd)->obt_lut;
        int val = -1;
        enum tgt_sync_lock_cancel slc;
 
@@ -141,7 +142,7 @@ ssize_t tgt_fmd_count_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
 
        return sprintf(buf, "%u\n", lut->lut_fmd_max_num);
 }
@@ -164,7 +165,7 @@ ssize_t tgt_fmd_count_store(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
        int val, rc;
 
        rc = kstrtoint(buffer, 0, &val);
@@ -195,7 +196,7 @@ ssize_t tgt_fmd_seconds_show(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
 
        return sprintf(buf, "%lld\n", lut->lut_fmd_max_age);
 }
@@ -218,7 +219,7 @@ ssize_t tgt_fmd_seconds_store(struct kobject *kobj, struct attribute *attr,
 {
        struct obd_device *obd = container_of(kobj, struct obd_device,
                                              obd_kset.kobj);
-       struct lu_target *lut = obd->u.obt.obt_lut;
+       struct lu_target *lut = obd2obt(obd)->obt_lut;
        time64_t val;
        int rc;
 
@@ -478,6 +479,7 @@ int tgt_init(const struct lu_env *env, struct lu_target *lut,
        struct dt_object        *o;
        struct tg_grants_data   *tgd = &lut->lut_tgd;
        struct obd_statfs       *osfs;
+       struct obd_device_target *obt;
        int i, rc = 0;
 
        ENTRY;
@@ -492,8 +494,8 @@ int tgt_init(const struct lu_env *env, struct lu_target *lut,
        atomic_set(&lut->lut_client_generation, 0);
        lut->lut_reply_data = NULL;
        lut->lut_reply_bitmap = NULL;
-       obd->u.obt.obt_lut = lut;
-       obd->u.obt.obt_magic = OBT_MAGIC;
+       obt = obd_obt_init(obd);
+       obt->obt_lut = lut;
 
        /* set request handler slice and parameters */
        lut->lut_slice = slice;
@@ -625,8 +627,8 @@ int tgt_init(const struct lu_env *env, struct lu_target *lut,
 out:
        dt_txn_callback_del(lut->lut_bottom, &lut->lut_txn_cb);
 out_put:
-       obd->u.obt.obt_magic = 0;
-       obd->u.obt.obt_lut = NULL;
+       obd2obt(obd)->obt_lut = NULL;
+       obd2obt(obd)->obt_magic = 0;
        if (lut->lut_last_rcvd != NULL) {
                dt_object_put(env, lut->lut_last_rcvd);
                lut->lut_last_rcvd = NULL;
index 1e9b102..7e86174 100644 (file)
@@ -1334,7 +1334,7 @@ static int server_notify_target(struct super_block *sb, struct obd_device *obd)
        if (rc < 0)
                GOTO(out, rc);
 
-       mti->mti_instance = obd->u.obt.obt_instance;
+       mti->mti_instance = obd2obt(obd)->obt_instance;
        mti->mti_flags |= LDD_F_OPC_READY;
 
        /* FIXME use mgc_process_config instead */