From 0fce4c2f491cc1a579cac28b67208600cfff6d38 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 14 Jul 2009 10:24:38 -0700 Subject: [PATCH] Staging: hv: make the Hyper-V virtual block driver build 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(-) diff --git a/drivers/staging/hv/BlkVsc.c b/drivers/staging/hv/BlkVsc.c index 58b96981cba4..be53e65b19ee 100644 --- 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"; diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 2f6798152cfa..a4852f5a2a3a 100644 --- 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 *device) 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 *device) } 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 block_device_context *blkdev, struct request 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 block_device_context *blkdev, struct request 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 request_queue *queue) 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 request_queue *queue) 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 gendisk *gd) { 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; } -- 2.30.2