diff mbox series

[v3,01/17] scsi: iscsi: add task completion helper

Message ID 20210416020440.259271-2-michael.christie@oracle.com (mailing list archive)
State Changes Requested
Headers show
Series libicsi and qedi TMF fixes | expand

Commit Message

Mike Christie April 16, 2021, 2:04 a.m. UTC
This adds a helper to detect if a cmd has completed but not yet freed.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 include/scsi/libiscsi.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Lee Duncan April 16, 2021, 9:56 p.m. UTC | #1
On 4/15/21 7:04 PM, Mike Christie wrote:
> This adds a helper to detect if a cmd has completed but not yet freed.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>  include/scsi/libiscsi.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
> index 02f966e9358f..8c6d358a8abc 100644
> --- a/include/scsi/libiscsi.h
> +++ b/include/scsi/libiscsi.h
> @@ -145,6 +145,13 @@ static inline void* iscsi_next_hdr(struct iscsi_task *task)
>  	return (void*)task->hdr + task->hdr_len;
>  }
>  
> +static inline bool iscsi_task_is_completed(struct iscsi_task *task)
> +{
> +	return task->state == ISCSI_TASK_COMPLETED ||
> +	       task->state == ISCSI_TASK_ABRT_TMF ||
> +	       task->state == ISCSI_TASK_ABRT_SESS_RECOV;
> +}
> +
>  /* Connection's states */
>  enum {
>  	ISCSI_CONN_INITIAL_STAGE,
> 

Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 02f966e9358f..8c6d358a8abc 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -145,6 +145,13 @@  static inline void* iscsi_next_hdr(struct iscsi_task *task)
 	return (void*)task->hdr + task->hdr_len;
 }
 
+static inline bool iscsi_task_is_completed(struct iscsi_task *task)
+{
+	return task->state == ISCSI_TASK_COMPLETED ||
+	       task->state == ISCSI_TASK_ABRT_TMF ||
+	       task->state == ISCSI_TASK_ABRT_SESS_RECOV;
+}
+
 /* Connection's states */
 enum {
 	ISCSI_CONN_INITIAL_STAGE,