From foo@baz Tue Jul 14 10:24:38 PDT 2009 Date: Tue, 14 Jul 2009 10:24:38 -0700 From: Greg Kroah-Hartman Subject: Staging: hv: make the Hyper-V virtual block driver build From: Greg Kroah-Hartman The #define KERNEL_2_6_27 needs to be set, and I adjusted the include directories a bit to get things to build properly. I also fixed up the direct access of bus_id, as that field is now gone. Lots of block api changes were needed, and I don't think I got it all correct. It would be great of someone who knows the block api better could review it. The hv_blkvsc code should now build, with no errors. Cc: Hank Janssen Cc: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/hv/BlkVsc.c | 2 +- drivers/staging/hv/blkvsc_drv.c | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c @@ -21,7 +21,7 @@ */ -#include "../storvsc/StorVsc.c" +#include "StorVsc.c" static const char* gBlkDriverName="blkvsc"; --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -20,6 +20,7 @@ * */ +#define KERNEL_2_6_27 #include #include @@ -34,10 +35,10 @@ #include #include -#include "logging.h" -#include "vmbus.h" +#include "include/logging.h" +#include "include/vmbus.h" -#include "StorVscApi.h" +#include "include/StorVscApi.h" // // #defines @@ -313,7 +314,7 @@ static int blkvsc_probe(struct device *d ASSERT(sizeof(struct blkvsc_request_group) <= sizeof(struct blkvsc_request)); #ifdef KERNEL_2_6_27 - blkdev->request_pool = kmem_cache_create(device_ctx->device.bus_id, + blkdev->request_pool = kmem_cache_create(dev_name(&device_ctx->device), sizeof(struct blkvsc_request) + storvsc_drv_obj->RequestExtSize, 0, SLAB_HWCACHE_ALIGN, NULL); #else @@ -426,7 +427,7 @@ static int blkvsc_probe(struct device *d } set_capacity(blkdev->gd, blkdev->capacity * (blkdev->sector_size/512)); - blk_queue_hardsect_size(blkdev->gd->queue, blkdev->sector_size); + blk_queue_logical_block_size(blkdev->gd->queue, blkdev->sector_size); // go! add_disk(blkdev->gd); @@ -982,7 +983,7 @@ static int blkvsc_do_request(struct bloc int pending=0; struct blkvsc_request_group *group=NULL; - DPRINT_DBG(BLKVSC_DRV, "blkdev %p req %p sect %llu \n", blkdev, req, req->sector); + DPRINT_DBG(BLKVSC_DRV, "blkdev %p req %p sect %llu \n", blkdev, req, blk_rq_pos(req)); // Create a group to tie req to list of blkvsc_reqs group = (struct blkvsc_request_group*)kmem_cache_alloc(blkdev->request_pool, GFP_ATOMIC); @@ -994,7 +995,7 @@ static int blkvsc_do_request(struct bloc INIT_LIST_HEAD(&group->blkvsc_req_list); group->outstanding = group->status = 0; - start_sector = req->sector; + start_sector = blk_rq_pos(req); // foreach bio in the request if (req->bio) @@ -1314,13 +1315,13 @@ static void blkvsc_request(struct reques int ret=0; DPRINT_DBG(BLKVSC_DRV, "- enter \n"); - while ((req = elv_next_request(queue)) != NULL) + while ((req = blk_peek_request(queue)) != NULL) { DPRINT_DBG(BLKVSC_DRV, "- req %p\n", req); blkdev = req->rq_disk->private_data; if (blkdev->shutting_down || !blk_fs_request(req) || blkdev->media_not_present) { - end_request(req, 0); + __blk_end_request_cur(req, 0); continue; } @@ -1333,7 +1334,7 @@ static void blkvsc_request(struct reques break; } - blkdev_dequeue_request(req); + blk_start_request(req); ret = blkvsc_do_request(blkdev, req); if (ret > 0) @@ -1410,7 +1411,7 @@ static int blkvsc_revalidate_disk(struct { blkvsc_do_read_capacity(blkdev); set_capacity(blkdev->gd, blkdev->capacity * (blkdev->sector_size/512)); - blk_queue_hardsect_size(gd->queue, blkdev->sector_size); + blk_queue_logical_block_size(gd->queue, blkdev->sector_size); } return 0; }