]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.xen/xen-blktap-write-barriers
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.xen / xen-blktap-write-barriers
CommitLineData
cc90b958
BS
1From: kwolf@suse.de
2Subject: blktap: Write Barriers
3Patch-mainline: obsolete
4
00e5a55c
BS
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
cc90b958
BS
8 dispatch_rw_block_io(blkif, &req, pending_req);
9 break;
10
11+ case BLKIF_OP_WRITE_BARRIER:
12+ /* TODO Some counter? */
13+ /* Fall through */
14 case BLKIF_OP_WRITE:
15 blkif->st_wr_req++;
16 dispatch_rw_block_io(blkif, &req, pending_req);
00e5a55c 17@@ -1352,7 +1355,7 @@ static void dispatch_rw_block_io(blkif_t
cc90b958
BS
18 pending_req_t *pending_req)
19 {
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;
22+ int op, operation;
23 struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
24 unsigned int nseg;
25 int ret, i, nr_sects = 0;
00e5a55c 26@@ -1364,6 +1367,21 @@ static void dispatch_rw_block_io(blkif_t
cc90b958
BS
27 uint16_t mmap_idx = pending_req->mem_idx;
28 struct mm_struct *mm;
29
30+ switch (req->operation) {
31+ case BLKIF_OP_READ:
32+ operation = READ;
33+ break;
34+ case BLKIF_OP_WRITE:
35+ operation = WRITE;
36+ break;
37+ case BLKIF_OP_WRITE_BARRIER:
38+ operation = WRITE_BARRIER;
39+ break;
40+ default:
41+ operation = 0; /* make gcc happy */
42+ BUG();
43+ }
44+
45 if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV)
46 goto fail_response;
47
00e5a55c 48@@ -1402,7 +1420,7 @@ static void dispatch_rw_block_io(blkif_t
cc90b958
BS
49
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;
56 op = 0;
00e5a55c 57@@ -1420,7 +1438,7 @@ static void dispatch_rw_block_io(blkif_t
cc90b958
BS
58 kvaddr = idx_to_kaddr(mmap_idx, pending_idx, i);
59
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);
00e5a55c 66@@ -1437,7 +1455,7 @@ static void dispatch_rw_block_io(blkif_t
cc90b958
BS
67
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);
00e5a55c
BS
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
cc90b958
BS
77@@ -395,7 +395,28 @@ static void connect(struct backend_info
78 int err;
79
80 struct xenbus_device *dev = be->dev;
81+ struct xenbus_transaction xbt;
82
83+ /* Write feature-barrier to xenstore */
84+again:
85+ err = xenbus_transaction_start(&xbt);
86+ if (err) {
87+ xenbus_dev_fatal(dev, err, "starting transaction");
88+ return;
89+ }
90+
91+ err = xenbus_printf(xbt, dev->nodename, "feature-barrier", "1");
92+ if (err) {
93+ xenbus_dev_fatal(dev, err, "writing feature-barrier");
94+ xenbus_transaction_end(xbt, 1);
95+ return;
96+ }
97+
98+ err = xenbus_transaction_end(xbt, 0);
99+ if (err == -EAGAIN)
100+ goto again;
101+
102+ /* Switch state */
103 err = xenbus_switch_state(dev, XenbusStateConnected);
104 if (err)
105 xenbus_dev_fatal(dev, err, "switching to Connected state",