Patchwork [v2] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER

login
register
mail settings
Submitter Stefano Stabellini
Date Jan. 9, 2013, 6:41 p.m.
Message ID <alpine.DEB.2.02.1301091801110.4981@kaball.uk.xensource.com>
Download mbox | patch
Permalink /patch/210816/
State New
Headers show

Comments

Stefano Stabellini - Jan. 9, 2013, 6:41 p.m.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Changes in v2:
- BLKIF_OP_FLUSH_DISKCACHE implies a preflush, not a postflush.

Patch

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index a6a64a2..2d0de09 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -182,12 +182,11 @@  static int ioreq_parse(struct ioreq *ioreq)
     case BLKIF_OP_READ:
         ioreq->prot = PROT_WRITE; /* to memory */
         break;
-    case BLKIF_OP_WRITE_BARRIER:
+    case BLKIF_OP_FLUSH_DISKCACHE:
+        ioreq->presync = 1;
         if (!ioreq->req.nr_segments) {
-            ioreq->presync = 1;
             return 0;
         }
-        ioreq->presync = ioreq->postsync = 1;
         /* fall through */
     case BLKIF_OP_WRITE:
         ioreq->prot = PROT_READ; /* from memory */
@@ -369,7 +368,7 @@  static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
                        qemu_aio_complete, ioreq);
         break;
     case BLKIF_OP_WRITE:
-    case BLKIF_OP_WRITE_BARRIER:
+    case BLKIF_OP_FLUSH_DISKCACHE:
         if (!ioreq->req.nr_segments) {
             break;
         }
@@ -654,7 +653,7 @@  static int blk_init(struct XenDevice *xendev)
                   blkdev->file_size, blkdev->file_size >> 20);
 
     /* fill info */
-    xenstore_write_be_int(&blkdev->xendev, "feature-barrier", 1);
+    xenstore_write_be_int(&blkdev->xendev, "feature-flush-cache", 1);
     xenstore_write_be_int(&blkdev->xendev, "info",            info);
     xenstore_write_be_int(&blkdev->xendev, "sector-size",     blkdev->file_blk);
     xenstore_write_be_int(&blkdev->xendev, "sectors",