Allow FAILFAST flag to be set for SG_IO commands This patch allows the FAILFAST flag to be set for SG_IO commands. Signed-off-by: Hannes Reinecke diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index b33eda2..658b1b5 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -295,6 +295,8 @@ static int sg_io(struct file *file, requ rq->sense_len = 0; rq->flags |= REQ_BLOCK_PC; + if (hdr->flags & SG_FLAGS_FAILFAST) + rq->flags |= REQ_FAILFAST; bio = rq->bio; /* diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 0a487fe..9cc466a 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -142,6 +142,7 @@ typedef struct sg_io_hdr #define SG_FLAG_UNUSED_LUN_INHIBIT 2 /* default is overwrite lun in SCSI */ /* command block (when <= SCSI_2) */ #define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */ +#define SG_FLAG_FAILFAST 8 /* request should set FAILFAST flag */ #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ /* user space (debug indirect IO) */