From: plc@novell.com Subject: add support for new operation type BLKIF_OP_PACKET Patch-mainline: obsolete References: fate#300964 Index: head-2008-11-10/drivers/xen/blkback/blkback.c =================================================================== --- head-2008-11-10.orig/drivers/xen/blkback/blkback.c 2008-11-10 12:07:53.000000000 +0100 +++ head-2008-11-10/drivers/xen/blkback/blkback.c 2008-11-10 12:15:51.000000000 +0100 @@ -192,13 +192,15 @@ static void fast_flush_area(pending_req_ static void print_stats(blkif_t *blkif) { - printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | br %4d\n", + printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | br %4d | pk %4d\n", current->comm, blkif->st_oo_req, - blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req); + blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req, + blkif->st_pk_req); blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000); blkif->st_rd_req = 0; blkif->st_wr_req = 0; blkif->st_oo_req = 0; + blkif->st_pk_req = 0; } int blkif_schedule(void *arg) @@ -358,6 +360,13 @@ static int do_block_io_op(blkif_t *blkif blkif->st_wr_req++; dispatch_rw_block_io(blkif, &req, pending_req); break; + case BLKIF_OP_PACKET: + DPRINTK("error: block operation BLKIF_OP_PACKET not implemented\n"); + blkif->st_pk_req++; + make_response(blkif, req.id, req.operation, + BLKIF_RSP_ERROR); + free_req(pending_req); + break; default: /* A good sign something is wrong: sleep for a while to * avoid excessive CPU consumption by a bad guest. */ Index: head-2008-11-10/drivers/xen/blkback/common.h =================================================================== --- head-2008-11-10.orig/drivers/xen/blkback/common.h 2008-11-10 12:14:31.000000000 +0100 +++ head-2008-11-10/drivers/xen/blkback/common.h 2008-11-10 12:15:51.000000000 +0100 @@ -87,6 +87,7 @@ typedef struct blkif_st { int st_wr_req; int st_oo_req; int st_br_req; + int st_pk_req; int st_rd_sect; int st_wr_sect; Index: head-2008-11-10/drivers/xen/blkfront/blkfront.c =================================================================== --- head-2008-11-10.orig/drivers/xen/blkfront/blkfront.c 2008-11-10 12:10:12.000000000 +0100 +++ head-2008-11-10/drivers/xen/blkfront/blkfront.c 2008-11-10 12:15:51.000000000 +0100 @@ -622,6 +622,8 @@ static int blkif_queue_request(struct re BLKIF_OP_WRITE : BLKIF_OP_READ; if (blk_barrier_rq(req)) ring_req->operation = BLKIF_OP_WRITE_BARRIER; + if (blk_pc_request(req)) + ring_req->operation = BLKIF_OP_PACKET; ring_req->nr_segments = 0; rq_for_each_segment(bvec, req, iter) { @@ -678,7 +680,7 @@ void do_blkif_request(struct request_que while ((req = elv_next_request(rq)) != NULL) { info = req->rq_disk->private_data; - if (!blk_fs_request(req)) { + if (!blk_fs_request(req) && !blk_pc_request(req)) { end_request(req, 0); continue; } @@ -755,6 +757,7 @@ static irqreturn_t blkif_int(int irq, vo /* fall through */ case BLKIF_OP_READ: case BLKIF_OP_WRITE: + case BLKIF_OP_PACKET: if (unlikely(bret->status != BLKIF_RSP_OKAY)) DPRINTK("Bad return from blkdev data " "request: %x\n", bret->status); Index: head-2008-11-10/drivers/xen/blktap/blktap.c =================================================================== --- head-2008-11-10.orig/drivers/xen/blktap/blktap.c 2008-11-10 12:14:32.000000000 +0100 +++ head-2008-11-10/drivers/xen/blktap/blktap.c 2008-11-10 12:15:51.000000000 +0100 @@ -1090,13 +1090,14 @@ static void fast_flush_area(pending_req_ static void print_stats(blkif_t *blkif) { - printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d\n", + printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | pk %4d\n", current->comm, blkif->st_oo_req, - blkif->st_rd_req, blkif->st_wr_req); + blkif->st_rd_req, blkif->st_wr_req, blkif->st_pk_req); blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000); blkif->st_rd_req = 0; blkif->st_wr_req = 0; blkif->st_oo_req = 0; + blkif->st_pk_req = 0; } int tap_blkif_schedule(void *arg) @@ -1332,6 +1333,11 @@ static int do_block_io_op(blkif_t *blkif dispatch_rw_block_io(blkif, &req, pending_req); break; + case BLKIF_OP_PACKET: + blkif->st_pk_req++; + dispatch_rw_block_io(blkif, &req, pending_req); + break; + default: /* A good sign something is wrong: sleep for a while to * avoid excessive CPU consumption by a bad guest. */ @@ -1370,6 +1376,8 @@ static void dispatch_rw_block_io(blkif_t struct mm_struct *mm; switch (req->operation) { + case BLKIF_OP_PACKET: + /* Fall through */ case BLKIF_OP_READ: operation = READ; break; Index: head-2008-11-10/drivers/xen/blktap/common.h =================================================================== --- head-2008-11-10.orig/drivers/xen/blktap/common.h 2008-11-10 12:06:12.000000000 +0100 +++ head-2008-11-10/drivers/xen/blktap/common.h 2008-11-10 12:15:51.000000000 +0100 @@ -75,6 +75,7 @@ typedef struct blkif_st { int st_rd_req; int st_wr_req; int st_oo_req; + int st_pk_req; int st_rd_sect; int st_wr_sect; Index: head-2008-11-10/include/xen/interface/io/blkif.h =================================================================== --- head-2008-11-10.orig/include/xen/interface/io/blkif.h 2008-11-10 11:49:25.000000000 +0100 +++ head-2008-11-10/include/xen/interface/io/blkif.h 2008-11-10 12:15:51.000000000 +0100 @@ -76,6 +76,10 @@ * "feature-flush-cache" node! */ #define BLKIF_OP_FLUSH_DISKCACHE 3 +/* + * Device specific command packet contained within the request + */ +#define BLKIF_OP_PACKET 4 /* * Maximum scatter/gather segments per request.