Commit d79c5a67 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Bartlomiej Zolnierkiewicz

block: convert pd_special_command to use blk_execute_rq

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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent ed820f19
...@@ -712,19 +712,17 @@ static void do_pd_request(struct request_queue * q) ...@@ -712,19 +712,17 @@ static void do_pd_request(struct request_queue * q)
static int pd_special_command(struct pd_unit *disk, static int pd_special_command(struct pd_unit *disk,
enum action (*func)(struct pd_unit *disk)) enum action (*func)(struct pd_unit *disk))
{ {
DECLARE_COMPLETION_ONSTACK(wait); struct request *rq;
struct request rq;
int err = 0; int err = 0;
blk_rq_init(NULL, &rq); rq = blk_get_request(disk->gd->queue, READ, __GFP_WAIT);
rq.rq_disk = disk->gd;
rq.end_io_data = &wait; rq->cmd_type = REQ_TYPE_SPECIAL;
rq.end_io = blk_end_sync_rq; rq->special = func;
blk_insert_request(disk->gd->queue, &rq, 0, func);
wait_for_completion(&wait); err = blk_execute_rq(disk->gd->queue, disk->gd, rq, 0);
if (rq.errors)
err = -EIO; blk_put_request(rq);
blk_put_request(&rq);
return err; return err;
} }
......
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