From d3ab98e6919e9491f8ed7ffe37af73d35a55e1ca Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Wed, 12 Oct 2011 19:11:23 +0530 Subject: hw/9pfs: Add new virtfs option writeout=immediate skip host page cache writeout=immediate implies the after pwritev we do a sync_file_range. Reviewed-by: Stefan Hajnoczi Signed-off-by: Aneesh Kumar K.V --- fsdev/file-op-9p.h | 4 ++++ fsdev/qemu-fsdev.c | 10 ++++++++-- fsdev/qemu-fsdev.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'fsdev') diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 8de8abfd5b..af3ecbecb7 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -53,12 +53,16 @@ struct xattr_operations; /* FsContext flag values */ #define PATHNAME_FSCONTEXT 0x1 +/* export flags */ +#define V9FS_IMMEDIATE_WRITEOUT 0x1 + typedef struct FsContext { int flags; char *fs_root; SecModel fs_sm; uid_t uid; + int export_flags; struct xattr_operations **xops; /* fs driver specific data */ void *private; diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index 768819f575..946bad7998 100644 --- a/fsdev/qemu-fsdev.c +++ b/fsdev/qemu-fsdev.c @@ -34,6 +34,8 @@ int qemu_fsdev_add(QemuOpts *opts) const char *fstype = qemu_opt_get(opts, "fstype"); const char *path = qemu_opt_get(opts, "path"); const char *sec_model = qemu_opt_get(opts, "security_model"); + const char *writeout = qemu_opt_get(opts, "writeout"); + if (!fsdev_id) { fprintf(stderr, "fsdev: No id specified\n"); @@ -72,10 +74,14 @@ int qemu_fsdev_add(QemuOpts *opts) fsle->fse.path = g_strdup(path); fsle->fse.security_model = g_strdup(sec_model); fsle->fse.ops = FsTypes[i].ops; - + fsle->fse.export_flags = 0; + if (writeout) { + if (!strcmp(writeout, "immediate")) { + fsle->fse.export_flags = V9FS_IMMEDIATE_WRITEOUT; + } + } QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next); return 0; - } FsTypeEntry *get_fsdev_fsentry(char *id) diff --git a/fsdev/qemu-fsdev.h b/fsdev/qemu-fsdev.h index e04931a58d..3b2feb4643 100644 --- a/fsdev/qemu-fsdev.h +++ b/fsdev/qemu-fsdev.h @@ -41,6 +41,7 @@ typedef struct FsTypeEntry { char *fsdev_id; char *path; char *security_model; + int export_flags; FileOperations *ops; } FsTypeEntry; -- cgit v1.2.1