aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@SteelEye.com>2005-06-20 08:11:09 -0400
committerJens Axboe <axboe@suse.de>2005-06-20 08:11:09 -0400
commit994ca9a19616f0d4161a9e825f0835925d522426 (patch)
tree0998252ed375929dca468440b7486d4c1104757f
parentf63eb21b4f32028755b6b9d47e5eb13c18ba0cae (diff)
[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: Jens Axboe <axboe@suse.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/block/ll_rw_blk.c7
-rw-r--r--drivers/block/scsi_ioctl.c6
-rw-r--r--drivers/cdrom/cdrom.c2
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--include/linux/blkdev.h4
5 files changed, 11 insertions, 10 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 874e46fc3748..d260a2ce9a70 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2269,13 +2269,14 @@ void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk,
2269 * @q: queue to insert the request in 2269 * @q: queue to insert the request in
2270 * @bd_disk: matching gendisk 2270 * @bd_disk: matching gendisk
2271 * @rq: request to insert 2271 * @rq: request to insert
2272 * @at_head: insert request at head or tail of queue
2272 * 2273 *
2273 * Description: 2274 * Description:
2274 * Insert a fully prepared request at the back of the io scheduler queue 2275 * Insert a fully prepared request at the back of the io scheduler queue
2275 * for execution. 2276 * for execution.
2276 */ 2277 */
2277int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, 2278int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
2278 struct request *rq) 2279 struct request *rq, int at_head)
2279{ 2280{
2280 DECLARE_COMPLETION(wait); 2281 DECLARE_COMPLETION(wait);
2281 char sense[SCSI_SENSE_BUFFERSIZE]; 2282 char sense[SCSI_SENSE_BUFFERSIZE];
@@ -2294,7 +2295,7 @@ int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk,
2294 } 2295 }
2295 2296
2296 rq->waiting = &wait; 2297 rq->waiting = &wait;
2297 blk_execute_rq_nowait(q, bd_disk, rq, 0, blk_end_sync_rq); 2298 blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
2298 wait_for_completion(&wait); 2299 wait_for_completion(&wait);
2299 rq->waiting = NULL; 2300 rq->waiting = NULL;
2300 2301
@@ -2361,7 +2362,7 @@ int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk,
2361 rq->data_len = 0; 2362 rq->data_len = 0;
2362 rq->timeout = 60 * HZ; 2363 rq->timeout = 60 * HZ;
2363 2364
2364 ret = blk_execute_rq(q, disk, rq); 2365 ret = blk_execute_rq(q, disk, rq, 0);
2365 2366
2366 if (ret && error_sector) 2367 if (ret && error_sector)
2367 *error_sector = rq->sector; 2368 *error_sector = rq->sector;
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
index 7717b76f7f20..abb2df249fd3 100644
--- a/drivers/block/scsi_ioctl.c
+++ b/drivers/block/scsi_ioctl.c
@@ -308,7 +308,7 @@ static int sg_io(struct file *file, request_queue_t *q,
308 * (if he doesn't check that is his problem). 308 * (if he doesn't check that is his problem).
309 * N.B. a non-zero SCSI status is _not_ necessarily an error. 309 * N.B. a non-zero SCSI status is _not_ necessarily an error.
310 */ 310 */
311 blk_execute_rq(q, bd_disk, rq); 311 blk_execute_rq(q, bd_disk, rq, 0);
312 312
313 /* write to all output members */ 313 /* write to all output members */
314 hdr->status = 0xff & rq->errors; 314 hdr->status = 0xff & rq->errors;
@@ -420,7 +420,7 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
420 rq->data_len = bytes; 420 rq->data_len = bytes;
421 rq->flags |= REQ_BLOCK_PC; 421 rq->flags |= REQ_BLOCK_PC;
422 422
423 blk_execute_rq(q, bd_disk, rq); 423 blk_execute_rq(q, bd_disk, rq, 0);
424 err = rq->errors & 0xff; /* only 8 bit SCSI status */ 424 err = rq->errors & 0xff; /* only 8 bit SCSI status */
425 if (err) { 425 if (err) {
426 if (rq->sense_len && rq->sense) { 426 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 rq->cmd[0] = GPCMD_START_STOP_UNIT; 573 rq->cmd[0] = GPCMD_START_STOP_UNIT;
574 rq->cmd[4] = 0x02 + (close != 0); 574 rq->cmd[4] = 0x02 + (close != 0);
575 rq->cmd_len = 6; 575 rq->cmd_len = 6;
576 err = blk_execute_rq(q, bd_disk, rq); 576 err = blk_execute_rq(q, bd_disk, rq, 0);
577 blk_put_request(rq); 577 blk_put_request(rq);
578 break; 578 break;
579 default: 579 default:
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 6a7d926774a1..153960348414 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2136,7 +2136,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
2136 if (rq->bio) 2136 if (rq->bio)
2137 blk_queue_bounce(q, &rq->bio); 2137 blk_queue_bounce(q, &rq->bio);
2138 2138
2139 if (blk_execute_rq(q, cdi->disk, rq)) { 2139 if (blk_execute_rq(q, cdi->disk, rq, 0)) {
2140 struct request_sense *s = rq->sense; 2140 struct request_sense *s = rq->sense;
2141 ret = -EIO; 2141 ret = -EIO;
2142 cdi->last_sense = s->sense_key; 2142 cdi->last_sense = s->sense_key;
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 3302cd8eab4c..9176da7a9858 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -750,7 +750,7 @@ static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk,
750 750
751 idedisk_prepare_flush(q, rq); 751 idedisk_prepare_flush(q, rq);
752 752
753 ret = blk_execute_rq(q, disk, rq); 753 ret = blk_execute_rq(q, disk, rq, 0);
754 754
755 /* 755 /*
756 * if we failed and caller wants error offset, get it 756 * if we failed and caller wants error offset, get it
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0430ea3e5f2e..a48dc12c6699 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -562,8 +562,8 @@ extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, u
562extern int blk_rq_unmap_user(struct bio *, unsigned int); 562extern int blk_rq_unmap_user(struct bio *, unsigned int);
563extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int); 563extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int);
564extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 564extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
565extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); 565extern int blk_execute_rq(request_queue_t *, struct gendisk *,
566 566 struct request *, int);
567static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 567static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
568{ 568{
569 return bdev->bd_disk->queue; 569 return bdev->bd_disk->queue;