diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-05-04 17:07:27 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-05-05 13:43:24 -0400 |
commit | 24f567f952aa308c3352f3340b9d296fc72bd066 (patch) | |
tree | 6cbc385ed612254b9eb0a77c0934804f85697e94 /drivers/block/xen-blkback/xenbus.c | |
parent | 73d842af27b863cbc816e75003edbc287bf57130 (diff) |
xen/blkback: Add support for BLKIF_OP_FLUSH_DISKCACHE and drop BLKIF_OP_WRITE_BARRIER.
We drop the support for 'feature-barrier' and add in the support
for the 'feature-flush-cache' if the real backend storage supports
flushing.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 64b0a1c760fb..9adcf806f83f 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -276,7 +276,7 @@ int __init xen_blkif_interface_init(void) | |||
276 | VBD_SHOW(oo_req, "%d\n", be->blkif->st_oo_req); | 276 | VBD_SHOW(oo_req, "%d\n", be->blkif->st_oo_req); |
277 | VBD_SHOW(rd_req, "%d\n", be->blkif->st_rd_req); | 277 | VBD_SHOW(rd_req, "%d\n", be->blkif->st_rd_req); |
278 | VBD_SHOW(wr_req, "%d\n", be->blkif->st_wr_req); | 278 | VBD_SHOW(wr_req, "%d\n", be->blkif->st_wr_req); |
279 | VBD_SHOW(br_req, "%d\n", be->blkif->st_br_req); | 279 | VBD_SHOW(f_req, "%d\n", be->blkif->st_f_req); |
280 | VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect); | 280 | VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect); |
281 | VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect); | 281 | VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect); |
282 | 282 | ||
@@ -284,7 +284,7 @@ static struct attribute *vbdstat_attrs[] = { | |||
284 | &dev_attr_oo_req.attr, | 284 | &dev_attr_oo_req.attr, |
285 | &dev_attr_rd_req.attr, | 285 | &dev_attr_rd_req.attr, |
286 | &dev_attr_wr_req.attr, | 286 | &dev_attr_wr_req.attr, |
287 | &dev_attr_br_req.attr, | 287 | &dev_attr_f_req.attr, |
288 | &dev_attr_rd_sect.attr, | 288 | &dev_attr_rd_sect.attr, |
289 | &dev_attr_wr_sect.attr, | 289 | &dev_attr_wr_sect.attr, |
290 | NULL | 290 | NULL |
@@ -343,6 +343,7 @@ static int vbd_create(struct blkif_st *blkif, blkif_vdev_t handle, | |||
343 | { | 343 | { |
344 | struct vbd *vbd; | 344 | struct vbd *vbd; |
345 | struct block_device *bdev; | 345 | struct block_device *bdev; |
346 | struct request_queue *q; | ||
346 | 347 | ||
347 | vbd = &blkif->vbd; | 348 | vbd = &blkif->vbd; |
348 | vbd->handle = handle; | 349 | vbd->handle = handle; |
@@ -375,6 +376,10 @@ static int vbd_create(struct blkif_st *blkif, blkif_vdev_t handle, | |||
375 | if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE) | 376 | if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE) |
376 | vbd->type |= VDISK_REMOVABLE; | 377 | vbd->type |= VDISK_REMOVABLE; |
377 | 378 | ||
379 | q = bdev_get_queue(bdev); | ||
380 | if (q && q->flush_flags) | ||
381 | vbd->flush_support = true; | ||
382 | |||
378 | DPRINTK("Successful creation of handle=%04x (dom=%u)\n", | 383 | DPRINTK("Successful creation of handle=%04x (dom=%u)\n", |
379 | handle, blkif->domid); | 384 | handle, blkif->domid); |
380 | return 0; | 385 | return 0; |
@@ -406,16 +411,16 @@ static int xen_blkbk_remove(struct xenbus_device *dev) | |||
406 | return 0; | 411 | return 0; |
407 | } | 412 | } |
408 | 413 | ||
409 | int xen_blkbk_barrier(struct xenbus_transaction xbt, | 414 | int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, |
410 | struct backend_info *be, int state) | 415 | struct backend_info *be, int state) |
411 | { | 416 | { |
412 | struct xenbus_device *dev = be->dev; | 417 | struct xenbus_device *dev = be->dev; |
413 | int err; | 418 | int err; |
414 | 419 | ||
415 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", | 420 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", |
416 | "%d", state); | 421 | "%d", state); |
417 | if (err) | 422 | if (err) |
418 | xenbus_dev_fatal(dev, err, "writing feature-barrier"); | 423 | xenbus_dev_fatal(dev, err, "writing feature-flush-cache"); |
419 | 424 | ||
420 | return err; | 425 | return err; |
421 | } | 426 | } |
@@ -642,7 +647,7 @@ again: | |||
642 | return; | 647 | return; |
643 | } | 648 | } |
644 | 649 | ||
645 | err = xen_blkbk_barrier(xbt, be, 1); | 650 | err = xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); |
646 | if (err) | 651 | if (err) |
647 | goto abort; | 652 | goto abort; |
648 | 653 | ||