target: remove struct se_task
[firefly-linux-kernel-4.4.55.git] / include / target / target_core_base.h
index aaccc5f5fc9f963d8fdee2a0c17b436948541f71..55a80bd507032f1f39d921796d789e6168598c0a 100644 (file)
@@ -73,9 +73,8 @@
 /*
  * struct se_device->dev_flags
  */
-#define DF_READ_ONLY                           0x00000001
-#define DF_SPC2_RESERVATIONS                   0x00000002
-#define DF_SPC2_RESERVATIONS_WITH_ISID         0x00000004
+#define DF_SPC2_RESERVATIONS                   0x00000001
+#define DF_SPC2_RESERVATIONS_WITH_ISID         0x00000002
 
 /* struct se_dev_attrib sanity values */
 /* Default max_unmap_lba_count */
@@ -141,14 +140,6 @@ enum transport_tpg_type_table {
        TRANSPORT_TPG_TYPE_DISCOVERY = 1,
 };
 
-/* struct se_task->task_flags */
-enum se_task_flags {
-       TF_ACTIVE               = (1 << 0),
-       TF_SENT                 = (1 << 1),
-       TF_REQUEST_STOP         = (1 << 2),
-       TF_HAS_SENSE            = (1 << 3),
-};
-
 /* Special transport agnostic struct se_cmd->t_states */
 enum transport_state_table {
        TRANSPORT_NO_STATE      = 0,
@@ -234,6 +225,7 @@ enum tcm_sense_reason_table {
 enum target_sc_flags_table {
        TARGET_SCF_BIDI_OP              = 0x01,
        TARGET_SCF_ACK_KREF             = 0x02,
+       TARGET_SCF_UNKNOWN_SIZE         = 0x04,
 };
 
 /* fabric independent task management function values */
@@ -485,23 +477,6 @@ struct se_queue_obj {
        wait_queue_head_t       thread_wq;
 };
 
-struct se_task {
-       unsigned long long      task_lba;
-       u32                     task_sectors;
-       u32                     task_size;
-       struct se_cmd           *task_se_cmd;
-       struct scatterlist      *task_sg;
-       u32                     task_sg_nents;
-       u16                     task_flags;
-       u8                      task_scsi_status;
-       enum dma_data_direction task_data_direction;
-       struct list_head        t_list;
-       struct list_head        t_execute_list;
-       struct list_head        t_state_list;
-       bool                    t_state_active;
-       struct completion       task_stop_comp;
-};
-
 struct se_tmr_req {
        /* Task Management function to be performed */
        u8                      function;
@@ -538,6 +513,7 @@ struct se_cmd {
        /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
        unsigned                check_release:1;
        unsigned                cmd_wait_set:1;
+       unsigned                unknown_data_length:1;
        /* See se_cmd_flags_table */
        u32                     se_cmd_flags;
        u32                     se_ordered_id;
@@ -565,18 +541,16 @@ struct se_cmd {
        struct completion       cmd_wait_comp;
        struct kref             cmd_kref;
        struct target_core_fabric_ops *se_tfo;
-       int (*execute_task)(struct se_task *);
+       int (*execute_cmd)(struct se_cmd *);
        void (*transport_complete_callback)(struct se_cmd *);
 
        unsigned char           *t_task_cdb;
        unsigned char           __t_task_cdb[TCM_MAX_COMMAND_SIZE];
        unsigned long long      t_task_lba;
-       u32                     t_tasks_sg_chained_no;
        atomic_t                t_fe_count;
        atomic_t                t_se_count;
        atomic_t                t_task_cdbs_left;
        atomic_t                t_task_cdbs_ex_left;
-       atomic_t                t_task_cdbs_sent;
        unsigned int            transport_state;
 #define CMD_T_ABORTED          (1 << 0)
 #define CMD_T_ACTIVE           (1 << 1)
@@ -588,11 +562,12 @@ struct se_cmd {
 #define CMD_T_LUN_STOP         (1 << 7)
 #define CMD_T_LUN_FE_STOP      (1 << 8)
 #define CMD_T_DEV_ACTIVE       (1 << 9)
+#define CMD_T_REQUEST_STOP     (1 << 10)
+#define CMD_T_BUSY             (1 << 11)
        spinlock_t              t_state_lock;
        struct completion       t_transport_stop_comp;
        struct completion       transport_lun_fe_stop_comp;
        struct completion       transport_lun_stop_comp;
-       struct scatterlist      *t_tasks_sg_chained;
 
        struct work_struct      work;
 
@@ -602,10 +577,15 @@ struct se_cmd {
        struct scatterlist      *t_bidi_data_sg;
        unsigned int            t_bidi_data_nents;
 
-       /* Used for BIDI READ */
-       struct list_head        t_task_list;
-       u32                     t_task_list_num;
+       struct list_head        execute_list;
+       struct list_head        state_list;
+       bool                    state_active;
+
+       /* old task stop completion, consider merging with some of the above */
+       struct completion       task_stop_comp;
 
+       /* backend private data */
+       void                    *priv;
 };
 
 struct se_ua {
@@ -829,8 +809,8 @@ struct se_device {
        struct task_struct      *process_thread;
        struct work_struct      qf_work_queue;
        struct list_head        delayed_cmd_list;
-       struct list_head        execute_task_list;
-       struct list_head        state_task_list;
+       struct list_head        execute_list;
+       struct list_head        state_list;
        struct list_head        qf_cmd_list;
        /* Pointer to associated SE HBA */
        struct se_hba           *se_hba;