2 Subject: add support for new operation type BLKIF_OP_PACKET
3 Patch-mainline: obsolete
4 References: fate#300964
6 Index: head-2008-11-10/drivers/xen/blkback/blkback.c
7 ===================================================================
8 --- head-2008-11-10.orig/drivers/xen/blkback/blkback.c 2008-11-10 12:07:53.000000000 +0100
9 +++ head-2008-11-10/drivers/xen/blkback/blkback.c 2008-11-10 12:15:51.000000000 +0100
10 @@ -192,13 +192,15 @@ static void fast_flush_area(pending_req_
12 static void print_stats(blkif_t *blkif)
14 - printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | br %4d\n",
15 + printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | br %4d | pk %4d\n",
16 current->comm, blkif->st_oo_req,
17 - blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req);
18 + blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req,
20 blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000);
24 + blkif->st_pk_req = 0;
27 int blkif_schedule(void *arg)
28 @@ -358,6 +360,13 @@ static int do_block_io_op(blkif_t *blkif
30 dispatch_rw_block_io(blkif, &req, pending_req);
32 + case BLKIF_OP_PACKET:
33 + DPRINTK("error: block operation BLKIF_OP_PACKET not implemented\n");
35 + make_response(blkif, req.id, req.operation,
37 + free_req(pending_req);
40 /* A good sign something is wrong: sleep for a while to
41 * avoid excessive CPU consumption by a bad guest. */
42 Index: head-2008-11-10/drivers/xen/blkback/common.h
43 ===================================================================
44 --- head-2008-11-10.orig/drivers/xen/blkback/common.h 2008-11-10 12:14:31.000000000 +0100
45 +++ head-2008-11-10/drivers/xen/blkback/common.h 2008-11-10 12:15:51.000000000 +0100
46 @@ -87,6 +87,7 @@ typedef struct blkif_st {
54 Index: head-2008-11-10/drivers/xen/blkfront/blkfront.c
55 ===================================================================
56 --- head-2008-11-10.orig/drivers/xen/blkfront/blkfront.c 2008-11-10 12:10:12.000000000 +0100
57 +++ head-2008-11-10/drivers/xen/blkfront/blkfront.c 2008-11-10 12:15:51.000000000 +0100
58 @@ -622,6 +622,8 @@ static int blkif_queue_request(struct re
59 BLKIF_OP_WRITE : BLKIF_OP_READ;
60 if (blk_barrier_rq(req))
61 ring_req->operation = BLKIF_OP_WRITE_BARRIER;
62 + if (blk_pc_request(req))
63 + ring_req->operation = BLKIF_OP_PACKET;
65 ring_req->nr_segments = 0;
66 rq_for_each_segment(bvec, req, iter) {
67 @@ -678,7 +680,7 @@ void do_blkif_request(struct request_que
69 while ((req = elv_next_request(rq)) != NULL) {
70 info = req->rq_disk->private_data;
71 - if (!blk_fs_request(req)) {
72 + if (!blk_fs_request(req) && !blk_pc_request(req)) {
76 @@ -755,6 +757,7 @@ static irqreturn_t blkif_int(int irq, vo
80 + case BLKIF_OP_PACKET:
81 if (unlikely(bret->status != BLKIF_RSP_OKAY))
82 DPRINTK("Bad return from blkdev data "
83 "request: %x\n", bret->status);
84 Index: head-2008-11-10/drivers/xen/blktap/blktap.c
85 ===================================================================
86 --- head-2008-11-10.orig/drivers/xen/blktap/blktap.c 2008-11-10 12:14:32.000000000 +0100
87 +++ head-2008-11-10/drivers/xen/blktap/blktap.c 2008-11-10 12:15:51.000000000 +0100
88 @@ -1090,13 +1090,14 @@ static void fast_flush_area(pending_req_
90 static void print_stats(blkif_t *blkif)
92 - printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d\n",
93 + printk(KERN_DEBUG "%s: oo %3d | rd %4d | wr %4d | pk %4d\n",
94 current->comm, blkif->st_oo_req,
95 - blkif->st_rd_req, blkif->st_wr_req);
96 + blkif->st_rd_req, blkif->st_wr_req, blkif->st_pk_req);
97 blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000);
100 blkif->st_oo_req = 0;
101 + blkif->st_pk_req = 0;
104 int tap_blkif_schedule(void *arg)
105 @@ -1332,6 +1333,11 @@ static int do_block_io_op(blkif_t *blkif
106 dispatch_rw_block_io(blkif, &req, pending_req);
109 + case BLKIF_OP_PACKET:
110 + blkif->st_pk_req++;
111 + dispatch_rw_block_io(blkif, &req, pending_req);
115 /* A good sign something is wrong: sleep for a while to
116 * avoid excessive CPU consumption by a bad guest. */
117 @@ -1370,6 +1376,8 @@ static void dispatch_rw_block_io(blkif_t
118 struct mm_struct *mm;
120 switch (req->operation) {
121 + case BLKIF_OP_PACKET:
126 Index: head-2008-11-10/drivers/xen/blktap/common.h
127 ===================================================================
128 --- head-2008-11-10.orig/drivers/xen/blktap/common.h 2008-11-10 12:06:12.000000000 +0100
129 +++ head-2008-11-10/drivers/xen/blktap/common.h 2008-11-10 12:15:51.000000000 +0100
130 @@ -75,6 +75,7 @@ typedef struct blkif_st {
138 Index: head-2008-11-10/include/xen/interface/io/blkif.h
139 ===================================================================
140 --- head-2008-11-10.orig/include/xen/interface/io/blkif.h 2008-11-10 11:49:25.000000000 +0100
141 +++ head-2008-11-10/include/xen/interface/io/blkif.h 2008-11-10 12:15:51.000000000 +0100
143 * "feature-flush-cache" node!
145 #define BLKIF_OP_FLUSH_DISKCACHE 3
147 + * Device specific command packet contained within the request
149 +#define BLKIF_OP_PACKET 4
152 * Maximum scatter/gather segments per request.