]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
target: put struct target_fabric_configfs on a diet
authorChristoph Hellwig <hch@lst.de>
Sun, 3 May 2015 06:50:54 +0000 (08:50 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 31 May 2015 05:42:38 +0000 (22:42 -0700)
Remove all fields that are either unused or can be replaced by trivially
following pointers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_configfs.c
drivers/target/target_core_fabric_configfs.c
include/target/target_core_configfs.h

index 43c9ed1d1b921dd879d5da3ca1d71f83c58a2573..f63e4dda8a907efa4d1a562e46678f4fe22258f8 100644 (file)
@@ -116,7 +116,7 @@ static struct target_fabric_configfs *target_core_get_fabric(
 
        mutex_lock(&g_tf_lock);
        list_for_each_entry(tf, &g_tf_list, tf_list) {
-               if (!strcmp(tf->tf_name, name)) {
+               if (!strcmp(tf->tf_ops->name, name)) {
                        atomic_inc(&tf->tf_access_cnt);
                        mutex_unlock(&g_tf_lock);
                        return tf;
@@ -193,7 +193,7 @@ static struct config_group *target_core_register_fabric(
                return ERR_PTR(-EINVAL);
        }
        pr_debug("Target_Core_ConfigFS: REGISTER -> Located fabric:"
-                       " %s\n", tf->tf_name);
+                       " %s\n", tf->tf_ops->name);
        /*
         * On a successful target_core_get_fabric() look, the returned
         * struct target_fabric_configfs *tf will contain a usage reference.
@@ -212,10 +212,6 @@ static struct config_group *target_core_register_fabric(
 
        pr_debug("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:"
                        " %s\n", tf->tf_group.cg_item.ci_name);
-       tf->tf_fabric = &tf->tf_group.cg_item;
-       pr_debug("Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric"
-                       " for %s\n", name);
-
        return &tf->tf_group;
 }
 
@@ -236,13 +232,9 @@ static void target_core_deregister_fabric(
                " tf list\n", config_item_name(item));
 
        pr_debug("Target_Core_ConfigFS: DEREGISTER -> located fabric:"
-                       " %s\n", tf->tf_name);
+                       " %s\n", tf->tf_ops->name);
        atomic_dec(&tf->tf_access_cnt);
 
-       pr_debug("Target_Core_ConfigFS: DEREGISTER -> Releasing"
-                       " tf->tf_fabric for %s\n", tf->tf_name);
-       tf->tf_fabric = NULL;
-
        pr_debug("Target_Core_ConfigFS: DEREGISTER -> Releasing ci"
                        " %s\n", config_item_name(item));
 
@@ -436,14 +428,6 @@ int target_register_template(const struct target_core_fabric_ops *fo)
 
        INIT_LIST_HEAD(&tf->tf_list);
        atomic_set(&tf->tf_access_cnt, 0);
-
-       /*
-        * Setup the default generic struct config_item_type's (cits) in
-        * struct target_fabric_configfs->tf_cit_tmpl
-        */
-       tf->tf_module = fo->module;
-       snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name);
-
        tf->tf_ops = fo;
        target_fabric_setup_cits(tf);
 
@@ -461,7 +445,7 @@ void target_unregister_template(const struct target_core_fabric_ops *fo)
 
        mutex_lock(&g_tf_lock);
        list_for_each_entry(t, &g_tf_list, tf_list) {
-               if (!strcmp(t->tf_name, fo->name)) {
+               if (!strcmp(t->tf_ops->name, fo->name)) {
                        BUG_ON(atomic_read(&t->tf_access_cnt));
                        list_del(&t->tf_list);
                        kfree(t);
index 93564c0b7576b61e3a62be73f764f8bef96cd947..d2ce61a07afd6e84aae5d260fdf44dfbbcee9e16 100644 (file)
@@ -52,7 +52,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf)
        cit->ct_item_ops = _item_ops;                                   \
        cit->ct_group_ops = _group_ops;                                 \
        cit->ct_attrs = _attrs;                                         \
-       cit->ct_owner = tf->tf_module;                                  \
+       cit->ct_owner = tf->tf_ops->module;                             \
        pr_debug("Setup generic %s\n", __stringify(_name));             \
 }
 
@@ -66,7 +66,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf)
        cit->ct_item_ops = _item_ops;                                   \
        cit->ct_group_ops = _group_ops;                                 \
        cit->ct_attrs = attrs;                                          \
-       cit->ct_owner = tf->tf_module;                                  \
+       cit->ct_owner = tf->tf_ops->module;                             \
        pr_debug("Setup generic %s\n", __stringify(_name));             \
 }
 
index 10402e5526e715676e191479f4592736f0629c9a..3f11d2ead63dd7ab2115c66f489f5df866cc9903 100644 (file)
@@ -30,18 +30,11 @@ struct target_fabric_configfs_template {
 };
 
 struct target_fabric_configfs {
-       char                    tf_name[TARGET_FABRIC_NAME_SIZE];
        atomic_t                tf_access_cnt;
        struct list_head        tf_list;
        struct config_group     tf_group;
        struct config_group     tf_disc_group;
        struct config_group     *tf_default_groups[2];
-       /* Pointer to fabric's config_item */
-       struct config_item      *tf_fabric;
-       /* Passed from fabric modules */
-       struct config_item_type *tf_fabric_cit;
-       /* Pointer to fabric's struct module */
-       struct module *tf_module;
        const struct target_core_fabric_ops *tf_ops;
        struct target_fabric_configfs_template tf_cit_tmpl;
 };