[PATCH 10/11] block: convert pd to use blk_get_request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pd.c 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.c to use blk_get_request.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
---
 drivers/block/paride/pd.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index df819f8..e52babb 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -713,20 +713,19 @@ 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;
 
-	memset(&rq, 0, sizeof(rq));
-	rq.errors = 0;
-	rq.rq_disk = disk->gd;
-	rq.ref_count = 1;
-	rq.end_io_data = &wait;
-	rq.end_io = blk_end_sync_rq;
-	blk_insert_request(disk->gd->queue, &rq, 0, func);
+	rq = blk_get_request(disk->gd->queue, READ, __GFP_WAIT);
+	rq->ref_count++;
+	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)
+	if (rq->errors)
 		err = -EIO;
-	blk_put_request(&rq);
+	blk_put_request(rq);
 	return err;
 }
 
-- 
1.5.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux