Commit 1fafca14 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[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.
parent 2181c194
...@@ -48,6 +48,7 @@ const unsigned char scsi_command_size[8] = ...@@ -48,6 +48,7 @@ const unsigned char scsi_command_size[8] =
static int blk_do_rq(request_queue_t *q, struct block_device *bdev, static int blk_do_rq(request_queue_t *q, struct block_device *bdev,
struct request *rq) struct request *rq)
{ {
char sense[SCSI_SENSE_BUFFERSIZE];
DECLARE_COMPLETION(wait); DECLARE_COMPLETION(wait);
int err = 0; int err = 0;
...@@ -59,6 +60,12 @@ static int blk_do_rq(request_queue_t *q, struct block_device *bdev, ...@@ -59,6 +60,12 @@ static int blk_do_rq(request_queue_t *q, struct block_device *bdev,
*/ */
rq->ref_count++; rq->ref_count++;
if (!rq->sense) {
memset(sense, 0, sizeof(sense));
rq->sense = sense;
rq->sense_len = 0;
}
rq->flags |= REQ_NOMERGE; rq->flags |= REQ_NOMERGE;
rq->waiting = &wait; rq->waiting = &wait;
drive_stat_acct(rq, rq->nr_sectors, 1); drive_stat_acct(rq, rq->nr_sectors, 1);
......
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