Re: [PATCH] target: do not request backend modules on startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2011-10-18 at 06:51 -0400, Christoph Hellwig wrote:
> We only need one of them, and they don't have to be modular.  Nevermind
> that we generally never request optional modules.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Without one of these calls into transport_subsystem_check_init(), the
backend drivers never end up getting loaded with this patch, so I don't
think it's possible to completely remove the request_module() usage to
load the extra modules here..

I looked at a similar simplification originally to push the
request_module() calls into target_core_init_configfs(), but the other
problem is that request_module() currently cannot be called from another
module's module_init() function.

So that said, here is the cleanup that I came up with to remove the
extra call to transport_subsystem_check_init() that is unnecessary now
with target_core_rd.c being built into target_core_mod, and merging the
request_module() calls directly into transport_subsystem_check_init().

--nab

>From c50de30626423dce99c4d11cd78b85852d242fa0 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Date: Sat, 22 Oct 2011 01:03:54 -0700
Subject: [PATCH] target: transport_subsystem_check_init cleanups

Remove the now unnecessary extra call to transport_subsystem_check_init() in
target_core_register_fabric(), and also merge transport_subsystem_reqmods()
directly into transport_subsystem_check_init().

Reported-by: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/target/target_core_configfs.c  |   11 +----------
 drivers/target/target_core_transport.c |   23 +++++------------------
 include/target/target_core_transport.h |    2 +-
 3 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index f37e2b9..1511a2f 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -132,14 +132,6 @@ static struct config_group *target_core_register_fabric(
        pr_debug("Target_Core_ConfigFS: REGISTER -> group: %p name:"
                        " %s\n", group, name);
        /*
-        * Ensure that TCM subsystem plugins are loaded at this point for
-        * using the RAMDISK_DR virtual LUN 0 and all other struct se_port
-        * LUN symlinks.
-        */
-       if (transport_subsystem_check_init() < 0)
-               return ERR_PTR(-EINVAL);
-
-       /*
         * Below are some hardcoded request_module() calls to automatically
         * local fabric modules when the following is called:
         *
@@ -3079,8 +3071,7 @@ static struct config_group *target_core_call_addhbatotarget(
        /*
         * Load up TCM subsystem plugins if they have not already been loaded.
         */
-       if (transport_subsystem_check_init() < 0)
-               return ERR_PTR(-EINVAL);
+       transport_subsystem_check_init();

        hba = core_alloc_hba(se_plugin_str, plugin_dep_id, 0);
        if (IS_ERR(hba))
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index eef1922..6593f8c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -235,10 +235,13 @@ void transport_init_queue_obj(struct se_queue_obj *qobj)
 }
 EXPORT_SYMBOL(transport_init_queue_obj);

-static int transport_subsystem_reqmods(void)
+void transport_subsystem_check_init(void)
 {
        int ret;

+       if (sub_api_initialized)
+               return;
+       
        ret = request_module("target_core_iblock");
        if (ret != 0)
                pr_err("Unable to load target_core_iblock\n");
@@ -255,24 +258,8 @@ static int transport_subsystem_reqmods(void)
        if (ret != 0)
                pr_err("Unable to load target_core_stgt\n");

-       return 0;
-}
-
-int transport_subsystem_check_init(void)
-{
-       int ret;
-
-       if (sub_api_initialized)
-               return 0;
-       /*
-        * Request the loading of known TCM subsystem plugins..
-        */
-       ret = transport_subsystem_reqmods();
-       if (ret < 0)
-               return ret;
-
        sub_api_initialized = 1;
-       return 0;
+       return;
 }

 struct se_session *transport_init_session(void)
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index c8538c5..32c5863 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -113,7 +113,7 @@ extern int init_se_kmem_caches(void);
 extern void release_se_kmem_caches(void);
 extern u32 scsi_get_new_index(scsi_index_t);
 extern void transport_init_queue_obj(struct se_queue_obj *);
-extern int transport_subsystem_check_init(void);
+extern void transport_subsystem_check_init(void);
 extern int transport_subsystem_register(struct se_subsystem_api *);
 extern void transport_subsystem_release(struct se_subsystem_api *);
 extern void transport_load_plugins(void);
-- 
1.7.2.5



--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux