diff mbox

[15/29] hw/9pfs: Add yield support for fsync coroutine

Message ID 1306367597-797-16-git-send-email-jvrao@linux.vnet.ibm.com
State New
Headers show

Commit Message

jvrao May 25, 2011, 11:53 p.m. UTC
From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com>
---
 hw/9pfs/cofile.c         |   16 ++++++++++++++++
 hw/9pfs/virtio-9p-coth.h |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index e552999..26dd636 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -97,3 +97,19 @@  int v9fs_co_close(V9fsState *s, V9fsFidState *fidp)
         });
     return err;
 }
+
+int v9fs_co_fsync(V9fsState *s, V9fsFidState *fidp, int datasync)
+{
+    int fd;
+    int err;
+
+    fd = fidp->fs.fd;
+    v9fs_co_run_in_worker(
+        {
+            err = s->ops->fsync(&s->ctx, fd, datasync);
+            if (err < 0) {
+                err = -errno;
+            }
+        });
+    return err;
+}
diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h
index 5d7dfd7..a3881f3 100644
--- a/hw/9pfs/virtio-9p-coth.h
+++ b/hw/9pfs/virtio-9p-coth.h
@@ -85,4 +85,5 @@  extern int v9fs_co_lsetxattr(V9fsState *, V9fsString *, V9fsString *,
 extern int v9fs_co_lremovexattr(V9fsState *, V9fsString *, V9fsString *);
 extern int v9fs_co_closedir(V9fsState *, V9fsFidState *);
 extern int v9fs_co_close(V9fsState *, V9fsFidState *);
+extern int v9fs_co_fsync(V9fsState *, V9fsFidState *, int);
 #endif