diff options
| author | Christoph Hellwig <hch@infradead.org> | 2012-10-08 00:03:19 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-11-06 23:55:43 -0500 |
| commit | 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 (patch) | |
| tree | c642e3da11e534a311a1e998ef740a3d44b9187b /include/target | |
| parent | 3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff) | |
target: kill struct se_subsystem_dev
Simplify the code a lot by killing the superflous struct se_subsystem_dev.
Instead se_device is allocated early on by the backend driver, which allocates
it as part of its own per-device structure, borrowing the scheme that is for
example used for inode allocation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
| -rw-r--r-- | include/target/target_core_backend.h | 25 | ||||
| -rw-r--r-- | include/target/target_core_base.h | 104 |
2 files changed, 38 insertions, 91 deletions
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 2acd54018b64..6c5bfb5ac17f 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
| @@ -9,6 +9,8 @@ struct se_subsystem_api { | |||
| 9 | struct list_head sub_api_list; | 9 | struct list_head sub_api_list; |
| 10 | 10 | ||
| 11 | char name[16]; | 11 | char name[16]; |
| 12 | char inquiry_prod[16]; | ||
| 13 | char inquiry_rev[4]; | ||
| 12 | struct module *owner; | 14 | struct module *owner; |
| 13 | 15 | ||
| 14 | u8 transport_type; | 16 | u8 transport_type; |
| @@ -16,21 +18,20 @@ struct se_subsystem_api { | |||
| 16 | int (*attach_hba)(struct se_hba *, u32); | 18 | int (*attach_hba)(struct se_hba *, u32); |
| 17 | void (*detach_hba)(struct se_hba *); | 19 | void (*detach_hba)(struct se_hba *); |
| 18 | int (*pmode_enable_hba)(struct se_hba *, unsigned long); | 20 | int (*pmode_enable_hba)(struct se_hba *, unsigned long); |
| 19 | void *(*allocate_virtdevice)(struct se_hba *, const char *); | 21 | |
| 20 | struct se_device *(*create_virtdevice)(struct se_hba *, | 22 | struct se_device *(*alloc_device)(struct se_hba *, const char *); |
| 21 | struct se_subsystem_dev *, void *); | 23 | int (*configure_device)(struct se_device *); |
| 22 | void (*free_device)(void *); | 24 | void (*free_device)(struct se_device *device); |
| 25 | |||
| 26 | ssize_t (*set_configfs_dev_params)(struct se_device *, | ||
| 27 | const char *, ssize_t); | ||
| 28 | ssize_t (*show_configfs_dev_params)(struct se_device *, char *); | ||
| 29 | |||
| 23 | void (*transport_complete)(struct se_cmd *cmd, | 30 | void (*transport_complete)(struct se_cmd *cmd, |
| 24 | struct scatterlist *, | 31 | struct scatterlist *, |
| 25 | unsigned char *); | 32 | unsigned char *); |
| 26 | 33 | ||
| 27 | int (*parse_cdb)(struct se_cmd *cmd); | 34 | int (*parse_cdb)(struct se_cmd *cmd); |
| 28 | ssize_t (*check_configfs_dev_params)(struct se_hba *, | ||
| 29 | struct se_subsystem_dev *); | ||
| 30 | ssize_t (*set_configfs_dev_params)(struct se_hba *, | ||
| 31 | struct se_subsystem_dev *, const char *, ssize_t); | ||
| 32 | ssize_t (*show_configfs_dev_params)(struct se_hba *, | ||
| 33 | struct se_subsystem_dev *, char *); | ||
| 34 | u32 (*get_device_rev)(struct se_device *); | 35 | u32 (*get_device_rev)(struct se_device *); |
| 35 | u32 (*get_device_type)(struct se_device *); | 36 | u32 (*get_device_type)(struct se_device *); |
| 36 | sector_t (*get_blocks)(struct se_device *); | 37 | sector_t (*get_blocks)(struct se_device *); |
| @@ -47,10 +48,6 @@ struct spc_ops { | |||
| 47 | int transport_subsystem_register(struct se_subsystem_api *); | 48 | int transport_subsystem_register(struct se_subsystem_api *); |
| 48 | void transport_subsystem_release(struct se_subsystem_api *); | 49 | void transport_subsystem_release(struct se_subsystem_api *); |
| 49 | 50 | ||
| 50 | struct se_device *transport_add_device_to_core_hba(struct se_hba *, | ||
| 51 | struct se_subsystem_api *, struct se_subsystem_dev *, u32, | ||
| 52 | void *, struct se_dev_limits *, const char *, const char *); | ||
| 53 | |||
| 54 | void target_complete_cmd(struct se_cmd *, u8); | 51 | void target_complete_cmd(struct se_cmd *, u8); |
| 55 | 52 | ||
| 56 | int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops); | 53 | int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops); |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5be89373ceac..f6355fc325a8 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -62,20 +62,6 @@ | |||
| 62 | 62 | ||
| 63 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | 63 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ |
| 64 | 64 | ||
| 65 | /* | ||
| 66 | * struct se_subsystem_dev->su_dev_flags | ||
| 67 | */ | ||
| 68 | #define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 | ||
| 69 | #define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 | ||
| 70 | #define SDF_USING_UDEV_PATH 0x00000004 | ||
| 71 | #define SDF_USING_ALIAS 0x00000008 | ||
| 72 | |||
| 73 | /* | ||
| 74 | * struct se_device->dev_flags | ||
| 75 | */ | ||
| 76 | #define DF_SPC2_RESERVATIONS 0x00000001 | ||
| 77 | #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000002 | ||
| 78 | |||
| 79 | /* struct se_dev_attrib sanity values */ | 65 | /* struct se_dev_attrib sanity values */ |
| 80 | /* Default max_unmap_lba_count */ | 66 | /* Default max_unmap_lba_count */ |
| 81 | #define DA_MAX_UNMAP_LBA_COUNT 0 | 67 | #define DA_MAX_UNMAP_LBA_COUNT 0 |
| @@ -182,16 +168,6 @@ enum transport_lunflags_table { | |||
| 182 | TRANSPORT_LUNFLAGS_READ_WRITE = 0x04, | 168 | TRANSPORT_LUNFLAGS_READ_WRITE = 0x04, |
| 183 | }; | 169 | }; |
| 184 | 170 | ||
| 185 | /* struct se_device->dev_status */ | ||
| 186 | enum transport_device_status_table { | ||
| 187 | TRANSPORT_DEVICE_ACTIVATED = 0x01, | ||
| 188 | TRANSPORT_DEVICE_DEACTIVATED = 0x02, | ||
| 189 | TRANSPORT_DEVICE_QUEUE_FULL = 0x04, | ||
| 190 | TRANSPORT_DEVICE_SHUTDOWN = 0x08, | ||
| 191 | TRANSPORT_DEVICE_OFFLINE_ACTIVATED = 0x10, | ||
| 192 | TRANSPORT_DEVICE_OFFLINE_DEACTIVATED = 0x20, | ||
| 193 | }; | ||
| 194 | |||
| 195 | /* | 171 | /* |
| 196 | * Used by transport_send_check_condition_and_sense() and se_cmd->scsi_sense_reason | 172 | * Used by transport_send_check_condition_and_sense() and se_cmd->scsi_sense_reason |
| 197 | * to signal which ASC/ASCQ sense payload should be built. | 173 | * to signal which ASC/ASCQ sense payload should be built. |
| @@ -246,10 +222,6 @@ enum tcm_tmrsp_table { | |||
| 246 | TMR_FUNCTION_REJECTED = 255, | 222 | TMR_FUNCTION_REJECTED = 255, |
| 247 | }; | 223 | }; |
| 248 | 224 | ||
| 249 | struct se_obj { | ||
| 250 | atomic_t obj_access_count; | ||
| 251 | }; | ||
| 252 | |||
| 253 | /* | 225 | /* |
| 254 | * Used by TCM Core internally to signal if ALUA emulation is enabled or | 226 | * Used by TCM Core internally to signal if ALUA emulation is enabled or |
| 255 | * disabled, or running in with TCM/pSCSI passthrough mode | 227 | * disabled, or running in with TCM/pSCSI passthrough mode |
| @@ -288,7 +260,7 @@ struct t10_alua { | |||
| 288 | u16 alua_tg_pt_gps_counter; | 260 | u16 alua_tg_pt_gps_counter; |
| 289 | u32 alua_tg_pt_gps_count; | 261 | u32 alua_tg_pt_gps_count; |
| 290 | spinlock_t tg_pt_gps_lock; | 262 | spinlock_t tg_pt_gps_lock; |
| 291 | struct se_subsystem_dev *t10_sub_dev; | 263 | struct se_device *t10_dev; |
| 292 | /* Used for default ALUA Target Port Group */ | 264 | /* Used for default ALUA Target Port Group */ |
| 293 | struct t10_alua_tg_pt_gp *default_tg_pt_gp; | 265 | struct t10_alua_tg_pt_gp *default_tg_pt_gp; |
| 294 | /* Used for default ALUA Target Port Group ConfigFS group */ | 266 | /* Used for default ALUA Target Port Group ConfigFS group */ |
| @@ -335,7 +307,7 @@ struct t10_alua_tg_pt_gp { | |||
| 335 | atomic_t tg_pt_gp_ref_cnt; | 307 | atomic_t tg_pt_gp_ref_cnt; |
| 336 | spinlock_t tg_pt_gp_lock; | 308 | spinlock_t tg_pt_gp_lock; |
| 337 | struct mutex tg_pt_gp_md_mutex; | 309 | struct mutex tg_pt_gp_md_mutex; |
| 338 | struct se_subsystem_dev *tg_pt_gp_su_dev; | 310 | struct se_device *tg_pt_gp_dev; |
| 339 | struct config_group tg_pt_gp_group; | 311 | struct config_group tg_pt_gp_group; |
| 340 | struct list_head tg_pt_gp_list; | 312 | struct list_head tg_pt_gp_list; |
| 341 | struct list_head tg_pt_gp_mem_list; | 313 | struct list_head tg_pt_gp_mem_list; |
| @@ -366,7 +338,7 @@ struct t10_wwn { | |||
| 366 | char revision[4]; | 338 | char revision[4]; |
| 367 | char unit_serial[INQUIRY_VPD_SERIAL_LEN]; | 339 | char unit_serial[INQUIRY_VPD_SERIAL_LEN]; |
| 368 | spinlock_t t10_vpd_lock; | 340 | spinlock_t t10_vpd_lock; |
| 369 | struct se_subsystem_dev *t10_sub_dev; | 341 | struct se_device *t10_dev; |
| 370 | struct config_group t10_wwn_group; | 342 | struct config_group t10_wwn_group; |
| 371 | struct list_head t10_vpd_list; | 343 | struct list_head t10_vpd_list; |
| 372 | }; | 344 | }; |
| @@ -662,15 +634,6 @@ struct se_dev_entry { | |||
| 662 | struct list_head ua_list; | 634 | struct list_head ua_list; |
| 663 | }; | 635 | }; |
| 664 | 636 | ||
| 665 | struct se_dev_limits { | ||
| 666 | /* Max supported HW queue depth */ | ||
| 667 | u32 hw_queue_depth; | ||
| 668 | /* Max supported virtual queue depth */ | ||
| 669 | u32 queue_depth; | ||
| 670 | /* From include/linux/blkdev.h for the other HW/SW limits. */ | ||
| 671 | struct queue_limits limits; | ||
| 672 | }; | ||
| 673 | |||
| 674 | struct se_dev_attrib { | 637 | struct se_dev_attrib { |
| 675 | int emulate_dpo; | 638 | int emulate_dpo; |
| 676 | int emulate_fua_write; | 639 | int emulate_fua_write; |
| @@ -696,7 +659,7 @@ struct se_dev_attrib { | |||
| 696 | u32 max_unmap_block_desc_count; | 659 | u32 max_unmap_block_desc_count; |
| 697 | u32 unmap_granularity; | 660 | u32 unmap_granularity; |
| 698 | u32 unmap_granularity_alignment; | 661 | u32 unmap_granularity_alignment; |
| 699 | struct se_subsystem_dev *da_sub_dev; | 662 | struct se_device *da_dev; |
| 700 | struct config_group da_group; | 663 | struct config_group da_group; |
| 701 | }; | ||
