diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 18:21:54 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 18:21:54 -0400 |
| commit | a7ddbf891b8236b51fb3c9574555eb7d7d13aca6 (patch) | |
| tree | cb62a2198be1397fedc5a60ba3313a4769fa4e12 | |
| parent | 3e56d49390cd161f34cc049a3661045183d276d5 (diff) | |
| parent | f4edeeb3937d5f9953b5722f1cca9573d5ffe8a0 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
9p: Update documentation to add fscache related bits
9p: Add fscache support to 9p
9p: Fix the incorrect update of inode size in v9fs_file_write()
9p: Use the i_size_[read, write]() macros instead of using inode->i_size directly.
| -rw-r--r-- | Documentation/filesystems/9p.txt | 40 | ||||
| -rw-r--r-- | fs/9p/Kconfig | 9 | ||||
| -rw-r--r-- | fs/9p/Makefile | 3 | ||||
| -rw-r--r-- | fs/9p/cache.c | 474 | ||||
| -rw-r--r-- | fs/9p/cache.h | 176 | ||||
| -rw-r--r-- | fs/9p/v9fs.c | 196 | ||||
| -rw-r--r-- | fs/9p/v9fs.h | 13 | ||||
| -rw-r--r-- | fs/9p/v9fs_vfs.h | 6 | ||||
| -rw-r--r-- | fs/9p/vfs_addr.c | 88 | ||||
| -rw-r--r-- | fs/9p/vfs_file.c | 25 | ||||
| -rw-r--r-- | fs/9p/vfs_inode.c | 61 | ||||
| -rw-r--r-- | fs/9p/vfs_super.c | 16 | ||||
| -rw-r--r-- | include/net/9p/9p.h | 3 |
13 files changed, 1045 insertions, 65 deletions
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt index 6208f55c44c3..57e0b80a5274 100644 --- a/Documentation/filesystems/9p.txt +++ b/Documentation/filesystems/9p.txt | |||
| @@ -18,11 +18,11 @@ the 9p client is available in the form of a USENIX paper: | |||
| 18 | 18 | ||
| 19 | Other applications are described in the following papers: | 19 | Other applications are described in the following papers: |
| 20 | * XCPU & Clustering | 20 | * XCPU & Clustering |
| 21 | http://www.xcpu.org/xcpu-talk.pdf | 21 | http://xcpu.org/papers/xcpu-talk.pdf |
| 22 | * KVMFS: control file system for KVM | 22 | * KVMFS: control file system for KVM |
| 23 | http://www.xcpu.org/kvmfs.pdf | 23 | http://xcpu.org/papers/kvmfs.pdf |
| 24 | * CellFS: A New ProgrammingModel for the Cell BE | 24 | * CellFS: A New Programming Model for the Cell BE |
| 25 | http://www.xcpu.org/cellfs-talk.pdf | 25 | http://xcpu.org/papers/cellfs-talk.pdf |
| 26 | * PROSE I/O: Using 9p to enable Application Partitions | 26 | * PROSE I/O: Using 9p to enable Application Partitions |
| 27 | http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf | 27 | http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf |
| 28 | 28 | ||
| @@ -48,6 +48,7 @@ OPTIONS | |||
| 48 | (see rfdno and wfdno) | 48 | (see rfdno and wfdno) |
| 49 | virtio - connect to the next virtio channel available | 49 | virtio - connect to the next virtio channel available |
| 50 | (from lguest or KVM with trans_virtio module) | 50 | (from lguest or KVM with trans_virtio module) |
| 51 | rdma - connect to a specified RDMA channel | ||
| 51 | 52 | ||
| 52 | uname=name user name to attempt mount as on the remote server. The | 53 | uname=name user name to attempt mount as on the remote server. The |
| 53 | server may override or ignore this value. Certain user | 54 | server may override or ignore this value. Certain user |
| @@ -59,16 +60,22 @@ OPTIONS | |||
| 59 | cache=mode specifies a caching policy. By default, no caches are used. | 60 | cache=mode specifies a caching policy. By default, no caches are used. |
| 60 | loose = no attempts are made at consistency, | 61 | loose = no attempts are made at consistency, |
| 61 | intended for exclusive, read-only mounts | 62 | intended for exclusive, read-only mounts |
| 63 | fscache = use FS-Cache for a persistent, read-only | ||
| 64 | cache backend. | ||
| 62 | 65 | ||
| 63 | debug=n specifies debug level. The debug level is a bitmask. | 66 | debug=n specifies debug level. The debug level is a bitmask. |
| 64 | 0x01 = display verbose error messages | 67 | 0x01 = display verbose error messages |
| 65 | 0x02 = developer debug (DEBUG_CURRENT) | 68 | 0x02 = developer debug (DEBUG_CURRENT) |
| 66 | 0x04 = display 9p trace | 69 | 0x04 = display 9p trace |
| 67 | 0x08 = display VFS trace | 70 | 0x08 = display VFS trace |
| 68 | 0x10 = display Marshalling debug | 71 | 0x10 = display Marshalling debug |
| 69 | 0x20 = display RPC debug | 72 | 0x20 = display RPC debug |
| 70 | 0x40 = display transport debug | 73 | 0x40 = display transport debug |
| 71 | 0x80 = display allocation debug | 74 | 0x80 = display allocation debug |
| 75 | 0x100 = display protocol message debug | ||
| 76 | 0x200 = display Fid debug | ||
| 77 | 0x400 = display packet debug | ||
| 78 | 0x800 = display fscache tracing debug | ||
| 72 | 79 | ||
| 73 | rfdno=n the file descriptor for reading with trans=fd | 80 | rfdno=n the file descriptor for reading with trans=fd |
| 74 | 81 | ||
| @@ -100,6 +107,10 @@ OPTIONS | |||
| 100 | any = v9fs does single attach and performs all | 107 | any = v9fs does single attach and performs all |
| 101 | operations as one user | 108 | operations as one user |
| 102 | 109 | ||
| 110 | cachetag cache tag to use the specified persistent cache. | ||
| 111 | cache tags for existing cache sessions can be listed at | ||
| 112 | /sys/fs/9p/caches. (applies only to cache=fscache) | ||
| 113 | |||
| 103 | RESOURCES | 114 | RESOURCES |
| 104 | ========= | 115 | ========= |
| 105 | 116 | ||
| @@ -118,7 +129,7 @@ and export. | |||
| 118 | A Linux version of the 9p server is now maintained under the npfs project | 129 | A Linux version of the 9p server is now maintained under the npfs project |
| 119 | on sourceforge (http://sourceforge.net/projects/npfs). The currently | 130 | on sourceforge (http://sourceforge.net/projects/npfs). The currently |
| 120 | maintained version is the single-threaded version of the server (named spfs) | 131 | maintained version is the single-threaded version of the server (named spfs) |
| 121 | available from the same CVS repository. | 132 | available from the same SVN repository. |
| 122 | 133 | ||
| 123 | There are user and developer mailing lists available through the v9fs project | 134 | There are user and developer mailing lists available through the v9fs project |
| 124 | on sourceforge (http://sourceforge.net/projects/v9fs). | 135 | on sourceforge (http://sourceforge.net/projects/v9fs). |
| @@ -126,7 +137,8 @@ on sourceforge (http://sourceforge.net/projects/v9fs). | |||
| 126 | A stand-alone version of the module (which should build for any 2.6 kernel) | 137 | A stand-alone version of the module (which should build for any 2.6 kernel) |
| 127 | is available via (http://github.com/ericvh/9p-sac/tree/master) | 138 | is available via (http://github.com/ericvh/9p-sac/tree/master) |
| 128 | 139 | ||
| 129 | News and other information is maintained on SWiK (http://swik.net/v9fs). | 140 | News and other information is maintained on SWiK (http://swik.net/v9fs) |
| 141 | and the Wiki (http://sf.net/apps/mediawiki/v9fs/index.php). | ||
| 130 | 142 | ||
| 131 | Bug reports may be issued through the kernel.org bugzilla | 143 | Bug reports may be issued through the kernel.org bugzilla |
| 132 | (http://bugzilla.kernel.org) | 144 | (http://bugzilla.kernel.org) |
diff --git a/fs/9p/Kconfig b/fs/9p/Kconfig index 74e0723e90bc..795233702a4e 100644 --- a/fs/9p/Kconfig +++ b/fs/9p/Kconfig | |||
| @@ -8,3 +8,12 @@ config 9P_FS | |||
| 8 | See <http://v9fs.sf.net> for more information. | 8 | See <http://v9fs.sf.net> for more information. |
| 9 | 9 | ||
| 10 | If unsure, say N. | 10 | If unsure, say N. |
| 11 | |||
| 12 | config 9P_FSCACHE | ||
| 13 | bool "Enable 9P client caching support (EXPERIMENTAL)" | ||
| 14 | depends on EXPERIMENTAL | ||
| 15 | depends on 9P_FS=m && FSCACHE || 9P_FS=y && FSCACHE=y | ||
| 16 | help | ||
| 17 | Choose Y here to enable persistent, read-only local | ||
| 18 | caching support for 9p clients using FS-Cache | ||
| 19 | |||
diff --git a/fs/9p/Makefile b/fs/9p/Makefile index bc7f0d1551e6..1a940ec7af61 100644 --- a/fs/9p/Makefile +++ b/fs/9p/Makefile | |||
| @@ -8,5 +8,6 @@ obj-$(CONFIG_9P_FS) := 9p.o | |||
| 8 | vfs_dir.o \ | 8 | vfs_dir.o \ |
| 9 | vfs_dentry.o \ | 9 | vfs_dentry.o \ |
| 10 | v9fs.o \ | 10 | v9fs.o \ |
| 11 | fid.o \ | 11 | fid.o |
| 12 | 12 | ||
| 13 | 9p-$(CONFIG_9P_FSCACHE) += cache.o | ||
diff --git a/fs/9p/cache.c b/fs/9p/cache.c new file mode 100644 index 000000000000..51c94e26a346 --- /dev/null +++ b/fs/9p/cache.c | |||
| @@ -0,0 +1,474 @@ | |||
| 1 | /* | ||
| 2 | * V9FS cache definitions. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 by Abhishek Kulkarni <adkulkar@umail.iu.edu> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to: | ||
| 17 | * Free Software Foundation | ||
| 18 | * 51 Franklin Street, Fifth Floor | ||
| 19 | * Boston, MA 02111-1301 USA | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include <linux/jiffies.h> | ||
| 24 | #include <linux/file.h> | ||
| 25 | #include <linux/stat.h> | ||
| 26 | #include <linux/sched.h> | ||
| 27 | #include <linux/fs.h> | ||
| 28 | #include <net/9p/9p.h> | ||
| 29 | |||
| 30 | #include "v9fs.h" | ||
| 31 | #include "cache.h" | ||
| 32 | |||
| 33 | #define CACHETAG_LEN 11 | ||
| 34 | |||
| 35 | struct kmem_cache *vcookie_cache; | ||
| 36 | |||
| 37 | struct fscache_netfs v9fs_cache_netfs = { | ||
| 38 | .name = "9p", | ||
| 39 | .version = 0, | ||
| 40 | }; | ||
| 41 | |||
| 42 | static void init_once(void *foo) | ||
| 43 | { | ||
| 44 | struct v9fs_cookie *vcookie = (struct v9fs_cookie *) foo; | ||
| 45 | vcookie->fscache = NULL; | ||
| 46 | vcookie->qid = NULL; | ||
| 47 | inode_init_once(&vcookie->inode); | ||
| 48 | } | ||
| 49 | |||
| 50 | /** | ||
| 51 | * v9fs_init_vcookiecache - initialize a cache for vcookies to maintain | ||
| 52 | * vcookie to inode mapping | ||
| 53 | * | ||
| 54 | * Returns 0 on success. | ||
| 55 | */ | ||
| 56 | |||
| 57 | static int v9fs_init_vcookiecache(void) | ||
| 58 | { | ||
| 59 | vcookie_cache = kmem_cache_create("vcookie_cache", | ||
| 60 | sizeof(struct v9fs_cookie), | ||
| 61 | 0, (SLAB_RECLAIM_ACCOUNT| | ||
