Skip to contentSkip to conversation

tcm: Remove remaining code out of target_core_seobj.c

PATCH New Nicholas A. Bellinger 1 participant 1 message Aug 19, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 tcm: Remove remaining code out of target_core_seobj.c

From: Nicholas Bellinger <[email protected]>

This patch removes the remaining code in target_core_seobj.c into target_core_device.c and target_core_transport.c. It changes the 'void *p' pointer for these functions to 'struct se_device *dev', and also changes the function names to the following:

	dev_obj_export() -> core_dev_export()
	dev_obj_unexport() -> core_dev_unexport()
	dev_obj_max_sectors() -> transport_dev_max_sectors() (static inline)
	dev_obj_end_lba() -> transport_dev_end_lba() (static inline)
	dev_obj_do_se_mem_map() -> transport_do_se_mem_map() (static)
	dev_obj_get_mem_buf() -> transport_dev_get_mem_buf() (static inline)
	dev_obj_get_mem_SG() -> transport_dev_get_mem_SG() (static inline)
	dev_obj_get_map_SG() -> transport_dev_get_map_SG() (static inline)
	dev_obj_get_map_non_SG() -> transport_dev_get_map_non_SG() (static inline)
	dev_obj_get_map_none() -> transport_dev_get_map_none() (static inline)
	dev_obj_check_online() -> se_dev_check_online()
	dev_obj_check_shutdown() -> se_dev_check_shutdown()

The existing logic is left untouched, with the expection of one item in core_dev_export(). The original code in dev_obj_export() would obtain struct se_dev->se_port_lock then struct se_lun->lun_sep_lock, and since there is no reason to be doing this with a configfs control path which is enforcing individual LUN context control with struct se_lun->lun_group, the order of the locks has been changed to be held individually.

---
 drivers/target/Kbuild                        |    1 -
 drivers/target/target_core_configfs.c        |    1 -
 drivers/target/target_core_device.c          |   70 ++++++++-
 drivers/target/target_core_fabric_configfs.c |    1 -
 drivers/target/target_core_seobj.c           |  214 -------------------------
 drivers/target/target_core_seobj.h           |   47 ------
 drivers/target/target_core_tpg.c             |    5 +-
 drivers/target/target_core_transport.c       |  222 +++++++++++++++++++-------
 include/target/target_core_device.h          |    6 +
 9 files changed, 239 insertions(+), 328 deletions(-)
 delete mode 100644 drivers/target/target_core_seobj.c
 delete mode 100644 drivers/target/target_core_seobj.h
drivers/target/Kbuild +0 -1
index 7a1b473..3626934 100644
@@ -8,7 +8,6 @@ target_core_mod-y		:= target_core_configfs.o \
 				   target_core_pr.o \
 				   target_core_alua.o \
 				   target_core_scdb.o \
-				   target_core_seobj.o \
 				   target_core_tmr.o \
 				   target_core_tpg.o \
 				   target_core_transport.o \
drivers/target/target_core_configfs.c +0 -1
index f3635c4..b48340a 100644
@@ -49,7 +49,6 @@
 #include "target_core_alua.h"
 #include "target_core_hba.h"
 #include "target_core_pr.h"
-#include "target_core_seobj.h"
 #include "target_core_rd.h"
 
 struct list_head g_tf_list;
drivers/target/target_core_device.c +67 -3

100 lines not on this page · raw message

drivers/target/target_core_fabric_configfs.c +0 -1
index f6015f7..d5eb1ad 100644
@@ -48,7 +48,6 @@
 #include "target_core_alua.h"
 #include "target_core_hba.h"
 #include "target_core_pr.h"
-#include "target_core_seobj.h"
 
 #define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs)		\
 static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \
drivers/target/target_core_seobj.c deleted +0 -214

214 lines not on this page · raw message

drivers/target/target_core_seobj.h deleted +0 -47

47 lines not on this page · raw message

drivers/target/target_core_tpg.c +2 -3
index 925a486..d273698 100644
@@ -45,7 +45,6 @@
 #include <target/target_core_fabric_ops.h>
 
 #include "target_core_hba.h"
-#include "target_core_seobj.h"
 
 /*	core_clear_initiator_node_from_tpg():
  *
@@ -759,7 +758,7 @@ int core_tpg_post_addlun(
 	void *lun_ptr)
 {
 	lun->lun_type_ptr = lun_ptr;
-	if (dev_obj_export(lun_ptr, tpg, lun) < 0) {
+	if (core_dev_export(lun_ptr, tpg, lun) < 0) {
 		lun->lun_type_ptr = NULL;
 		return -1;
 	}
@@ -832,7 +831,7 @@ int core_tpg_post_dellun(
 
 	core_tpg_shutdown_lun(tpg, lun);
 
-	dev_obj_unexport(lun->lun_type_ptr, tpg, lun);
+	core_dev_unexport(lun->lun_type_ptr, tpg, lun);
 
 	spin_lock(&tpg->tpg_lun_lock);
 	lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
drivers/target/target_core_transport.c +164 -58

553 lines not on this page · raw message

include/target/target_core_device.h +6 -0
index aebfb4e..e895604 100644
@@ -51,6 +51,10 @@ extern struct se_port *core_alloc_port(struct se_device *);
 extern void core_export_port(struct se_device *, struct se_portal_group *,
 					struct se_port *, struct se_lun *);
 extern void core_release_port(struct se_device *, struct se_port *);
+extern int core_dev_export(struct se_device *, struct se_portal_group *,
+					struct se_lun *);
+extern void core_dev_unexport(struct se_device *, struct se_portal_group *,
+					struct se_lun *);
 extern int transport_core_report_lun_response(struct se_cmd *);
 extern void se_release_device_for_hba(struct se_device *);
 extern void se_release_vpd_for_dev(struct se_device *);
@@ -58,6 +62,8 @@ extern void se_clear_dev_ports(struct se_device *);
 extern int se_free_virtual_device(struct se_device *, struct se_hba *);
 extern void se_dev_start(struct se_device *);
 extern void se_dev_stop(struct se_device *);
+extern int se_dev_check_online(struct se_device *);
+extern int se_dev_check_shutdown(struct se_device *);
 extern void se_dev_set_default_attribs(struct se_device *);
 extern int se_dev_set_task_timeout(struct se_device *, u32);
 extern int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int);
Signature · 1 line
1.5.6.5