Skip to contentSkip to conversation

Add file_operations for cached mode in dotl protocol.

PATCH In review Venkateswararao Jujjuri (JV) 3 participants 6 messages Sep 25, 2010 – Oct 20, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add file_operations for cached mode in dotl protocol.

---
 fs/9p/vfs_file.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
fs/9p/vfs_file.c +15 -0
index f455c45..28db7fb 100644
@@ -44,6 +44,7 @@
 #include "cache.h"
 
 static const struct file_operations v9fs_cached_file_operations;
+static const struct file_operations v9fs_cached_file_operations_dotl;
 
 /**
  * v9fs_file_open - open a file (or directory)
@@ -92,6 +93,8 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 		/* enable cached file options */
 		if(file->f_op == &v9fs_file_operations)
 			file->f_op = &v9fs_cached_file_operations;
+		else if (file->f_op == &v9fs_file_operations_dotl)
+			file->f_op = &v9fs_cached_file_operations_dotl;
 
 #ifdef CONFIG_9P_FSCACHE
 		v9fs_cache_inode_set_cookie(inode, file);
@@ -299,6 +302,18 @@ static const struct file_operations v9fs_cached_file_operations = {
 	.fsync = v9fs_file_fsync,
 };
 
+static const struct file_operations v9fs_cached_file_operations_dotl = {
+	.llseek = generic_file_llseek,
+	.read = do_sync_read,
+	.aio_read = generic_file_aio_read,
+	.write = v9fs_file_write,
+	.open = v9fs_file_open,
+	.release = v9fs_dir_release,
+	.lock = v9fs_file_lock,
+	.mmap = generic_file_readonly_mmap,
+	.fsync = v9fs_file_fsync,
+};
+
 const struct file_operations v9fs_file_operations = {
 	.llseek = generic_file_llseek,
 	.read = v9fs_file_read,
Signature · 1 line
1.6.5.2
#1 lore raw

PATCH 2/2 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.

---
 fs/9p/vfs_file.c        |   18 ++++++++++++++++--
 include/net/9p/9p.h     |    2 ++
 include/net/9p/client.h |    1 +
 net/9p/client.c         |   25 +++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +16 -2
index 28db7fb..fdf3032 100644
@@ -290,6 +290,20 @@ static int v9fs_file_fsync(struct file *filp, int datasync)
 	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 = {
 	.llseek = generic_file_llseek,
 	.read = do_sync_read,
@@ -311,7 +325,7 @@ static const struct file_operations v9fs_cached_file_operations_dotl = {
 	.release = v9fs_dir_release,
 	.lock = v9fs_file_lock,
 	.mmap = generic_file_readonly_mmap,
-	.fsync = v9fs_file_fsync,
+	.fsync = v9fs_file_fsync_dotl,
 };
 
 const struct file_operations v9fs_file_operations = {
@@ -333,5 +347,5 @@ const struct file_operations v9fs_file_operations_dotl = {
 	.release = v9fs_dir_release,
 	.lock = v9fs_file_lock,
 	.mmap = generic_file_readonly_mmap,
-	.fsync = v9fs_file_fsync,
+	.fsync = v9fs_file_fsync_dotl,
 };
include/net/9p/9p.h +2 -0
index a4a1b04..55e9605 100644
@@ -163,6 +163,8 @@ enum p9_msg_t {
 	P9_RXATTRCREATE,
 	P9_TREADDIR = 40,
 	P9_RREADDIR,
+	P9_TFSYNC = 50,
+	P9_RFSYNC,
 	P9_TLINK = 70,
 	P9_RLINK,
 	P9_TMKDIR = 72,
include/net/9p/client.h +1 -0
index d1aa2cf..fbb23b4 100644
@@ -232,6 +232,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,
 		gid_t gid, struct p9_qid *qid);
 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_read(struct p9_fid *fid, char *data, char __user *udata,
 							u64 offset, u32 count);
net/9p/client.c +25 -0
index 208efce..124241b 100644
@@ -1211,6 +1211,31 @@ int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
 }
 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 err;
Signature · 1 line
1.6.5.2
#2 lore raw

Re: [V9fs-developer] [PATCH 2/2] [9p] Introduce client side TFSYNC/RFSYNC for dotl.

Remind me again why we need this? Don't blank twstats provide the same functionality?

-eric

Quoted 125 lines · Venkateswararao Jujjuri (JV)

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.

---
 fs/9p/vfs_file.c        |   18 ++++++++++++++++-- include/net/9p/9p.h     |    2 ++ include/net/9p/client.h |    1 + net/9p/client.c         |   25 +++++++++++++++++++++++++

 4 files changed, 44 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +16 -2
index 28db7fb..fdf3032 100644
@@ -290,6 +290,20 @@ static int v9fs_file_fsync(struct file *filp, int datasync)
        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 = {
        .llseek = generic_file_llseek,
        .read = do_sync_read,
@@ -311,7 +325,7 @@ static const struct file_operations v9fs_cached_file_operations_dotl = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
-       .fsync = v9fs_file_fsync,
+       .fsync = v9fs_file_fsync_dotl,
  };
 
  const struct file_operations v9fs_file_operations = {
@@ -333,5 +347,5 @@ const struct file_operations v9fs_file_operations_dotl = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
-       .fsync = v9fs_file_fsync,
+       .fsync = v9fs_file_fsync_dotl,
  };
include/net/9p/9p.h +2 -0
index a4a1b04..55e9605 100644
@@ -163,6 +163,8 @@ enum p9_msg_t {
        P9_RXATTRCREATE,
        P9_TREADDIR = 40,
        P9_RREADDIR,
+       P9_TFSYNC = 50,
+       P9_RFSYNC,
        P9_TLINK = 70,
        P9_RLINK,
        P9_TMKDIR = 72,
include/net/9p/client.h +1 -0
index d1aa2cf..fbb23b4 100644
@@ -232,6 +232,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,
                gid_t gid, struct p9_qid *qid);
  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_read(struct p9_fid *fid, char *data, char __user *udata,
                                                        u64 offset, u32 count);
net/9p/client.c +25 -1
index 208efce..124241b 100644
@@ -1211,6 +1211,31 @@ int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
  }
  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 err;
--

1.6.5.2

Quoted 10 lines

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Re: [V9fs-developer] [PATCH 2/2] [9p] Introduce client side TFSYNC/RFSYNC for dotl.

Quoted 2 lines · Eric Van Hensbergen

Remind me again why we need this? Don't blank twstats provide the same functionality?

WSTAT is a dotu operation, and we are overloading it to accomplish the sync.
I think it is good idea to avoid overloading in dotl and especially if it is happening through dotu protocol. Also, we are trying to get 1-to-1 correspondence (where ever is possible) between Linux VFS and dotl.

Thanks,
JV

Quoted 140 lines

-eric

Quoted 135 lines · Venkateswararao Jujjuri (JV)

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.

---
  fs/9p/vfs_file.c        |   18 ++++++++++++++++--
  include/net/9p/9p.h     |    2 ++
  include/net/9p/client.h |    1 +
  net/9p/client.c         |   25 +++++++++++++++++++++++++
  4 files changed, 44 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +16 -2
index 28db7fb..fdf3032 100644
@@ -290,6 +290,20 @@ static int v9fs_file_fsync(struct file *filp, int datasync)
        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 = {
        .llseek = generic_file_llseek,
        .read = do_sync_read,
@@ -311,7 +325,7 @@ static const struct file_operations v9fs_cached_file_operations_dotl = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
-       .fsync = v9fs_file_fsync,
+       .fsync = v9fs_file_fsync_dotl,
  };
 
  const struct file_operations v9fs_file_operations = {
@@ -333,5 +347,5 @@ const struct file_operations v9fs_file_operations_dotl = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
-       .fsync = v9fs_file_fsync,
+       .fsync = v9fs_file_fsync_dotl,
  };
include/net/9p/9p.h +2 -0
index a4a1b04..55e9605 100644
@@ -163,6 +163,8 @@ enum p9_msg_t {
        P9_RXATTRCREATE,
        P9_TREADDIR = 40,
        P9_RREADDIR,
+       P9_TFSYNC = 50,
+       P9_RFSYNC,
        P9_TLINK = 70,
        P9_RLINK,
        P9_TMKDIR = 72,
include/net/9p/client.h +1 -0
index d1aa2cf..fbb23b4 100644
@@ -232,6 +232,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,
                gid_t gid, struct p9_qid *qid);
  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_read(struct p9_fid *fid, char *data, char __user *udata,
                                                        u64 offset, u32 count);
net/9p/client.c +25 -1
index 208efce..124241b 100644
@@ -1211,6 +1211,31 @@ int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
  }
  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 err;
--

1.6.5.2

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

#4 lore raw

Re: [V9fs-developer] [PATCH 2/2] [9p] Introduce client side TFSYNC/RFSYNC for dotl.

Quoted 10 lines · Venkateswararao Jujjuri (JV)
Quoted 3 lines · Eric Van Hensbergen

Remind me again why we need this?  Don't blank twstats provide the same functionality?

WSTAT is a dotu operation, and we are overloading it to accomplish the sync. I think it is good idea to avoid overloading in dotl and especially if it is happening
through dotu protocol.

Actually, the use of WSTAT to sync files is part of the original protocol, not .U

Quoted 5 lines

Also, we are trying to get 1-to-1 correspondence
(where ever is possible)
between Linux VFS and dotl.

It's a small enough change that I guess I'll allow it, particularly since .L won't use TWSTAT otherwise.

-eric
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Re: [PATCH 2/2] [9p] Introduce client side TFSYNC/RFSYNC for dotl.

In reply to Venkateswararao Jujjuri (JV)
Quoted 10 lines · Venkateswararao Jujjuri (JV)

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.

I guess we want the operation to differentiate between fdatasync and fsync. ie we want it to be

size[4] Tfsync tag[2] fid[4] datasync[4]

-aneesh