[9p] Introduce client 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>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
Venkateswararao Jujjuri (JV) 2010-09-22 17:19:19 -07:00 committed by Eric Van Hensbergen
parent b04faaf371
commit 920e65dc69
4 changed files with 44 additions and 2 deletions

View File

@ -290,6 +290,20 @@ static int v9fs_file_fsync(struct file *filp, int datasync)
return retval; return retval;
} }
static int v9fs_file_fsync_dotl(struct file *filp, int datasync)
{
struct p9_fid *fid;
int retval;
P9_DPRINTK(P9_DEBUG_VFS, "v9fs_file_fsync_dotl: filp %p datasync %x\n",
filp, datasync);
fid = filp->private_data;
retval = p9_client_fsync(fid);
return retval;
}
static const struct file_operations v9fs_cached_file_operations = { static const struct file_operations v9fs_cached_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = do_sync_read, .read = do_sync_read,
@ -311,7 +325,7 @@ static const struct file_operations v9fs_cached_file_operations_dotl = {
.release = v9fs_dir_release, .release = v9fs_dir_release,
.lock = v9fs_file_lock, .lock = v9fs_file_lock,
.mmap = generic_file_readonly_mmap, .mmap = generic_file_readonly_mmap,
.fsync = v9fs_file_fsync, .fsync = v9fs_file_fsync_dotl,
}; };
const struct file_operations v9fs_file_operations = { const struct file_operations v9fs_file_operations = {
@ -333,5 +347,5 @@ const struct file_operations v9fs_file_operations_dotl = {
.release = v9fs_dir_release, .release = v9fs_dir_release,
.lock = v9fs_file_lock, .lock = v9fs_file_lock,
.mmap = generic_file_readonly_mmap, .mmap = generic_file_readonly_mmap,
.fsync = v9fs_file_fsync, .fsync = v9fs_file_fsync_dotl,
}; };

View File

@ -163,6 +163,8 @@ enum p9_msg_t {
P9_RXATTRCREATE, P9_RXATTRCREATE,
P9_TREADDIR = 40, P9_TREADDIR = 40,
P9_RREADDIR, P9_RREADDIR,
P9_TFSYNC = 50,
P9_RFSYNC,
P9_TLINK = 70, P9_TLINK = 70,
P9_RLINK, P9_RLINK,
P9_TMKDIR = 72, P9_TMKDIR = 72,

View File

@ -229,6 +229,7 @@ int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid,
int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
gid_t gid, struct p9_qid *qid); gid_t gid, struct p9_qid *qid);
int p9_client_clunk(struct p9_fid *fid); int p9_client_clunk(struct p9_fid *fid);
int p9_client_fsync(struct p9_fid *fid);
int p9_client_remove(struct p9_fid *fid); int p9_client_remove(struct p9_fid *fid);
int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
u64 offset, u32 count); u64 offset, u32 count);

View File

@ -1162,6 +1162,31 @@ int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
} }
EXPORT_SYMBOL(p9_client_link); EXPORT_SYMBOL(p9_client_link);
int p9_client_fsync(struct p9_fid *fid)
{
int err;
struct p9_client *clnt;
struct p9_req_t *req;
P9_DPRINTK(P9_DEBUG_9P, ">>> TFSYNC fid %d\n", fid->fid);
err = 0;
clnt = fid->clnt;
req = p9_client_rpc(clnt, P9_TFSYNC, "d", fid->fid);
if (IS_ERR(req)) {
err = PTR_ERR(req);
goto error;
}
P9_DPRINTK(P9_DEBUG_9P, "<<< RFSYNC fid %d\n", fid->fid);
p9_free_req(clnt, req);
error:
return err;
}
EXPORT_SYMBOL(p9_client_fsync);
int p9_client_clunk(struct p9_fid *fid) int p9_client_clunk(struct p9_fid *fid)
{ {
int err; int err;