lguest: the block driver
Subsystems (2)
PATCH 8/9 lguest: the block driver
From: Rusty Russell <[email protected]>
Lguest block driver
A simple block driver for lguest.
---
drivers/block/Makefile | 1 drivers/block/lguest_blk.c | 271 +++++++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+)
drivers/block/Makefile renamed from drivers/block/Makefile~lguest-the-block-driver +1 -0
@@ -28,4 +28,5 @@ obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryp obj-$(CONFIG_VIODASD) += viodasd.o obj-$(CONFIG_BLK_DEV_SX8) += sx8.o obj-$(CONFIG_BLK_DEV_UB) += ub.o +obj-$(CONFIG_LGUEST_GUEST) += lguest_blk.o
drivers/block/lguest_blk.c new file +271 -0
271 lines not on this page · raw message
_
drivers/block/lguest_blk.c line 56
Quoted 9 lines · On 5/9/07, [email protected] <[email protected]> wrote:
drivers/block/lguest_blk.c new file +9
-0+/* Jens gave me this nice helper to end all chunks of a request. */ +static void end_entire_request (struct request *req,int uptodate) +{ +if (end_that_request_first (req, uptodate, req->hard_nr_sectors)) +BUG (); +add_disk_randomness (req->rq_disk); +blkdev_dequeue_request (req); +end_that_request_last (req, uptodate); +}
Again, I would prefer this went straight into block/ll_rw_blk.c. Rene and I am using something similar in the new Mitsumi driver although one of us has a bug already, we're using req->nr_sectors for this...
Quoted 14 lines · Pekka Enberg
drivers/block/lguest_blk.c line 56
Quoted 9 lines · On 5/9/07, [email protected] <[email protected]> wrote:
drivers/block/lguest_blk.c new file +9
-0+/* Jens gave me this nice helper to end all chunks of a request. */ +static void end_entire_request (struct request *req,int uptodate) +{ +if (end_that_request_first (req, uptodate, req->hard_nr_sectors)) +BUG (); +add_disk_randomness (req->rq_disk); +blkdev_dequeue_request (req); +end_that_request_last (req, uptodate); +}Again, I would prefer this went straight into
block/ll_rw_blk.c. Rene and I am using something similar in the new Mitsumi driver although one of us has a bug already, we're usingreq->nr_sectorsfor this...
Lets do it after it is merged, as not to create a hold-up point for lguest. Once it's in, I'll fix it up.
Signature · 1 line
Jens Axboe
Quoted 2 lines · Jens Axboe
Lets do it after it is merged, as not to create a hold-up point for lguest. Once it's in, I'll fix it up.
Ok. Seems pointless, though, as it's only a matter of:
Pekka
From: Jens Axboe <[email protected]>
Add a new end_entire_request() function that ends the whole request, not just the first segment.
--- block/ll_rw_blk.c | 11 +++++++++++ include/linux/blkdev.h | 1 + 2 files changed, 12 insertions(+)
block/ll_rw_blk.c +11 -0
@@ -3606,6 +3606,17 @@ void end_request(struct request *req, inEXPORT_SYMBOL (end_request); +void end_entire_request (struct request *req,int uptodate) +{ +if (end_that_request_first (req, uptodate, req->hard_nr_sectors)) +BUG (); +add_disk_randomness (req->rq_disk); +blkdev_dequeue_request (req); +end_that_request_last (req, uptodate); +} + +EXPORT_SYMBOL (end_entire_request); +void blk_rq_bio_prep (request_queue_t *q,struct request *rq,struct bio *bio) {/* first two bits are identical in rq->cmd_flags and bio->bi_rw */
include/linux/blkdev.h +1 -0
@@ -712,6 +712,7 @@ extern int end_that_request_first(structextern int end_that_request_chunk (struct request *,int ,int );extern void end_that_request_last (struct request *,int );extern void end_request (struct request *req,int uptodate); +extern void end_entire_request (struct request *req,int uptodate);extern void blk_complete_request (struct request *);/*
Quoted 5 lines · Pekka J Enberg
Quoted 2 lines · Jens Axboe
Lets do it after it is merged, as not to create a hold-up point for lguest. Once it's in, I'll fix it up.
Ok. Seems pointless, though, as it's only a matter of:
Yes I'm very well aware of that, my point is just that I'll do it once lguest is merged since then
a) it has a user, and
b) I don't want lguest to wait for me to get that update pulled
Can we please let this rest?
Signature · 1 line
Jens Axboe
Quoted 4 lines · Pekka Enberg
Quoted 4 lines
drivers/block/lguest_blk.c new file +4
-0+static void end_entire_request (struct request *req,int uptodate) +{ +if (end_that_request_first (req, uptodate, req->hard_nr_sectors)) +BUG ();
Quoted 8 lines
drivers/block/lguest_blk.c line 56
Quoted 4 lines
drivers/block/lguest_blk.c new file +4
-0+add_disk_randomness (req->rq_disk); +blkdev_dequeue_request (req); +end_that_request_last (req, uptodate); +}Again, I would prefer this went straight into
block/ll_rw_blk.c. Rene and I am using something similar in the new Mitsumi driver although one of us has a bug already, we're usingreq->nr_sectorsfor this...
The req->hard_nr_sectors is specifically marked block layer internal and since nr_sectors is what we're requesting and reading (we can't deal with partial transfers anyway since the drive won't tell us where it failed as far as I've been able to see and we do want to make read requests for as many sectors as possible at a time for speed) I believe that in our case the nr_sectors is fine.
Rene.
Quoted 15 lines · Rene Herman
Quoted 4 lines · Pekka Enberg
Quoted 4 lines
drivers/block/lguest_blk.c new file +4
-0+static void end_entire_request (struct request *req,int uptodate) +{ +if (end_that_request_first (req, uptodate, req->hard_nr_sectors)) +BUG ();Quoted 8 lines
drivers/block/lguest_blk.c line 56
Quoted 4 lines
drivers/block/lguest_blk.c new file +4
-0+add_disk_randomness (req->rq_disk); +blkdev_dequeue_request (req); +end_that_request_last (req, uptodate); +}Again, I would prefer this went straight into
block/ll_rw_blk.c. Rene and I am using something similar in the new Mitsumi driver although one of us has a bug already, we're usingreq->nr_sectorsfor this...
Quoted 6 lines
The
req->hard_nr_sectorsis specifically marked block layer internal and sincenr_sectorsis what we're requesting and reading (we can't deal with partial transfers anyway since the drive won't tell us where it failed as far as I've been able to see and we do want to make read requests for as many sectors as possible at a time for speed) I believe that in our case thenr_sectorsis fine.
Using ->nr_sectors is fine, IFF you don't modify ->nr_sectors in the driver. The generic helper will use ->hard_nr_sectors.
Signature · 1 line
Jens Axboe