2 Subject: blktap: Write Barriers
3 Patch-mainline: obsolete
5 --- sle11-2009-04-20.orig/drivers/xen/blktap/blktap.c 2009-04-20 11:40:25.000000000 +0200
6 +++ sle11-2009-04-20/drivers/xen/blktap/blktap.c 2009-04-20 11:41:45.000000000 +0200
7 @@ -1321,6 +1321,9 @@ static int do_block_io_op(blkif_t *blkif
8 dispatch_rw_block_io(blkif, &req, pending_req);
11 + case BLKIF_OP_WRITE_BARRIER:
12 + /* TODO Some counter? */
16 dispatch_rw_block_io(blkif, &req, pending_req);
17 @@ -1352,7 +1355,7 @@ static void dispatch_rw_block_io(blkif_t
18 pending_req_t *pending_req)
20 extern void ll_rw_block(int rw, int nr, struct buffer_head * bhs[]);
21 - int op, operation = (req->operation == BLKIF_OP_WRITE) ? WRITE : READ;
23 struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
25 int ret, i, nr_sects = 0;
26 @@ -1364,6 +1367,21 @@ static void dispatch_rw_block_io(blkif_t
27 uint16_t mmap_idx = pending_req->mem_idx;
30 + switch (req->operation) {
34 + case BLKIF_OP_WRITE:
37 + case BLKIF_OP_WRITE_BARRIER:
38 + operation = WRITE_BARRIER;
41 + operation = 0; /* make gcc happy */
45 if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV)
48 @@ -1402,7 +1420,7 @@ static void dispatch_rw_block_io(blkif_t
50 pending_req->blkif = blkif;
51 pending_req->id = req->id;
52 - pending_req->operation = operation;
53 + pending_req->operation = req->operation;
54 pending_req->status = BLKIF_RSP_OKAY;
55 pending_req->nr_pages = nseg;
57 @@ -1420,7 +1438,7 @@ static void dispatch_rw_block_io(blkif_t
58 kvaddr = idx_to_kaddr(mmap_idx, pending_idx, i);
60 flags = GNTMAP_host_map;
61 - if (operation == WRITE)
62 + if (operation != READ)
63 flags |= GNTMAP_readonly;
64 gnttab_set_map_op(&map[op], kvaddr, flags,
65 req->seg[i].gref, blkif->domid);
66 @@ -1437,7 +1455,7 @@ static void dispatch_rw_block_io(blkif_t
68 flags = GNTMAP_host_map | GNTMAP_application_map
69 | GNTMAP_contains_pte;
70 - if (operation == WRITE)
71 + if (operation != READ)
72 flags |= GNTMAP_readonly;
73 gnttab_set_map_op(&map[op], ptep, flags,
74 req->seg[i].gref, blkif->domid);
75 --- sle11-2009-04-20.orig/drivers/xen/blktap/xenbus.c 2008-09-15 15:10:39.000000000 +0200
76 +++ sle11-2009-04-20/drivers/xen/blktap/xenbus.c 2008-11-10 12:14:32.000000000 +0100
77 @@ -395,7 +395,28 @@ static void connect(struct backend_info
80 struct xenbus_device *dev = be->dev;
81 + struct xenbus_transaction xbt;
83 + /* Write feature-barrier to xenstore */
85 + err = xenbus_transaction_start(&xbt);
87 + xenbus_dev_fatal(dev, err, "starting transaction");
91 + err = xenbus_printf(xbt, dev->nodename, "feature-barrier", "1");
93 + xenbus_dev_fatal(dev, err, "writing feature-barrier");
94 + xenbus_transaction_end(xbt, 1);
98 + err = xenbus_transaction_end(xbt, 0);
103 err = xenbus_switch_state(dev, XenbusStateConnected);
105 xenbus_dev_fatal(dev, err, "switching to Connected state",