diff options
| author | Jens Axboe <axboe@suse.de> | 2003-05-16 21:23:02 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-16 21:23:02 -0700 |
| commit | 1fafca1437c88695903aa1b526879f205fa9959a (patch) | |
| tree | d3673a2573aa534d7739d6892eadbbbec85b4c22 | |
| parent | 2181c194865b9348fe27a54bd2a00a39fef91737 (diff) | |
[PATCH] Always allocate sense buffer for block commands
This always set ->sense for blk_pc_requests(), even if the actual user
doesn't care about the sense results. This is a lot nicer than then
having to have conditional checks for it all over the place in the low-
level drivers.
| -rw-r--r-- | drivers/block/scsi_ioctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index 6c995d61b51c..efcae208adb1 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c @@ -48,6 +48,7 @@ const unsigned char scsi_command_size[8] = static int blk_do_rq(request_queue_t *q, struct block_device *bdev, struct request *rq) { + char sense[SCSI_SENSE_BUFFERSIZE]; DECLARE_COMPLETION(wait); int err = 0; @@ -59,6 +60,12 @@ static int blk_do_rq(request_queue_t *q, struct block_device *bdev, */ rq->ref_count++; + if (!rq->sense) { + memset(sense, 0, sizeof(sense)); + rq->sense = sense; + rq->sense_len = 0; + } + rq->flags |= REQ_NOMERGE; rq->waiting = &wait; drive_stat_acct(rq, rq->nr_sectors, 1); |
