]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
staging: lustre: obd: Remove dead code in precleanup
authorHenri Doreau <henri.doreau@cea.fr>
Thu, 10 Nov 2016 17:30:47 +0000 (12:30 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Nov 2016 15:13:58 +0000 (16:13 +0100)
There used to be several pre-cleanup phases, but
only OBD_CLEANUP_EXPORTS is actually used.  Thus
remove the whole notion of precleanup phases.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7034
Reviewed-on: http://review.whamcloud.com/16061
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/obd.h
drivers/staging/lustre/lustre/include/obd_class.h
drivers/staging/lustre/lustre/lmv/lmv_obd.c
drivers/staging/lustre/lustre/lov/lov_obd.c
drivers/staging/lustre/lustre/mdc/mdc_request.c
drivers/staging/lustre/lustre/mgc/mgc_request.c
drivers/staging/lustre/lustre/obdclass/obd_config.c
drivers/staging/lustre/lustre/osc/osc_request.c

index 09649ef395034219066110a95663998118d46b9d..8e1100174bc93ae6f17eae21743fdaa82f0e0a6b 100644 (file)
@@ -598,13 +598,6 @@ struct obd_device {
        struct completion       obd_kobj_unregister;
 };
 
-enum obd_cleanup_stage {
-/* Special case hack for MDS LOVs */
-       OBD_CLEANUP_EARLY,
-/* can be directly mapped to .ldto_device_fini() */
-       OBD_CLEANUP_EXPORTS,
-};
-
 /* get/set_info keys */
 #define KEY_ASYNC             "async"
 #define KEY_CHANGELOG_CLEAR     "changelog_clear"
@@ -751,8 +744,7 @@ struct obd_ops {
                              __u32 vallen, void *val,
                              struct ptlrpc_request_set *set);
        int (*setup)(struct obd_device *dev, struct lustre_cfg *cfg);
-       int (*precleanup)(struct obd_device *dev,
-                         enum obd_cleanup_stage cleanup_stage);
+       int (*precleanup)(struct obd_device *dev);
        int (*cleanup)(struct obd_device *dev);
        int (*process_config)(struct obd_device *dev, u32 len, void *data);
        int (*postrecov)(struct obd_device *dev);
index 70b355e3b7ede768eef7d5e287329d0e82f00529..3beb699940d993353f5537750a66d65d96876a20 100644 (file)
@@ -505,8 +505,7 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
        return rc;
 }
 
-static inline int obd_precleanup(struct obd_device *obd,
-                                enum obd_cleanup_stage cleanup_stage)
+static inline int obd_precleanup(struct obd_device *obd)
 {
        int rc;
        DECLARE_LU_VARS(ldt, d);
@@ -517,20 +516,18 @@ static inline int obd_precleanup(struct obd_device *obd,
        ldt = obd->obd_type->typ_lu;
        d = obd->obd_lu_dev;
        if (ldt && d) {
-               if (cleanup_stage == OBD_CLEANUP_EXPORTS) {
-                       struct lu_env env;
+               struct lu_env env;
 
-                       rc = lu_env_init(&env, ldt->ldt_ctx_tags);
-                       if (rc == 0) {
-                               ldt->ldt_ops->ldto_device_fini(&env, d);
-                               lu_env_fini(&env);
-                       }
+               rc = lu_env_init(&env, ldt->ldt_ctx_tags);
+               if (!rc) {
+                       ldt->ldt_ops->ldto_device_fini(&env, d);
+                       lu_env_fini(&env);
                }
        }
        OBD_CHECK_DT_OP(obd, precleanup, 0);
        OBD_COUNTER_INCREMENT(obd, precleanup);
 
-       rc = OBP(obd, precleanup)(obd, cleanup_stage);
+       rc = OBP(obd, precleanup)(obd);
        return rc;
 }
 
index c4e29f28fb8e24edfa0c1e2c14b43c9f6e4f2f6d..04f0b7d57dfbd48df0ec02e65aef87b3def5e904 100644 (file)
@@ -2623,23 +2623,10 @@ try_next_stripe:
        goto retry_unlink;
 }
 
-static int lmv_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
+static int lmv_precleanup(struct obd_device *obd)
 {
-       struct lmv_obd *lmv = &obd->u.lmv;
-
-       switch (stage) {
-       case OBD_CLEANUP_EARLY:
-               /* XXX: here should be calling obd_precleanup() down to
-                * stack.
-                */
-               break;
-       case OBD_CLEANUP_EXPORTS:
-               fld_client_debugfs_fini(&lmv->lmv_fld);
-               lprocfs_obd_cleanup(obd);
-               break;
-       default:
-               break;
-       }
+       fld_client_debugfs_fini(&obd->u.lmv.lmv_fld);
+       lprocfs_obd_cleanup(obd);
        return 0;
 }
 
index 421a0e2182bbbc87a6fb46dfa14fcd097b1ebd1a..5bae58471dbef9ba1772d87aebd20c974265d60f 100644 (file)
@@ -825,29 +825,6 @@ out:
        return rc;
 }
 
-static int lov_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
-{
-       struct lov_obd *lov = &obd->u.lov;
-
-       switch (stage) {
-       case OBD_CLEANUP_EARLY: {
-               int i;
-
-               for (i = 0; i < lov->desc.ld_tgt_count; i++) {
-                       if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active)
-                               continue;
-                       obd_precleanup(class_exp2obd(lov->lov_tgts[i]->ltd_exp),
-                                      OBD_CLEANUP_EARLY);
-               }
-               break;
-       }
-       default:
-               break;
-       }
-
-       return 0;
-}
-
 static int lov_cleanup(struct obd_device *obd)
 {
        struct lov_obd *lov = &obd->u.lov;
@@ -1399,7 +1376,6 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
 static struct obd_ops lov_obd_ops = {
        .owner          = THIS_MODULE,
        .setup          = lov_setup,
-       .precleanup     = lov_precleanup,
        .cleanup        = lov_cleanup,
        /*.process_config       = lov_process_config,*/
        .connect        = lov_connect,
index bfc3b5198a3decaa3d708b2522911b8ac492a904..892195c85cae5d99576f262897bc445ceb15d331 100644 (file)
@@ -2660,23 +2660,16 @@ static int mdc_init_ea_size(struct obd_export *exp, u32 easize, u32 def_easize)
        return 0;
 }
 
-static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
+static int mdc_precleanup(struct obd_device *obd)
 {
-       switch (stage) {
-       case OBD_CLEANUP_EARLY:
-               break;
-       case OBD_CLEANUP_EXPORTS:
-               /* Failsafe, ok if racy */
-               if (obd->obd_type->typ_refcnt <= 1)
-                       libcfs_kkuc_group_rem(0, KUC_GRP_HSM);
-
-               obd_cleanup_client_import(obd);
-               ptlrpc_lprocfs_unregister_obd(obd);
-               lprocfs_obd_cleanup(obd);
+       /* Failsafe, ok if racy */
+       if (obd->obd_type->typ_refcnt <= 1)
+               libcfs_kkuc_group_rem(0, KUC_GRP_HSM);
 
-               mdc_llog_finish(obd);
-               break;
-       }
+       obd_cleanup_client_import(obd);
+       ptlrpc_lprocfs_unregister_obd(obd);
+       lprocfs_obd_cleanup(obd);
+       mdc_llog_finish(obd);
        return 0;
 }
 
index e248f332e0429cd45a6f67e04a4fb89157f7e445..a2cd5dd25114e07645154c66c836dfe4d23b6ef8 100644 (file)
@@ -684,35 +684,33 @@ static int mgc_llog_fini(const struct lu_env *env, struct obd_device *obd)
 }
 
 static atomic_t mgc_count = ATOMIC_INIT(0);
-static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
+static int mgc_precleanup(struct obd_device *obd)
 {
        int rc = 0;
        int temp;
 
-       switch (stage) {
-       case OBD_CLEANUP_EARLY:
-               break;
-       case OBD_CLEANUP_EXPORTS:
-               if (atomic_dec_and_test(&mgc_count)) {
-                       LASSERT(rq_state & RQ_RUNNING);
-                       /* stop requeue thread */
-                       temp = RQ_STOP;
-               } else {
-                       /* wakeup requeue thread to clean our cld */
-                       temp = RQ_NOW | RQ_PRECLEANUP;
-               }
-               spin_lock(&config_list_lock);
-               rq_state |= temp;
-               spin_unlock(&config_list_lock);
-               wake_up(&rq_waitq);
-               if (temp & RQ_STOP)
-                       wait_for_completion(&rq_exit);
-               obd_cleanup_client_import(obd);
-               rc = mgc_llog_fini(NULL, obd);
-               if (rc != 0)
-                       CERROR("failed to cleanup llogging subsystems\n");
-               break;
+       if (atomic_dec_and_test(&mgc_count)) {
+               LASSERT(rq_state & RQ_RUNNING);
+               /* stop requeue thread */
+               temp = RQ_STOP;
+       } else {
+               /* wakeup requeue thread to clean our cld */
+               temp = RQ_NOW | RQ_PRECLEANUP;
        }
+
+       spin_lock(&config_list_lock);
+       rq_state |= temp;
+       spin_unlock(&config_list_lock);
+       wake_up(&rq_waitq);
+
+       if (temp & RQ_STOP)
+               wait_for_completion(&rq_exit);
+       obd_cleanup_client_import(obd);
+
+       rc = mgc_llog_fini(NULL, obd);
+       if (rc)
+               CERROR("failed to cleanup llogging subsystems\n");
+
        return rc;
 }
 
index 017bdac55d111058c5af3f07a289e0402db515d1..9d5530c1d80153d7ac8e7b5b7cfb53008b67325c 100644 (file)
@@ -446,7 +446,7 @@ static int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
        LASSERT(obd->obd_self_export);
 
        /* Precleanup, we must make sure all exports get destroyed. */
-       err = obd_precleanup(obd, OBD_CLEANUP_EXPORTS);
+       err = obd_precleanup(obd);
        if (err)
                CERROR("Precleanup %s returned %d\n",
                       obd->obd_name, err);
index 057d862ed9621735ce39e960ce1e945676e1d96e..50d53c48051a8e9630a818e8d3500d9b31561b2c 100644 (file)
@@ -2728,47 +2728,33 @@ out_ptlrpcd:
        return rc;
 }
 
-static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
+static int osc_precleanup(struct obd_device *obd)
 {
-       switch (stage) {
-       case OBD_CLEANUP_EARLY: {
-               struct obd_import *imp;
-
-               imp = obd->u.cli.cl_import;
-               CDEBUG(D_HA, "Deactivating import %s\n", obd->obd_name);
-               /* ptlrpc_abort_inflight to stop an mds_lov_synchronize */
-               ptlrpc_deactivate_import(imp);
-               spin_lock(&imp->imp_lock);
-               imp->imp_pingable = 0;
-               spin_unlock(&imp->imp_lock);
-               break;
+       struct client_obd *cli = &obd->u.cli;
+
+       /* LU-464
+        * for echo client, export may be on zombie list, wait for
+        * zombie thread to cull it, because cli.cl_import will be
+        * cleared in client_disconnect_export():
+        *   class_export_destroy() -> obd_cleanup() ->
+        *   echo_device_free() -> echo_client_cleanup() ->
+        *   obd_disconnect() -> osc_disconnect() ->
+        *   client_disconnect_export()
+        */
+       obd_zombie_barrier();
+       if (cli->cl_writeback_work) {
+               ptlrpcd_destroy_work(cli->cl_writeback_work);
+               cli->cl_writeback_work = NULL;
        }
-       case OBD_CLEANUP_EXPORTS: {
-               struct client_obd *cli = &obd->u.cli;
-               /* LU-464
-                * for echo client, export may be on zombie list, wait for
-                * zombie thread to cull it, because cli.cl_import will be
-                * cleared in client_disconnect_export():
-                *   class_export_destroy() -> obd_cleanup() ->
-                *   echo_device_free() -> echo_client_cleanup() ->
-                *   obd_disconnect() -> osc_disconnect() ->
-                *   client_disconnect_export()
-                */
-               obd_zombie_barrier();
-               if (cli->cl_writeback_work) {
-                       ptlrpcd_destroy_work(cli->cl_writeback_work);
-                       cli->cl_writeback_work = NULL;
-               }
-               if (cli->cl_lru_work) {
-                       ptlrpcd_destroy_work(cli->cl_lru_work);
-                       cli->cl_lru_work = NULL;
-               }
-               obd_cleanup_client_import(obd);
-               ptlrpc_lprocfs_unregister_obd(obd);
-               lprocfs_obd_cleanup(obd);
-               break;
-               }
+
+       if (cli->cl_lru_work) {
+               ptlrpcd_destroy_work(cli->cl_lru_work);
+               cli->cl_lru_work = NULL;
        }
+
+       obd_cleanup_client_import(obd);
+       ptlrpc_lprocfs_unregister_obd(obd);
+       lprocfs_obd_cleanup(obd);
        return 0;
 }