Commit 42bf829e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nicholas Bellinger

target: Cleanup unused se_task bits

This is a squashed version of the following se_task cleanup patches:

    target: remove the unused task_state_flags field in se_task
    target: remove the unused se_obj_ptr field in se_task
    target: remove the se_dev field in se_task
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent c0427f15
...@@ -272,13 +272,14 @@ fd_alloc_task(unsigned char *cdb) ...@@ -272,13 +272,14 @@ fd_alloc_task(unsigned char *cdb)
static int fd_do_readv(struct se_task *task) static int fd_do_readv(struct se_task *task)
{ {
struct fd_request *req = FILE_REQ(task); struct fd_request *req = FILE_REQ(task);
struct fd_dev *dev = req->fd_task.se_dev->dev_ptr; struct se_device *se_dev = req->fd_task.task_se_cmd->se_dev;
struct fd_dev *dev = se_dev->dev_ptr;
struct file *fd = dev->fd_file; struct file *fd = dev->fd_file;
struct scatterlist *sg = task->task_sg; struct scatterlist *sg = task->task_sg;
struct iovec *iov; struct iovec *iov;
mm_segment_t old_fs; mm_segment_t old_fs;
loff_t pos = (task->task_lba * loff_t pos = (task->task_lba *
task->se_dev->se_sub_dev->se_dev_attrib.block_size); se_dev->se_sub_dev->se_dev_attrib.block_size);
int ret = 0, i; int ret = 0, i;
iov = kzalloc(sizeof(struct iovec) * task->task_sg_nents, GFP_KERNEL); iov = kzalloc(sizeof(struct iovec) * task->task_sg_nents, GFP_KERNEL);
...@@ -324,13 +325,14 @@ static int fd_do_readv(struct se_task *task) ...@@ -324,13 +325,14 @@ static int fd_do_readv(struct se_task *task)
static int fd_do_writev(struct se_task *task) static int fd_do_writev(struct se_task *task)
{ {
struct fd_request *req = FILE_REQ(task); struct fd_request *req = FILE_REQ(task);
struct fd_dev *dev = req->fd_task.se_dev->dev_ptr; struct se_device *se_dev = req->fd_task.task_se_cmd->se_dev;
struct fd_dev *dev = se_dev->dev_ptr;
struct file *fd = dev->fd_file; struct file *fd = dev->fd_file;
struct scatterlist *sg = task->task_sg; struct scatterlist *sg = task->task_sg;
struct iovec *iov; struct iovec *iov;
mm_segment_t old_fs; mm_segment_t old_fs;
loff_t pos = (task->task_lba * loff_t pos = (task->task_lba *
task->se_dev->se_sub_dev->se_dev_attrib.block_size); se_dev->se_sub_dev->se_dev_attrib.block_size);
int ret, i = 0; int ret, i = 0;
iov = kzalloc(sizeof(struct iovec) * task->task_sg_nents, GFP_KERNEL); iov = kzalloc(sizeof(struct iovec) * task->task_sg_nents, GFP_KERNEL);
......
...@@ -499,7 +499,7 @@ static ssize_t iblock_show_configfs_dev_params( ...@@ -499,7 +499,7 @@ static ssize_t iblock_show_configfs_dev_params(
static void iblock_bio_destructor(struct bio *bio) static void iblock_bio_destructor(struct bio *bio)
{ {
struct se_task *task = bio->bi_private; struct se_task *task = bio->bi_private;
struct iblock_dev *ib_dev = task->se_dev->dev_ptr; struct iblock_dev *ib_dev = task->task_se_cmd->se_dev->dev_ptr;
bio_free(bio, ib_dev->ibd_bio_set); bio_free(bio, ib_dev->ibd_bio_set);
} }
...@@ -507,7 +507,7 @@ static void iblock_bio_destructor(struct bio *bio) ...@@ -507,7 +507,7 @@ static void iblock_bio_destructor(struct bio *bio)
static struct bio * static struct bio *
iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num) iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num)
{ {
struct iblock_dev *ib_dev = task->se_dev->dev_ptr; struct iblock_dev *ib_dev = task->task_se_cmd->se_dev->dev_ptr;
struct iblock_req *ib_req = IBLOCK_REQ(task); struct iblock_req *ib_req = IBLOCK_REQ(task);
struct bio *bio; struct bio *bio;
......
...@@ -676,7 +676,7 @@ static inline struct pscsi_plugin_task *PSCSI_TASK(struct se_task *task) ...@@ -676,7 +676,7 @@ static inline struct pscsi_plugin_task *PSCSI_TASK(struct se_task *task)
*/ */
static int pscsi_transport_complete(struct se_task *task) static int pscsi_transport_complete(struct se_task *task)
{ {
struct pscsi_dev_virt *pdv = task->se_dev->dev_ptr; struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr;
struct scsi_device *sd = pdv->pdv_sd; struct scsi_device *sd = pdv->pdv_sd;
int result; int result;
struct pscsi_plugin_task *pt = PSCSI_TASK(task); struct pscsi_plugin_task *pt = PSCSI_TASK(task);
...@@ -962,7 +962,7 @@ static inline struct bio *pscsi_get_bio(int sg_num) ...@@ -962,7 +962,7 @@ static inline struct bio *pscsi_get_bio(int sg_num)
static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
struct bio **hbio) struct bio **hbio)
{ {
struct pscsi_dev_virt *pdv = task->se_dev->dev_ptr; struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr;
u32 task_sg_num = task->task_sg_nents; u32 task_sg_num = task->task_sg_nents;
struct bio *bio = NULL, *tbio = NULL; struct bio *bio = NULL, *tbio = NULL;
struct page *page; struct page *page;
...@@ -1062,7 +1062,7 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, ...@@ -1062,7 +1062,7 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
static int pscsi_do_task(struct se_task *task) static int pscsi_do_task(struct se_task *task)
{ {
struct pscsi_dev_virt *pdv = task->se_dev->dev_ptr; struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr;
struct pscsi_plugin_task *pt = PSCSI_TASK(task); struct pscsi_plugin_task *pt = PSCSI_TASK(task);
struct request *req; struct request *req;
struct bio *hbio; struct bio *hbio;
......
...@@ -350,7 +350,7 @@ static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page) ...@@ -350,7 +350,7 @@ static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page)
static int rd_MEMCPY_read(struct rd_request *req) static int rd_MEMCPY_read(struct rd_request *req)
{ {
struct se_task *task = &req->rd_task; struct se_task *task = &req->rd_task;
struct rd_dev *dev = req->rd_task.se_dev->dev_ptr; struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr;
struct rd_dev_sg_table *table; struct rd_dev_sg_table *table;
struct scatterlist *sg_d, *sg_s; struct scatterlist *sg_d, *sg_s;
void *dst, *src; void *dst, *src;
...@@ -466,7 +466,7 @@ static int rd_MEMCPY_read(struct rd_request *req) ...@@ -466,7 +466,7 @@ static int rd_MEMCPY_read(struct rd_request *req)
static int rd_MEMCPY_write(struct rd_request *req) static int rd_MEMCPY_write(struct rd_request *req)
{ {
struct se_task *task = &req->rd_task; struct se_task *task = &req->rd_task;
struct rd_dev *dev = req->rd_task.se_dev->dev_ptr; struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr;
struct rd_dev_sg_table *table; struct rd_dev_sg_table *table;
struct scatterlist *sg_d, *sg_s; struct scatterlist *sg_d, *sg_s;
void *dst, *src; void *dst, *src;
...@@ -581,7 +581,7 @@ static int rd_MEMCPY_write(struct rd_request *req) ...@@ -581,7 +581,7 @@ static int rd_MEMCPY_write(struct rd_request *req)
*/ */
static int rd_MEMCPY_do_task(struct se_task *task) static int rd_MEMCPY_do_task(struct se_task *task)
{ {
struct se_device *dev = task->se_dev; struct se_device *dev = task->task_se_cmd->se_dev;
struct rd_request *req = RD_REQ(task); struct rd_request *req = RD_REQ(task);
unsigned long long lba; unsigned long long lba;
int ret; int ret;
......
...@@ -432,15 +432,14 @@ EXPORT_SYMBOL(transport_deregister_session); ...@@ -432,15 +432,14 @@ EXPORT_SYMBOL(transport_deregister_session);
*/ */
static void transport_all_task_dev_remove_state(struct se_cmd *cmd) static void transport_all_task_dev_remove_state(struct se_cmd *cmd)
{ {
struct se_device *dev; struct se_device *dev = cmd->se_dev;
struct se_task *task; struct se_task *task;
unsigned long flags; unsigned long flags;
list_for_each_entry(task, &cmd->t_task_list, t_list) {
dev = task->se_dev;
if (!dev) if (!dev)
continue; return;
list_for_each_entry(task, &cmd->t_task_list, t_list) {
if (atomic_read(&task->task_active)) if (atomic_read(&task->task_active))
continue; continue;
...@@ -708,7 +707,7 @@ EXPORT_SYMBOL(transport_complete_sync_cache); ...@@ -708,7 +707,7 @@ EXPORT_SYMBOL(transport_complete_sync_cache);
void transport_complete_task(struct se_task *task, int success) void transport_complete_task(struct se_task *task, int success)
{ {
struct se_cmd *cmd = task->task_se_cmd; struct se_cmd *cmd = task->task_se_cmd;
struct se_device *dev = task->se_dev; struct se_device *dev = cmd->se_dev;
int t_state; int t_state;
unsigned long flags; unsigned long flags;
#if 0 #if 0
...@@ -886,14 +885,12 @@ static void __transport_add_task_to_execute_queue( ...@@ -886,14 +885,12 @@ static void __transport_add_task_to_execute_queue(
static void transport_add_tasks_to_state_queue(struct se_cmd *cmd) static void transport_add_tasks_to_state_queue(struct se_cmd *cmd)
{ {
struct se_device *dev; struct se_device *dev = cmd->se_dev;
struct se_task *task; struct se_task *task;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&cmd->t_state_lock, flags); spin_lock_irqsave(&cmd->t_state_lock, flags);
list_for_each_entry(task, &cmd->t_task_list, t_list) { list_for_each_entry(task, &cmd->t_task_list, t_list) {
dev = task->se_dev;
if (atomic_read(&task->task_state_active)) if (atomic_read(&task->task_state_active))
continue; continue;
...@@ -1522,7 +1519,6 @@ transport_generic_get_task(struct se_cmd *cmd, ...@@ -1522,7 +1519,6 @@ transport_generic_get_task(struct se_cmd *cmd,
INIT_LIST_HEAD(&task->t_state_list); INIT_LIST_HEAD(&task->t_state_list);
init_completion(&task->task_stop_comp); init_completion(&task->task_stop_comp);
task->task_se_cmd = cmd; task->task_se_cmd = cmd;
task->se_dev = dev;
task->task_data_direction = data_direction; task->task_data_direction = data_direction;
return task; return task;
...@@ -1802,7 +1798,7 @@ static int transport_stop_tasks_for_cmd(struct se_cmd *cmd) ...@@ -1802,7 +1798,7 @@ static int transport_stop_tasks_for_cmd(struct se_cmd *cmd)
spin_unlock_irqrestore(&cmd->t_state_lock, spin_unlock_irqrestore(&cmd->t_state_lock,
flags); flags);
transport_remove_task_from_execute_queue(task, transport_remove_task_from_execute_queue(task,
task->se_dev); cmd->se_dev);
pr_debug("task_no[%d] - Removed from execute queue\n", pr_debug("task_no[%d] - Removed from execute queue\n",
task->task_no); task->task_no);
...@@ -2130,7 +2126,7 @@ static void transport_task_timeout_handler(unsigned long data) ...@@ -2130,7 +2126,7 @@ static void transport_task_timeout_handler(unsigned long data)
*/ */
static void transport_start_task_timer(struct se_task *task) static void transport_start_task_timer(struct se_task *task)
{ {
struct se_device *dev = task->se_dev; struct se_device *dev = task->task_se_cmd->se_dev;
int timeout; int timeout;
if (task->task_flags & TF_RUNNING) if (task->task_flags & TF_RUNNING)
...@@ -2656,13 +2652,16 @@ static void transport_xor_callback(struct se_cmd *cmd) ...@@ -2656,13 +2652,16 @@ static void transport_xor_callback(struct se_cmd *cmd)
static int transport_get_sense_data(struct se_cmd *cmd) static int transport_get_sense_data(struct se_cmd *cmd)
{ {
unsigned char *buffer = cmd->sense_buffer, *sense_buffer = NULL; unsigned char *buffer = cmd->sense_buffer, *sense_buffer = NULL;
struct se_device *dev; struct se_device *dev = cmd->se_dev;
struct se_task *task = NULL, *task_tmp; struct se_task *task = NULL, *task_tmp;
unsigned long flags; unsigned long flags;
u32 offset = 0; u32 offset = 0;
WARN_ON(!cmd->se_lun); WARN_ON(!cmd->se_lun);
if (!dev)
return 0;
spin_lock_irqsave(&cmd->t_state_lock, flags); spin_lock_irqsave(&cmd->t_state_lock, flags);
if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) { if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) {
spin_unlock_irqrestore(&cmd->t_state_lock, flags); spin_unlock_irqrestore(&cmd->t_state_lock, flags);
...@@ -2671,14 +2670,9 @@ static int transport_get_sense_data(struct se_cmd *cmd) ...@@ -2671,14 +2670,9 @@ static int transport_get_sense_data(struct se_cmd *cmd)
list_for_each_entry_safe(task, task_tmp, list_for_each_entry_safe(task, task_tmp,
&cmd->t_task_list, t_list) { &cmd->t_task_list, t_list) {
if (!task->task_sense) if (!task->task_sense)
continue; continue;
dev = task->se_dev;
if (!dev)
continue;
if (!dev->transport->get_sense_buffer) { if (!dev->transport->get_sense_buffer) {
pr_err("dev->transport->get_sense_buffer" pr_err("dev->transport->get_sense_buffer"
" is NULL\n"); " is NULL\n");
...@@ -3628,11 +3622,7 @@ static void transport_free_dev_tasks(struct se_cmd *cmd) ...@@ -3628,11 +3622,7 @@ static void transport_free_dev_tasks(struct se_cmd *cmd)
list_del(&task->t_list); list_del(&task->t_list);
spin_unlock_irqrestore(&cmd->t_state_lock, flags); spin_unlock_irqrestore(&cmd->t_state_lock, flags);
if (task->se_dev) cmd->se_dev->transport->free_task(task);
task->se_dev->transport->free_task(task);
else
pr_err("task[%u] - task->se_dev is NULL\n",
task->task_no);
spin_lock_irqsave(&cmd->t_state_lock, flags); spin_lock_irqsave(&cmd->t_state_lock, flags);
} }
spin_unlock_irqrestore(&cmd->t_state_lock, flags); spin_unlock_irqrestore(&cmd->t_state_lock, flags);
......
...@@ -405,7 +405,6 @@ struct se_task { ...@@ -405,7 +405,6 @@ struct se_task {
u8 task_scsi_status; u8 task_scsi_status;
u8 task_flags; u8 task_flags;
int task_error_status; int task_error_status;
int task_state_flags;
bool task_padded_sg; bool task_padded_sg;
unsigned long long task_lba; unsigned long long task_lba;
u32 task_no; u32 task_no;
...@@ -413,7 +412,6 @@ struct se_task { ...@@ -413,7 +412,6 @@ struct se_task {
u32 task_size; u32 task_size;
enum dma_data_direction task_data_direction; enum dma_data_direction task_data_direction;
struct se_cmd *task_se_cmd; struct se_cmd *task_se_cmd;
struct se_device *se_dev;
struct completion task_stop_comp; struct completion task_stop_comp;
atomic_t task_active; atomic_t task_active;
atomic_t task_execute_queue; atomic_t task_execute_queue;
...@@ -422,7 +420,6 @@ struct se_task { ...@@ -422,7 +420,6 @@ struct se_task {
atomic_t task_stop; atomic_t task_stop;
atomic_t task_state_active; atomic_t task_state_active;
struct timer_list task_timer; struct timer_list task_timer;
struct se_device *se_obj_ptr;
struct list_head t_list; struct list_head t_list;
struct list_head t_execute_list; struct list_head t_execute_list;
struct list_head t_state_list; struct list_head t_state_list;
......
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
#define TRANSPORT_TIMEOUT_TYPE_TAPE 600 #define TRANSPORT_TIMEOUT_TYPE_TAPE 600
#define TRANSPORT_TIMEOUT_TYPE_OTHER 300 #define TRANSPORT_TIMEOUT_TYPE_OTHER 300
/* For se_task->task_state_flags */
#define TSF_EXCEPTION_CLEARED 0x01
/* /*
* struct se_subsystem_dev->su_dev_flags * struct se_subsystem_dev->su_dev_flags
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment