Subject: scsi: introduce REQ_SCSI_ERROR flag When evaluating req->errors we have to know which subsystem generated them in order to process them correctly. This patch introduces a REQ_SCSI_ERROR flag to indicate that the errors field in the request contains a SCSI result. Signed-off-by: Mike Snitzer Cc: Hannes Reinecke -- drivers/scsi/scsi_lib.c | 2 ++ include/linux/blk_types.h | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) NOTE: Hannes ultimately proposed this new flag, he should be author, but I stopped short of adding him as the author given I had to move code around in the rebase. We can sort that out if/when this overall approach is deemed worthy. diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9ade720..9488546 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -724,6 +724,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */ req->errors = result; + req->cmd_flags |= REQ_SCSI_ERROR; + if (result) { if (sense_valid && req->sense) { /* diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index ca83a97..ad22488 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -151,6 +151,7 @@ enum rq_flag_bits { __REQ_IO_STAT, /* account I/O stat */ __REQ_MIXED_MERGE, /* merge of different types, fail separately */ __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ + __REQ_SCSI_ERROR, /* errors are SCSI result codes */ __REQ_NR_BITS, /* stops here */ }; @@ -192,5 +193,6 @@ enum rq_flag_bits { #define REQ_IO_STAT (1 << __REQ_IO_STAT) #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) #define REQ_SECURE (1 << __REQ_SECURE) +#define REQ_SCSI_ERROR (1 << __REQ_SCSI_ERROR) #endif /* __LINUX_BLK_TYPES_H */