Commit 994ca9a1 authored by James Bottomley's avatar James Bottomley Committed by Jens Axboe

[PATCH] update blk_execute_rq to take an at_head parameter

Original From: Mike Christie <michaelc@cs.wisc.edu>

Modified to split out block changes (this patch) and SCSI pieces.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f63eb21b
...@@ -2269,13 +2269,14 @@ void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk, ...@@ -2269,13 +2269,14 @@ void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk,
* @q: queue to insert the request in * @q: queue to insert the request in
* @bd_disk: matching gendisk * @bd_disk: matching gendisk
* @rq: request to insert * @rq: request to insert
* @at_head: insert request at head or tail of queue
* *
* Description: * Description:
* Insert a fully prepared request at the back of the io scheduler queue * Insert a fully prepared request at the back of the io scheduler queue
* for execution. * for execution.
*/ */
int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
struct request *rq) struct request *rq, int at_head)
{ {
DECLARE_COMPLETION(wait); DECLARE_COMPLETION(wait);
char sense[SCSI_SENSE_BUFFERSIZE]; char sense[SCSI_SENSE_BUFFERSIZE];
...@@ -2294,7 +2295,7 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, ...@@ -2294,7 +2295,7 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
} }
rq->waiting = &wait; rq->waiting = &wait;
blk_execute_rq_nowait(q, bd_disk, rq, 0, blk_end_sync_rq); blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
wait_for_completion(&wait); wait_for_completion(&wait);
rq->waiting = NULL; rq->waiting = NULL;
...@@ -2361,7 +2362,7 @@ int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, ...@@ -2361,7 +2362,7 @@ int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk,
rq->data_len = 0; rq->data_len = 0;
rq->timeout = 60 * HZ; rq->timeout = 60 * HZ;
ret = blk_execute_rq(q, disk, rq); ret = blk_execute_rq(q, disk, rq, 0);
if (ret && error_sector) if (ret && error_sector)
*error_sector = rq->sector; *error_sector = rq->sector;
......
...@@ -308,7 +308,7 @@ static int sg_io(struct file *file, request_queue_t *q, ...@@ -308,7 +308,7 @@ static int sg_io(struct file *file, request_queue_t *q,
* (if he doesn't check that is his problem). * (if he doesn't check that is his problem).
* N.B. a non-zero SCSI status is _not_ necessarily an error. * N.B. a non-zero SCSI status is _not_ necessarily an error.
*/ */
blk_execute_rq(q, bd_disk, rq); blk_execute_rq(q, bd_disk, rq, 0);
/* write to all output members */ /* write to all output members */
hdr->status = 0xff & rq->errors; hdr->status = 0xff & rq->errors;
...@@ -420,7 +420,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q, ...@@ -420,7 +420,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
rq->data_len = bytes; rq->data_len = bytes;
rq->flags |= REQ_BLOCK_PC; rq->flags |= REQ_BLOCK_PC;
blk_execute_rq(q, bd_disk, rq); blk_execute_rq(q, bd_disk, rq, 0);
err = rq->errors & 0xff; /* only 8 bit SCSI status */ err = rq->errors & 0xff; /* only 8 bit SCSI status */
if (err) { if (err) {
if (rq->sense_len && rq->sense) { if (rq->sense_len && rq->sense) {
...@@ -573,7 +573,7 @@ int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, ...@@ -573,7 +573,7 @@ int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd,
rq->cmd[0] = GPCMD_START_STOP_UNIT; rq->cmd[0] = GPCMD_START_STOP_UNIT;
rq->cmd[4] = 0x02 + (close != 0); rq->cmd[4] = 0x02 + (close != 0);
rq->cmd_len = 6; rq->cmd_len = 6;
err = blk_execute_rq(q, bd_disk, rq); err = blk_execute_rq(q, bd_disk, rq, 0);
blk_put_request(rq); blk_put_request(rq);
break; break;
default: default:
......
...@@ -2136,7 +2136,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, ...@@ -2136,7 +2136,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
if (rq->bio) if (rq->bio)
blk_queue_bounce(q, &rq->bio); blk_queue_bounce(q, &rq->bio);
if (blk_execute_rq(q, cdi->disk, rq)) { if (blk_execute_rq(q, cdi->disk, rq, 0)) {
struct request_sense *s = rq->sense; struct request_sense *s = rq->sense;
ret = -EIO; ret = -EIO;
cdi->last_sense = s->sense_key; cdi->last_sense = s->sense_key;
......
...@@ -750,7 +750,7 @@ static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk, ...@@ -750,7 +750,7 @@ static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk,
idedisk_prepare_flush(q, rq); idedisk_prepare_flush(q, rq);
ret = blk_execute_rq(q, disk, rq); ret = blk_execute_rq(q, disk, rq, 0);
/* /*
* if we failed and caller wants error offset, get it * if we failed and caller wants error offset, get it
......
...@@ -562,8 +562,8 @@ extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, u ...@@ -562,8 +562,8 @@ extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, u
extern int blk_rq_unmap_user(struct bio *, unsigned int); extern int blk_rq_unmap_user(struct bio *, unsigned int);
extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int); extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int);
extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); extern int blk_execute_rq(request_queue_t *, struct gendisk *,
struct request *, int);
static inline request_queue_t *bdev_get_queue(struct block_device *bdev) static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
{ {
return bdev->bd_disk->queue; return bdev->bd_disk->queue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment