]> err.no Git - linux-2.6/commitdiff
block: convert pd_special_command to use blk_execute_rq
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 15 Jul 2008 19:21:45 +0000 (21:21 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 15 Jul 2008 19:21:45 +0000 (21:21 +0200)
pd_special_command uses blk_put_request with struct request on the
stack. As a result, blk_put_request needs a hack to catch a NULL
request_queue.  This converts pd_special_command to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/block/paride/pd.c

index 570f3b70dce795afc8e1beabd104de3dc31e26ad..5fdfa7c888cebc98aacc9873a9f7216f79c3a1f5 100644 (file)
@@ -712,19 +712,17 @@ static void do_pd_request(struct request_queue * q)
 static int pd_special_command(struct pd_unit *disk,
                      enum action (*func)(struct pd_unit *disk))
 {
-       DECLARE_COMPLETION_ONSTACK(wait);
-       struct request rq;
+       struct request *rq;
        int err = 0;
 
-       blk_rq_init(NULL, &rq);
-       rq.rq_disk = disk->gd;
-       rq.end_io_data = &wait;
-       rq.end_io = blk_end_sync_rq;
-       blk_insert_request(disk->gd->queue, &rq, 0, func);
-       wait_for_completion(&wait);
-       if (rq.errors)
-               err = -EIO;
-       blk_put_request(&rq);
+       rq = blk_get_request(disk->gd->queue, READ, __GFP_WAIT);
+
+       rq->cmd_type = REQ_TYPE_SPECIAL;
+       rq->special = func;
+
+       err = blk_execute_rq(disk->gd->queue, disk->gd, rq, 0);
+
+       blk_put_request(rq);
        return err;
 }