diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2017-10-31 14:03:11 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-11-04 18:15:41 -0400 |
commit | c01706982350224a6c3653ca5b6f24f37dbbecad (patch) | |
tree | 96b84c3f6803a440e66e2da13cac50257258770a | |
parent | d7e595ddd5b243aa9ba1948d5e0a37783b5415af (diff) |
target: Inline transport_put_cmd()
Since all transput_put_cmd() does is to call target_put_sess_cmd(),
inline transport_put_cmd() into its callers. Leave out the BUG_ON()
statement because if cmd->se_tfo == NULL then cmd->cmd_kref is 0
and kref_put() will complain anyway. Notes:
- transport_init_se_cmd() initializes both .se_tfo and .cmd_kref.
- The only target driver that does not call transport_init_se_cmd()
for all commands is the iSCSI target driver. See also
iscsi_target_rx_opcode().
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Christie <mchristi@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_transport.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index e2bf547054bd..473d652e4816 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -67,7 +67,6 @@ static void transport_complete_task_attr(struct se_cmd *cmd); | |||
67 | static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason); | 67 | static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason); |
68 | static void transport_handle_queue_full(struct se_cmd *cmd, | 68 | static void transport_handle_queue_full(struct se_cmd *cmd, |
69 | struct se_device *dev, int err, bool write_pending); | 69 | struct se_device *dev, int err, bool write_pending); |
70 | static int transport_put_cmd(struct se_cmd *cmd); | ||
71 | static void target_complete_ok_work(struct work_struct *work); | 70 | static void target_complete_ok_work(struct work_struct *work); |
72 | 71 | ||
73 | int init_se_kmem_caches(void) | 72 | int init_se_kmem_caches(void) |
@@ -668,7 +667,7 @@ int transport_cmd_finish_abort(struct se_cmd *cmd, int remove) | |||
668 | if (transport_cmd_check_stop_to_fabric(cmd)) | 667 | if (transport_cmd_check_stop_to_fabric(cmd)) |
669 | return 1; | 668 | return 1; |
670 | if (remove && ack_kref) | 669 | if (remove && ack_kref) |
671 | ret = transport_put_cmd(cmd); | 670 | ret = target_put_sess_cmd(cmd); |
672 | 671 | ||
673 | return ret; | 672 | return ret; |
674 | } | 673 | } |
@@ -2354,22 +2353,6 @@ static inline void transport_free_pages(struct se_cmd *cmd) | |||
2354 | cmd->t_bidi_data_nents = 0; | 2353 | cmd->t_bidi_data_nents = 0; |
2355 | } | 2354 | } |
2356 | 2355 | ||
2357 | /** | ||
2358 | * transport_put_cmd - release a reference to a command | ||
2359 | * @cmd: command to release | ||
2360 | * | ||
2361 | * This routine releases our reference to the command and frees it if possible. | ||
2362 | */ | ||
2363 | static int transport_put_cmd(struct se_cmd *cmd) | ||
2364 | { | ||
2365 | BUG_ON(!cmd->se_tfo); | ||
2366 | /* | ||
2367 | * If this cmd has been setup with target_get_sess_cmd(), drop | ||
2368 | * the kref and call ->release_cmd() in kref callback. | ||
2369 | */ | ||
2370 | return target_put_sess_cmd(cmd); | ||
2371 | } | ||
2372 | |||
2373 | void *transport_kmap_data_sg(struct se_cmd *cmd) | 2356 | void *transport_kmap_data_sg(struct se_cmd *cmd) |
2374 | { | 2357 | { |
2375 | struct scatterlist *sg = cmd->t_data_sg; | 2358 | struct scatterlist *sg = cmd->t_data_sg; |
@@ -2605,7 +2588,7 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | |||
2605 | target_wait_free_cmd(cmd, &aborted, &tas); | 2588 | target_wait_free_cmd(cmd, &aborted, &tas); |
2606 | 2589 | ||
2607 | if (!aborted || tas) | 2590 | if (!aborted || tas) |
2608 | ret = transport_put_cmd(cmd); | 2591 | ret = target_put_sess_cmd(cmd); |
2609 | } else { | 2592 | } else { |
2610 | if (wait_for_tasks) | 2593 | if (wait_for_tasks) |
2611 | target_wait_free_cmd(cmd, &aborted, &tas); | 2594 | target_wait_free_cmd(cmd, &aborted, &tas); |
@@ -2621,7 +2604,7 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | |||
2621 | transport_lun_remove_cmd(cmd); | 2604 | transport_lun_remove_cmd(cmd); |
2622 | 2605 | ||
2623 | if (!aborted || tas) | 2606 | if (!aborted || tas) |
2624 | ret = transport_put_cmd(cmd); | 2607 | ret = target_put_sess_cmd(cmd); |
2625 | } | 2608 | } |
2626 | /* | 2609 | /* |
2627 | * If the task has been internally aborted due to TMR ABORT_TASK | 2610 | * If the task has been internally aborted due to TMR ABORT_TASK |