diff options
author | Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com> | 2010-09-22 17:18:33 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-10-20 12:10:58 -0500 |
commit | b41e95d34877c1917ba9fca7ca8f5d4122d4c619 (patch) | |
tree | 9f6c5ed38ad9c9d467d8977ce11907babfd5b41a /hw/virtio-9p.c | |
parent | 8f35400358488ffa1147e9eab9e2c9cf0efd5e4e (diff) |
[virtio-9p] Introduce server side TFSYNC/RFSYNC for dotl
SYNOPSIS
size[4] Tfsync tag[2] fid[4]
size[4] Rfsync tag[2]
DESCRIPTION
The Tfsync transaction transfers ("flushes") all modified in-core data of
file identified by fid to the disk device (or other permanent storage
device) where that file resides.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Diffstat (limited to 'hw/virtio-9p.c')
-rw-r--r-- | hw/virtio-9p.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 8ae233eb80..e8eec7f60a 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -1837,6 +1837,32 @@ out: qemu_free(vs); } +static void v9fs_post_do_fsync(V9fsState *s, V9fsPDU *pdu, int err) +{ + if (err == -1) { + err = -errno; + } + complete_pdu(s, pdu, err); +} + +static void v9fs_fsync(V9fsState *s, V9fsPDU *pdu) +{ + int32_t fid; + size_t offset = 7; + V9fsFidState *fidp; + int err; + + pdu_unmarshal(pdu, offset, "d", &fid); + fidp = lookup_fid(s, fid); + if (fidp == NULL) { + err = -ENOENT; + v9fs_post_do_fsync(s, pdu, err); + return; + } + err = v9fs_do_fsync(s, fidp->fs.fd); + v9fs_post_do_fsync(s, pdu, err); +} + static void v9fs_clunk(V9fsState *s, V9fsPDU *pdu) { int32_t fid; @@ -3514,6 +3540,7 @@ static pdu_handler_t *pdu_handlers[] = { [P9_TSTAT] = v9fs_stat, [P9_TWALK] = v9fs_walk, [P9_TCLUNK] = v9fs_clunk, + [P9_TFSYNC] = v9fs_fsync, [P9_TOPEN] = v9fs_open, [P9_TREAD] = v9fs_read, #if 0 |