[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090616203942.4526.93942.stgit@warthog.procyon.org.uk>
Date: Tue, 16 Jun 2009 21:39:42 +0100
From: David Howells <dhowells@...hat.com>
To: torvalds@...l.org, akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, linux-afs@...ts.infradead.org,
linux-fsdevel@...r.kernel.org, Wang Lei <wang840925@...il.com>,
David Howells <dhowells@...hat.com>
Subject: [PATCH 11/17] AFS: Implement the PFlushCB pioctl
From: Wang Lei <wang840925@...il.com>
Implement the PFlushCB pioctl for AFS. This flushes the callback of the
specified file, indicating to the server we're no longer interested in
notifications of changes to that file.
Signed-off-by: Wang Lei <wang840925@...il.com>
Signed-off-by: David Howells <dhowells@...hat.com>
---
fs/afs/pioctl.c | 26 ++++++++++++++++++++++++++
include/linux/afscall.h | 1 +
include/linux/venus.h | 1 +
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/fs/afs/pioctl.c b/fs/afs/pioctl.c
index 5f6beeb..ffbec0c 100644
--- a/fs/afs/pioctl.c
+++ b/fs/afs/pioctl.c
@@ -144,6 +144,28 @@ long afs_PWhereIs(struct dentry *dentry, struct vice_ioctl *arg,
}
/*
+ * Flush callback only
+ */
+long afs_PFlushCB(struct dentry *dentry, struct vice_ioctl *arg,
+ struct key *key)
+{
+ struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode);
+ struct afs_volume *volume = vnode->volume;
+
+ _enter("");
+
+ /* file servers do not grant callbacks on files from read-only
+ * volumes */
+ if (volume->type != AFSVL_ROVOL && vnode->cb_promised) {
+ afs_give_up_callback(vnode);
+ afs_flush_callback_breaks(vnode->server);
+ }
+
+ _leave(" = 0");
+ return 0;
+}
+
+/*
* The AFS path-based I/O control operation
*/
long afs_pioctl(struct dentry *dentry, int cmd, struct vice_ioctl *arg)
@@ -181,6 +203,10 @@ long afs_pioctl(struct dentry *dentry, int cmd, struct vice_ioctl *arg)
ret = afs_PWhereIs(dentry, arg, key);
break;
+ case VIOC_COMMAND(PFlushCB):
+ ret = afs_PFlushCB(dentry, arg, key);
+ break;
+
default:
_debug("fallback to pathless: %x", cmd);
ret = afs_pathless_pioctl(cmd, arg);
diff --git a/include/linux/afscall.h b/include/linux/afscall.h
index 0a60cd1..00054f0 100644
--- a/include/linux/afscall.h
+++ b/include/linux/afscall.h
@@ -17,6 +17,7 @@
#define PGetVolStat 4 /* get volume status */
#define PWhereIs 14 /* find out where a volume is located */
#define PGetFID 22 /* get file ID */
+#define PFlushCB 25 /* flush callback only */
#define PGetFileCell 30 /* get the cell a file inhabits */
#define AFS_MAXHOSTS 8 /* the maximum of hosts number */
diff --git a/include/linux/venus.h b/include/linux/venus.h
index 78cbf47..ea8e468 100644
--- a/include/linux/venus.h
+++ b/include/linux/venus.h
@@ -20,6 +20,7 @@
#define VIOCGETVOLSTAT _VICEIOCTL(PGetVolStat)
#define VIOCWHEREIS _VICEIOCTL(PWhereIs)
#define VIOCGETFID _VICEIOCTL(PGetFID)
+#define VIOCFLUSHCB _VICEIOCTL(PFlushCB)
#define VIOC_FILE_CELL_NAME _VICEIOCTL(PGetFileCell)
#endif /* _LINUX_VENUS_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists