diff options
| -rw-r--r-- | block/scsi_ioctl.c | 5 | ||||
| -rw-r--r-- | include/scsi/sg.h | 3 | ||||
| -rw-r--r-- | include/uapi/linux/bsg.h | 11 |
3 files changed, 13 insertions, 6 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index bda1497add4c..51bf5155ee75 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
| @@ -290,6 +290,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
| 290 | unsigned long start_time; | 290 | unsigned long start_time; |
| 291 | ssize_t ret = 0; | 291 | ssize_t ret = 0; |
| 292 | int writing = 0; | 292 | int writing = 0; |
| 293 | int at_head = 0; | ||
| 293 | struct request *rq; | 294 | struct request *rq; |
| 294 | char sense[SCSI_SENSE_BUFFERSIZE]; | 295 | char sense[SCSI_SENSE_BUFFERSIZE]; |
| 295 | struct bio *bio; | 296 | struct bio *bio; |
| @@ -313,6 +314,8 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
| 313 | case SG_DXFER_FROM_DEV: | 314 | case SG_DXFER_FROM_DEV: |
| 314 | break; | 315 | break; |
| 315 | } | 316 | } |
| 317 | if (hdr->flags & SG_FLAG_Q_AT_HEAD) | ||
| 318 | at_head = 1; | ||
| 316 | 319 | ||
| 317 | rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); | 320 | rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); |
| 318 | if (!rq) | 321 | if (!rq) |
| @@ -369,7 +372,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
| 369 | * (if he doesn't check that is his problem). | 372 | * (if he doesn't check that is his problem). |
| 370 | * N.B. a non-zero SCSI status is _not_ necessarily an error. | 373 | * N.B. a non-zero SCSI status is _not_ necessarily an error. |
| 371 | */ | 374 | */ |
| 372 | blk_execute_rq(q, bd_disk, rq, 0); | 375 | blk_execute_rq(q, bd_disk, rq, at_head); |
| 373 | 376 | ||
| 374 | hdr->duration = jiffies_to_msecs(jiffies - start_time); | 377 | hdr->duration = jiffies_to_msecs(jiffies - start_time); |
| 375 | 378 | ||
diff --git a/include/scsi/sg.h b/include/scsi/sg.h index a9f3c6fc3f57..4734c15ab5d6 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h | |||
| @@ -129,6 +129,9 @@ typedef struct sg_io_hdr | |||
| 129 | #define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */ | 129 | #define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */ |
| 130 | #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ | 130 | #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ |
| 131 | /* user space (debug indirect IO) */ | 131 | /* user space (debug indirect IO) */ |
| 132 | /* defaults:: for sg driver: Q_AT_HEAD; for block layer: Q_AT_TAIL */ | ||
| 133 | #define SG_FLAG_Q_AT_TAIL 0x10 | ||
| 134 | #define SG_FLAG_Q_AT_HEAD 0x20 | ||
| 132 | 135 | ||
| 133 | /* following 'info' values are "or"-ed together */ | 136 | /* following 'info' values are "or"-ed together */ |
| 134 | #define SG_INFO_OK_MASK 0x1 | 137 | #define SG_INFO_OK_MASK 0x1 |
diff --git a/include/uapi/linux/bsg.h b/include/uapi/linux/bsg.h index 7a12e1c0f371..02986cf8b6f1 100644 --- a/include/uapi/linux/bsg.h +++ b/include/uapi/linux/bsg.h | |||
| @@ -10,12 +10,13 @@ | |||
| 10 | #define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 | 10 | #define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 |
| 11 | 11 | ||
| 12 | /* | 12 | /* |
| 13 | * For flags member below | 13 | * For flag constants below: |
| 14 | * sg.h sg_io_hdr also has bits defined for it's flags member. However | 14 | * sg.h sg_io_hdr also has bits defined for it's flags member. These |
| 15 | * none of these bits are implemented/used by bsg. The bits below are | 15 | * two flag values (0x10 and 0x20) have the same meaning in sg.h . For |
| 16 | * allocated to not conflict with sg.h ones anyway. | 16 | * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult. |
| 17 | */ | 17 | */ |
| 18 | #define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */ | 18 | #define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ |
| 19 | #define BSG_FLAG_Q_AT_HEAD 0x20 | ||
| 19 | 20 | ||
| 20 | struct sg_io_v4 { | 21 | struct sg_io_v4 { |
| 21 | __s32 guard; /* [i] 'Q' to differentiate from v3 */ | 22 | __s32 guard; /* [i] 'Q' to differentiate from v3 */ |
