Commit b41e95d3 authored by Venkateswararao Jujjuri (JV)'s avatar Venkateswararao Jujjuri (JV) Committed by Anthony Liguori

[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: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
parent 8f354003
...@@ -535,6 +535,13 @@ void pprint_pdu(V9fsPDU *pdu) ...@@ -535,6 +535,13 @@ void pprint_pdu(V9fsPDU *pdu)
case P9_RCLUNK: case P9_RCLUNK:
fprintf(llogfile, "RCLUNK: ("); fprintf(llogfile, "RCLUNK: (");
break; break;
case P9_TFSYNC:
fprintf(llogfile, "TFSYNC: (");
pprint_int32(pdu, 0, &offset, "fid");
break;
case P9_RFSYNC:
fprintf(llogfile, "RFSYNC: (");
break;
case P9_TLINK: case P9_TLINK:
fprintf(llogfile, "TLINK: ("); fprintf(llogfile, "TLINK: (");
pprint_int32(pdu, 0, &offset, "fid"); pprint_int32(pdu, 0, &offset, "fid");
......
...@@ -1837,6 +1837,32 @@ out: ...@@ -1837,6 +1837,32 @@ out:
qemu_free(vs); 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) static void v9fs_clunk(V9fsState *s, V9fsPDU *pdu)
{ {
int32_t fid; int32_t fid;
...@@ -3514,6 +3540,7 @@ static pdu_handler_t *pdu_handlers[] = { ...@@ -3514,6 +3540,7 @@ static pdu_handler_t *pdu_handlers[] = {
[P9_TSTAT] = v9fs_stat, [P9_TSTAT] = v9fs_stat,
[P9_TWALK] = v9fs_walk, [P9_TWALK] = v9fs_walk,
[P9_TCLUNK] = v9fs_clunk, [P9_TCLUNK] = v9fs_clunk,
[P9_TFSYNC] = v9fs_fsync,
[P9_TOPEN] = v9fs_open, [P9_TOPEN] = v9fs_open,
[P9_TREAD] = v9fs_read, [P9_TREAD] = v9fs_read,
#if 0 #if 0
......
...@@ -37,6 +37,8 @@ enum { ...@@ -37,6 +37,8 @@ enum {
P9_RXATTRCREATE, P9_RXATTRCREATE,
P9_TREADDIR = 40, P9_TREADDIR = 40,
P9_RREADDIR, P9_RREADDIR,
P9_TFSYNC = 50,
P9_RFSYNC,
P9_TLOCK = 52, P9_TLOCK = 52,
P9_RLOCK, P9_RLOCK,
P9_TGETLOCK = 54, P9_TGETLOCK = 54,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment