rpms/kernel/devel linux-2.6-cachefiles.patch, 1.1, 1.2 linux-2.6-nfs-superblock-unmount-optimization.patch, 1.1, 1.2 linux-2.6-nfs-superblock-sharing.patch, 1.1, 1.2 linux-2.6-filesystem-caching-for-afs-and-nfs.patch, 1.1, 1.2
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Jul 28 21:41:09 UTC 2006
Author: dzickus
Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv12689
Modified Files:
linux-2.6-cachefiles.patch
linux-2.6-nfs-superblock-unmount-optimization.patch
linux-2.6-nfs-superblock-sharing.patch
linux-2.6-filesystem-caching-for-afs-and-nfs.patch
Log Message:
Refreshing the patch with updates
linux-2.6-cachefiles.patch:
Documentation/filesystems/caching/cachefiles.txt | 281 ++++
fs/Kconfig | 20
fs/Makefile | 1
fs/buffer.c | 2
fs/cachefiles/Makefile | 18
fs/cachefiles/cf-bind.c | 279 ++++
fs/cachefiles/cf-interface.c | 1299 +++++++++++++++++++++++
fs/cachefiles/cf-key.c | 157 ++
fs/cachefiles/cf-main.c | 129 ++
fs/cachefiles/cf-namei.c | 825 ++++++++++++++
fs/cachefiles/cf-proc.c | 498 ++++++++
fs/cachefiles/cf-sysctl.c | 69 +
fs/cachefiles/cf-xattr.c | 295 +++++
fs/cachefiles/internal.h | 308 +++++
fs/fcntl.c | 2
fs/file_table.c | 1
include/linux/fs.h | 2
include/linux/pagemap.h | 6
kernel/auditsc.c | 2
mm/filemap.c | 98 +
20 files changed, 4292 insertions(+)
Index: linux-2.6-cachefiles.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-cachefiles.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-cachefiles.patch 20 Jul 2006 00:27:30 -0000 1.1
+++ linux-2.6-cachefiles.patch 28 Jul 2006 21:41:06 -0000 1.2
@@ -1,309 +1,6 @@
-Date: Fri, 14 Jul 2006 16:51:22 +0100
+Date: Thu, 27 Jul 2006 19:53:48 +0100
From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 21/28] FS-Cache: Avoid ENFILE checking for kernel-specific open files
-
-Make it possible to avoid ENFILE checking for kernel specific open files, such
-as are used by the CacheFiles module.
-
-After, for example, tarring up a kernel source tree over the network, the
-CacheFiles module may easily have 20000+ files open in the backing filesystem,
-thus causing all non-root processes to be given error ENFILE when they try to
-open a file, socket, pipe, etc..
-
-Signed-Off-By: David Howells <dhowells at redhat.com>
----
-
- Documentation/sysctl/fs.txt | 6 +++++
- fs/file_table.c | 47 +++++++++++++++++++++++++++++++++++--------
- fs/open.c | 20 ++++++++++++++++++
- include/linux/file.h | 1 -
- include/linux/fs.h | 10 +++++++++
- include/linux/sysctl.h | 1 +
- kernel/sysctl.c | 11 ++++++++++
- 7 files changed, 85 insertions(+), 11 deletions(-)
-
-Index: latest/Documentation/sysctl/fs.txt
-===================================================================
---- latest.orig/Documentation/sysctl/fs.txt
-+++ latest/Documentation/sysctl/fs.txt
-@@ -71,7 +71,7 @@ you might want to raise the limit.
-
- ==============================================================
-
--file-max & file-nr:
-+file-max, file-nr & file-kernel:
-
- The kernel allocates file handles dynamically, but as yet it
- doesn't free them again.
-@@ -88,6 +88,10 @@ close to the maximum, but the number of
- significantly greater than 0, you've encountered a peak in your
- usage of file handles and you don't need to increase the maximum.
-
-+The value in file-kernel denotes the number of internal file handles
-+that the kernel has open. These do not contribute to ENFILE
-+accounting.
-+
- ==============================================================
-
- inode-max, inode-nr & inode-state:
-Index: latest/fs/file_table.c
-===================================================================
---- latest.orig/fs/file_table.c
-+++ latest/fs/file_table.c
-@@ -29,10 +29,13 @@ struct files_stat_struct files_stat = {
- .max_files = NR_FILE
- };
-
-+struct files_kernel_stat_struct files_kernel_stat;
-+
- /* public. Not pretty! */
- __cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
-
- static struct percpu_counter nr_files __cacheline_aligned_in_smp;
-+static atomic_t nr_kernel_files;
-
- static inline void file_free_rcu(struct rcu_head *head)
- {
-@@ -42,7 +45,10 @@ static inline void file_free_rcu(struct
-
- static inline void file_free(struct file *f)
- {
-- percpu_counter_dec(&nr_files);
-+ if (f->f_kernel_flags & FKFLAGS_NO_ENFILE)
-+ atomic_dec(&nr_kernel_files);
-+ else
-+ percpu_counter_dec(&nr_files);
- call_rcu(&f->f_u.fu_rcuhead, file_free_rcu);
- }
-
-@@ -73,45 +79,63 @@ int proc_nr_files(ctl_table *table, int
- files_stat.nr_files = get_nr_files();
- return proc_dointvec(table, write, filp, buffer, lenp, ppos);
- }
-+int proc_files_kernel(ctl_table *table, int write, struct file *filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos)
-+{
-+ files_kernel_stat.nr_kernel_files = atomic_read(&nr_kernel_files);
-+ return proc_dointvec(table, write, filp, buffer, lenp, ppos);
-+}
- #else
- int proc_nr_files(ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
- {
- return -ENOSYS;
- }
-+int proc_files_kernel(ctl_table *table, int write, struct file *filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos)
-+{
-+ return -ENOSYS;
-+}
- #endif
-
- /* Find an unused file structure and return a pointer to it.
- * Returns NULL, if there are no more free file structures or
- * we run out of memory.
- */
--struct file *get_empty_filp(void)
-+struct file *get_empty_kernel_filp(unsigned short kflags)
- {
- struct task_struct *tsk;
- static int old_max;
- struct file * f;
-
- /*
-- * Privileged users can go above max_files
-+ * Privileged users can go above max_files and internal kernel users
-+ * can avoid it completely
- */
-- if (get_nr_files() >= files_stat.max_files && !capable(CAP_SYS_ADMIN)) {
-+ if (!(kflags & FKFLAGS_NO_ENFILE) &&
-+ get_nr_files() >= files_stat.max_files &&
-+ !capable(CAP_SYS_ADMIN)) {
- /*
-- * percpu_counters are inaccurate. Do an expensive check before
-- * we go and fail.
-+ * percpu_counters are inaccurate. Do an expensive
-+ * check before we go and fail.
- */
- if (percpu_counter_sum(&nr_files) >= files_stat.max_files)
- goto over;
- }
-
-- f = kmem_cache_alloc(filp_cachep, GFP_KERNEL);
-+ f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL);
- if (f == NULL)
- goto fail;
-
-- percpu_counter_inc(&nr_files);
-- memset(f, 0, sizeof(*f));
-+ if (kflags & FKFLAGS_NO_ENFILE)
-+ atomic_inc(&nr_kernel_files);
-+ else
-+ percpu_counter_inc(&nr_files);
-+
- if (security_file_alloc(f))
- goto fail_sec;
-
-+ f->f_kernel_flags = kflags;
- tsk = current;
- INIT_LIST_HEAD(&f->f_u.fu_list);
- atomic_set(&f->f_count, 1);
-@@ -137,6 +161,11 @@ fail:
- return NULL;
- }
-
-+struct file *get_empty_filp(void)
-+{
-+ return get_empty_kernel_filp(0);
-+}
-+
- EXPORT_SYMBOL(get_empty_filp);
-
- void fastcall fput(struct file *file)
-Index: latest/fs/open.c
-===================================================================
---- latest.orig/fs/open.c
-+++ latest/fs/open.c
-@@ -978,6 +978,26 @@ struct file *dentry_open(struct dentry *
- EXPORT_SYMBOL(dentry_open);
-
- /*
-+ * open a specifically in-kernel file
-+ */
-+struct file *dentry_open_kernel(struct dentry *dentry, struct vfsmount *mnt, int flags)
-+{
-+ int error;
-+ struct file *f;
-+
-+ error = -ENFILE;
-+ f = get_empty_kernel_filp(FKFLAGS_NO_ENFILE);
-+ if (f == NULL) {
-+ dput(dentry);
-+ mntput(mnt);
-+ return ERR_PTR(error);
-+ }
-+
-+ return __dentry_open(dentry, mnt, flags, f, NULL);
-+}
-+EXPORT_SYMBOL_GPL(dentry_open_kernel);
-+
-+/*
- * Find an empty file descriptor entry, and mark it busy.
- */
- int get_unused_fd(void)
-Index: latest/include/linux/file.h
-===================================================================
---- latest.orig/include/linux/file.h
-+++ latest/include/linux/file.h
-@@ -79,7 +79,6 @@ extern void FASTCALL(set_close_on_exec(u
- extern void put_filp(struct file *);
- extern int get_unused_fd(void);
- extern void FASTCALL(put_unused_fd(unsigned int fd));
--struct kmem_cache;
-
- extern struct file ** alloc_fd_array(int);
- extern void free_fd_array(struct file **, int);
-Index: latest/include/linux/fs.h
-===================================================================
---- latest.orig/include/linux/fs.h
-+++ latest/include/linux/fs.h
-@@ -37,7 +37,11 @@ struct files_stat_struct {
- int nr_free_files; /* read only */
- int max_files; /* tunable */
- };
-+struct files_kernel_stat_struct {
-+ int nr_kernel_files; /* read only */
-+};
- extern struct files_stat_struct files_stat;
-+extern struct files_kernel_stat_struct files_kernel_stat;
- extern int get_max_files(void);
-
- struct inodes_stat_t {
-@@ -73,6 +77,8 @@ extern int dir_notify_enable;
- behavior for cross-node execution/opening_for_writing of files */
- #define FMODE_EXEC 16
-
-+#define FKFLAGS_NO_ENFILE 1 /* kernel internal file (ignored for ENFILE accounting) */
-+
- #define RW_MASK 1
- #define RWA_MASK 2
- #define READ 0
-@@ -680,6 +686,7 @@ struct file {
- atomic_t f_count;
- unsigned int f_flags;
- mode_t f_mode;
-+ unsigned short f_kernel_flags;
- loff_t f_pos;
- struct fown_struct f_owner;
- unsigned int f_uid, f_gid;
-@@ -1424,6 +1431,7 @@ extern long do_sys_open(int fdf, const c
- int mode);
- extern struct file *filp_open(const char *, int, int);
- extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
-+extern struct file * dentry_open_kernel(struct dentry *, struct vfsmount *, int);
- extern int filp_close(struct file *, fl_owner_t id);
- extern char * getname(const char __user *);
-
-@@ -1627,6 +1635,7 @@ static inline void insert_inode_hash(str
- }
-
- extern struct file * get_empty_filp(void);
-+extern struct file * get_empty_kernel_filp(unsigned short fkflags);
- extern void file_move(struct file *f, struct list_head *list);
- extern void file_kill(struct file *f);
- struct bio;
-@@ -1652,6 +1661,7 @@ extern ssize_t generic_file_direct_write
- unsigned long *, loff_t, loff_t *, size_t, size_t);
- extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
- unsigned long, loff_t, loff_t *, size_t, ssize_t);
-+extern int generic_file_buffered_write_one_kernel_page(struct file *, pgoff_t, struct page *);
- extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
- extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
- ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
-Index: latest/include/linux/sysctl.h
-===================================================================
---- latest.orig/include/linux/sysctl.h
-+++ latest/include/linux/sysctl.h
-@@ -847,6 +847,7 @@ enum
- FS_AIO_NR=18, /* current system-wide number of aio requests */
- FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
- FS_INOTIFY=20, /* inotify submenu */
-+ FS_FILE_KERNEL=21, /* int: number of internal kernel files */
- };
-
- /* /proc/sys/fs/quota/ */
-Index: latest/kernel/sysctl.c
-===================================================================
---- latest.orig/kernel/sysctl.c
-+++ latest/kernel/sysctl.c
-@@ -52,6 +52,9 @@
- extern int proc_nr_files(ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos);
-
-+extern int proc_files_kernel(ctl_table *table, int write, struct file *filp,
-+ void __user *buffer, size_t *lenp, loff_t *ppos);
-+
- #if defined(CONFIG_SYSCTL)
-
- /* External variables not in a header file. */
-@@ -1050,6 +1053,14 @@ static ctl_table fs_table[] = {
- .proc_handler = &proc_dointvec,
- },
- {
-+ .ctl_name = FS_FILE_KERNEL,
-+ .procname = "file-kernel",
-+ .data = &files_stat,
-+ .maxlen = 1*sizeof(int),
-+ .mode = 0444,
-+ .proc_handler = &proc_files_kernel,
-+ },
-+ {
- .ctl_name = FS_DENTRY,
- .procname = "dentry-state",
- .data = &dentry_stat,
-Date: Fri, 14 Jul 2006 16:51:31 +0100
-From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 25/28] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem
+Subject: [RHEL5 PATCH 28/30] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem
Add a cache backend that permits a mounted filesystem to be used as a backing
store for the cache.
@@ -590,26 +287,28 @@
fs/Makefile | 1
fs/buffer.c | 2
fs/cachefiles/Makefile | 18
- fs/cachefiles/cf-bind.c | 283 +++++
- fs/cachefiles/cf-interface.c | 1313 ++++++++++++++++++++++
- fs/cachefiles/cf-key.c | 160 +++
- fs/cachefiles/cf-main.c | 131 ++
- fs/cachefiles/cf-namei.c | 837 ++++++++++++++
- fs/cachefiles/cf-proc.c | 510 +++++++++
+ fs/cachefiles/cf-bind.c | 279 +++++
+ fs/cachefiles/cf-interface.c | 1299 ++++++++++++++++++++++
+ fs/cachefiles/cf-key.c | 157 +++
+ fs/cachefiles/cf-main.c | 129 ++
+ fs/cachefiles/cf-namei.c | 825 ++++++++++++++
+ fs/cachefiles/cf-proc.c | 498 ++++++++
fs/cachefiles/cf-sysctl.c | 69 +
- fs/cachefiles/cf-xattr.c | 299 +++++
+ fs/cachefiles/cf-xattr.c | 295 +++++
fs/cachefiles/internal.h | 308 +++++
fs/fcntl.c | 2
fs/file_table.c | 1
+ include/linux/fs.h | 2
include/linux/pagemap.h | 6
kernel/auditsc.c | 2
- mm/filemap.c | 103 ++
- 19 files changed, 4346 insertions(+), 0 deletions(-)
+ mm/filemap.c | 98 ++
+ 20 files changed, 4292 insertions(+), 0 deletions(-)
-Index: latest/Documentation/filesystems/caching/cachefiles.txt
-===================================================================
+diff --git a/Documentation/filesystems/caching/cachefiles.txt b/Documentation/filesystems/caching/cachefiles.txt
+new file mode 100644
+index 0000000..37b6385
--- /dev/null
-+++ latest/Documentation/filesystems/caching/cachefiles.txt
++++ b/Documentation/filesystems/caching/cachefiles.txt
@@ -0,0 +1,281 @@
+ ===============================================
+ CacheFiles: CACHE ON ALREADY MOUNTED FILESYSTEM
@@ -892,11 +591,11 @@
+
+Note that CacheFiles will erase from the cache any file it doesn't recognise or
+any file of an incorrect type (such as a FIFO file or a device file).
-Index: latest/fs/Kconfig
-===================================================================
---- latest.orig/fs/Kconfig
-+++ latest/fs/Kconfig
-@@ -544,6 +544,26 @@ config FSCACHE
+diff --git a/fs/Kconfig b/fs/Kconfig
+index 36d0051..afec7e1 100644
+--- a/fs/Kconfig
++++ b/fs/Kconfig
+@@ -543,6 +543,26 @@ config FSCACHE
See Documentation/filesystems/caching/fscache.txt for more information.
@@ -923,22 +622,21 @@
endmenu
menu "CD-ROM/DVD Filesystems"
-Index: latest/fs/Makefile
-===================================================================
---- latest.orig/fs/Makefile
-+++ latest/fs/Makefile
-@@ -103,6 +103,7 @@ obj-$(CONFIG_AFS_FS) += afs/
+diff --git a/fs/Makefile b/fs/Makefile
+index 0b0e827..e5efb4b 100644
+--- a/fs/Makefile
++++ b/fs/Makefile
+@@ -101,5 +101,6 @@ obj-$(CONFIG_AFS_FS) += afs/
obj-$(CONFIG_BEFS_FS) += befs/
obj-$(CONFIG_HOSTFS) += hostfs/
obj-$(CONFIG_HPPFS) += hppfs/
+obj-$(CONFIG_CACHEFILES) += cachefiles/
obj-$(CONFIG_DEBUG_FS) += debugfs/
obj-$(CONFIG_OCFS2_FS) += ocfs2/
- obj-$(CONFIG_GFS2_FS) += gfs2/
-Index: latest/fs/buffer.c
-===================================================================
---- latest.orig/fs/buffer.c
-+++ latest/fs/buffer.c
+diff --git a/fs/buffer.c b/fs/buffer.c
+index 3660dcb..31a01da 100644
+--- a/fs/buffer.c
++++ b/fs/buffer.c
@@ -184,6 +184,8 @@ int fsync_super(struct super_block *sb)
return sync_blockdev(sb->s_bdev);
}
@@ -948,10 +646,11 @@
/*
* Write out and wait upon all dirty data associated with this
* device. Filesystem data as well as the underlying block
-Index: latest/fs/cachefiles/Makefile
-===================================================================
+diff --git a/fs/cachefiles/Makefile b/fs/cachefiles/Makefile
+new file mode 100644
+index 0000000..c1522d9
--- /dev/null
-+++ latest/fs/cachefiles/Makefile
++++ b/fs/cachefiles/Makefile
@@ -0,0 +1,18 @@
+#
+# Makefile for caching in a mounted filesystem
@@ -971,11 +670,12 @@
+endif
+
+obj-$(CONFIG_CACHEFILES) := cachefiles.o
-Index: latest/fs/cachefiles/cf-bind.c
-===================================================================
+diff --git a/fs/cachefiles/cf-bind.c b/fs/cachefiles/cf-bind.c
+new file mode 100644
+index 0000000..d8cb4c3
--- /dev/null
-+++ latest/fs/cachefiles/cf-bind.c
-@@ -0,0 +1,283 @@
++++ b/fs/cachefiles/cf-bind.c
+@@ -0,0 +1,279 @@
+/* cf-bind.c: bind and unbind a cache from the filesystem backing it
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -1050,8 +750,7 @@
+
+ /* add the cache */
+ return cachefiles_proc_add_cache(cache, NULL);
-+
-+} /* end cachefiles_proc_bind() */
++}
+
+/*****************************************************************************/
+/*
@@ -1104,8 +803,7 @@
+
+ cache->mnt = mntget(mnt);
+ root = dget(mnt->mnt_root);
-+ }
-+ else {
++ } else {
+ cache->mnt = nd.mnt;
+ root = nd.dentry;
+
@@ -1228,8 +926,7 @@
+error_root_object:
+ kerror("Failed to register: %d", ret);
+ return ret;
-+
-+} /* end cachefiles_proc_add_cache() */
++}
+
+/*****************************************************************************/
+/*
@@ -1257,13 +954,13 @@
+ kfree(cache->tag);
+
+ _leave("");
-+
-+} /* end cachefiles_proc_unbind() */
-Index: latest/fs/cachefiles/cf-interface.c
-===================================================================
++}
+diff --git a/fs/cachefiles/cf-interface.c b/fs/cachefiles/cf-interface.c
+new file mode 100644
+index 0000000..b5ca30f
--- /dev/null
-+++ latest/fs/cachefiles/cf-interface.c
-@@ -0,0 +1,1313 @@
++++ b/fs/cachefiles/cf-interface.c
+@@ -0,0 +1,1299 @@
+/* cf-interface.c: CacheFiles to FS-Cache interface
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -1383,7 +1080,7 @@
+ _leave(" = -ENOMEM");
+ return ERR_PTR(-ENOMEM);
+
-+} /* end cachefiles_lookup_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -1404,7 +1101,7 @@
+ atomic_inc(&object->fscache_usage);
+ return &object->fscache;
+
-+} /* end cachefiles_grab_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -1424,7 +1121,7 @@
+
+ down_write(&object->sem);
+
-+} /* end cachefiles_lock_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -1439,7 +1136,7 @@
+ object = container_of(_object, struct cachefiles_object, fscache);
+ up_write(&object->sem);
+
-+} /* end cachefiles_unlock_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -1457,7 +1154,7 @@
+
+ //cachefiles_tree_update_object(super, object);
+
-+} /* end cachefiles_update_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -1467,7 +1164,6 @@
+{
+ struct cachefiles_object *object;
+ struct cachefiles_cache *cache;
-+ int ret;
+
+ ASSERT(_object);
+
@@ -1497,17 +1193,8 @@
+ }
+
+ /* close the filesystem stuff attached to the object */
-+ if (object->backer) {
-+ if (object->backer->f_op &&
-+ object->backer->f_op->flush
-+ ) {
-+ ret = object->backer->f_op->flush(object->backer,
-+ NULL);
-+ if (ret < 0)
-+ kerror("Backing file flush returned error %d",
-+ ret);
-+ }
-+ fput(object->backer);
++ if (object->backer != object->dentry) {
++ dput(object->backer);
+ object->backer = NULL;
+ }
+
@@ -1524,7 +1211,7 @@
+
+ _leave("");
+
-+} /* end cachefiles_put_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -1548,7 +1235,7 @@
+ " returned error %d",
+ ret);
+
-+} /* end cachefiles_sync_cache() */
++}
+
+/*****************************************************************************/
+/*
@@ -1570,15 +1257,14 @@
+ if (!object->backer)
+ return -ENOBUFS;
+
-+ ASSERT(S_ISREG(object->backer->f_dentry->d_inode->i_mode));
++ ASSERT(S_ISREG(object->backer->d_inode->i_mode));
+
+ newattrs.ia_size = i_size;
-+ newattrs.ia_file = object->backer;
-+ newattrs.ia_valid = ATTR_SIZE | ATTR_FILE;
++ newattrs.ia_valid = ATTR_SIZE;
+
-+ mutex_lock(&object->backer->f_dentry->d_inode->i_mutex);
-+ ret = notify_change(object->backer->f_dentry, &newattrs);
-+ mutex_unlock(&object->backer->f_dentry->d_inode->i_mutex);
++ mutex_lock(&object->backer->d_inode->i_mutex);
++ ret = notify_change(object->backer, &newattrs);
++ mutex_unlock(&object->backer->d_inode->i_mutex);
+
+ if (ret == -EIO) {
+ cachefiles_io_error_obj(object, "Size set failed");
@@ -1588,7 +1274,7 @@
+ _leave(" = %d", ret);
+ return ret;
+
-+} /* end cachefiles_set_i_size() */
++}
+
+/*****************************************************************************/
+/*
@@ -1648,7 +1334,7 @@
+ _leave(" = %d", ret);
+ return ret;
+
-+} /* end cachefiles_has_space() */
++}
+
+/*****************************************************************************/
+/*
@@ -1691,7 +1377,7 @@
+
+ return 0;
+
-+} /* end cachefiles_read_waiter() */
++}
+
+/*****************************************************************************/
+/*
@@ -1705,7 +1391,7 @@
+ struct pagevec pagevec;
+ int error, max;
+
-+ _enter("{ino=%lu}", object->backer->f_dentry->d_inode->i_ino);
++ _enter("{ino=%lu}", object->backer->d_inode->i_ino);
+
+ pagevec_init(&pagevec, 0);
+
@@ -1767,7 +1453,7 @@
+
+ _leave("");
+
-+} /* end cachefiles_read_copier_work() */
++}
+
+/*****************************************************************************/
+/*
@@ -1806,7 +1492,7 @@
+ init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter);
+
+ /* attempt to get hold of the backing page */
-+ bmapping = object->backer->f_mapping;
++ bmapping = object->backer->d_inode->i_mapping;
+ newpage = NULL;
+
+ for (;;) {
@@ -1840,7 +1526,7 @@
+ pagevec_add(lru_pvec, backpage);
+ __pagevec_lru_add(lru_pvec);
+
-+ ret = bmapping->a_ops->readpage(object->backer, backpage);
++ ret = bmapping->a_ops->readpage(NULL, backpage);
+ if (ret < 0)
+ goto read_error;
+
@@ -1901,8 +1587,10 @@
+out:
+ if (backpage)
+ page_cache_release(backpage);
-+ fscache_put_context(object->fscache.cookie, monitor->context);
-+ kfree(monitor);
++ if (monitor) {
++ fscache_put_context(object->fscache.cookie, monitor->context);
++ kfree(monitor);
++ }
+
+ _leave(" = %d", ret);
+ return ret;
@@ -1925,7 +1613,7 @@
+ _leave(" = -ENOMEM");
+ return -ENOMEM;
+
-+} /* end cachefiles_read_backing_file_one() */
++}
+
+/*****************************************************************************/
+/*
@@ -1965,7 +1653,7 @@
+ if (!object->backer)
+ return -ENOBUFS;
+
-+ inode = object->backer->f_dentry->d_inode;
++ inode = object->backer->d_inode;
+ ASSERT(S_ISREG(inode->i_mode));
+ ASSERT(inode->i_mapping->a_ops->bmap);
+ ASSERT(inode->i_mapping->a_ops->readpages);
@@ -2001,22 +1689,20 @@
+ page,
+ &pagevec);
+ ret = 0;
-+ }
-+ else if (cachefiles_has_space(cache, 1) == 0) {
++ } else if (cachefiles_has_space(cache, 1) == 0) {
+ /* there's space in the cache we can use */
+ pagevec_add(&pagevec, page);
+ cookie->def->mark_pages_cached(cookie->netfs_data,
+ page->mapping, &pagevec);
+ ret = -ENODATA;
-+ }
-+ else {
++ } else {
+ ret = -ENOBUFS;
+ }
+
+ _leave(" = %d", ret);
+ return ret;
+
-+} /* end cachefiles_read_or_alloc_page() */
++}
+
+/*****************************************************************************/
+/*
@@ -2031,7 +1717,7 @@
+ struct pagevec *lru_pvec)
+{
+ struct cachefiles_one_read *monitor = NULL;
-+ struct address_space *bmapping = object->backer->f_mapping;
++ struct address_space *bmapping = object->backer->d_inode->i_mapping;
+ struct page *newpage = NULL, *netpage, *_n, *backpage = NULL;
+ int ret = 0;
+
@@ -2092,7 +1778,7 @@
+ __pagevec_lru_add(lru_pvec);
+
+ reread_backing_page:
-+ ret = bmapping->a_ops->readpage(object->backer, backpage);
++ ret = bmapping->a_ops->readpage(NULL, backpage);
+ if (ret < 0)
+ goto read_error;
+
@@ -2247,7 +1933,7 @@
+ ret = -EIO;
+ goto out;
+
-+} /* end cachefiles_read_backing_file() */
++}
+
+/*****************************************************************************/
+/*
@@ -2284,7 +1970,7 @@
+ if (cachefiles_has_space(cache, *nr_pages) < 0)
+ space = 0;
+
-+ inode = object->backer->f_dentry->d_inode;
++ inode = object->backer->d_inode;
+ ASSERT(S_ISREG(inode->i_mode));
+ ASSERT(inode->i_mapping->a_ops->bmap);
+ ASSERT(inode->i_mapping->a_ops->readpages);
@@ -2325,8 +2011,7 @@
+ list_move(&page->lru, &backpages);
+ (*nr_pages)--;
+ nrbackpages++;
-+ }
-+ else if (space && pagevec_add(&pagevec, page) == 0) {
++ } else if (space && pagevec_add(&pagevec, page) == 0) {
+ cookie->def->mark_pages_cached(cookie->netfs_data,
+ mapping, &pagevec);
+ pagevec_reinit(&pagevec);
@@ -2362,7 +2047,7 @@
+ ret, *nr_pages, list_empty(pages) ? " empty" : "");
+ return ret;
+
-+} /* end cachefiles_read_or_alloc_pages() */
++}
+
+/*****************************************************************************/
+/*
@@ -2391,7 +2076,7 @@
+
+ return cachefiles_has_space(cache, 1);
+
-+} /* end cachefiles_allocate_page() */
++}
+
+/*****************************************************************************/
+/*
@@ -2420,14 +2105,13 @@
+ _debug("- store {%lu}", writer->netfs_page->index);
+
+ ret = generic_file_buffered_write_one_kernel_page(
-+ object->backer,
++ object->backer->d_inode->i_mapping,
+ writer->netfs_page->index,
+ writer->netfs_page);
+
+ if (ret == -ENOSPC) {
+ ret = -ENOBUFS;
-+ }
-+ else if (ret == -EIO) {
++ } else if (ret == -EIO) {
+ cachefiles_io_error_obj(object,
+ "write page to backing file"
+ " failed");
@@ -2460,7 +2144,7 @@
+ spin_unlock_irq(&object->work_lock);
+ _leave("");
+
-+} /* end cachefiles_write_work() */
++}
+
+/*****************************************************************************/
+/*
@@ -2487,7 +2171,7 @@
+ if (!object->backer)
+ return -ENOBUFS;
+
-+ ASSERT(S_ISREG(object->backer->f_dentry->d_inode->i_mode));
++ ASSERT(S_ISREG(object->backer->d_inode->i_mode));
+
+#if 0 // set to 1 for deferred writing
+ /* queue the operation for deferred processing by keventd */
@@ -2510,9 +2194,8 @@
+
+#else
+ /* copy the page to ext3 and let it store it in its own time */
-+ ret = generic_file_buffered_write_one_kernel_page(object->backer,
-+ page->index,
-+ page);
++ ret = generic_file_buffered_write_one_kernel_page(
++ object->backer->d_inode->i_mapping, page->index, page);
+
+ if (ret != 0) {
+ if (ret == -EIO)
@@ -2528,7 +2211,7 @@
+ _leave(" = %d", ret);
+ return ret;
+
-+} /* end cachefiles_write_page() */
++}
+
+/*****************************************************************************/
+/*
@@ -2548,7 +2231,7 @@
+ _enter("%p,{%lu,%lx},,,",
+ object, pagevec->nr, pagevec->pages[0]->index);
+
-+} /* end cachefiles_uncache_pages() */
++}
+
+/*****************************************************************************/
+/*
@@ -2558,7 +2241,7 @@
+{
+ _enter("");
+
-+} /* end cachefiles_dissociate_pages() */
++}
+
+struct fscache_cache_ops cachefiles_cache_ops = {
+ .name = "cachefiles",
@@ -2577,11 +2260,12 @@
+ .uncache_pages = cachefiles_uncache_pages,
+ .dissociate_pages = cachefiles_dissociate_pages,
+};
-Index: latest/fs/cachefiles/cf-key.c
-===================================================================
+diff --git a/fs/cachefiles/cf-key.c b/fs/cachefiles/cf-key.c
+new file mode 100644
+index 0000000..cfae5a7
--- /dev/null
-+++ latest/fs/cachefiles/cf-key.c
-@@ -0,0 +1,160 @@
++++ b/fs/cachefiles/cf-key.c
+@@ -0,0 +1,157 @@
+/* cf-key.c: Key to pathname encoder
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -2647,8 +2331,7 @@
+ * is ((514 + 251) / 252) = 3
+ */
+ max += 1; /* NUL on end */
-+ }
-+ else {
++ } else {
+ /* calculate the maximum length of the cooked key */
+ keylen = (keylen + 2) / 3;
+
@@ -2700,8 +2383,7 @@
+ case FSCACHE_COOKIE_TYPE_DATAFILE: type = 'D'; break;
+ default: type = 'S'; break;
+ }
-+ }
-+ else {
++ } else {
+ seg = 252;
+ for (loop = keylen; loop > 0; loop--) {
+ if (seg <= 0) {
@@ -2740,13 +2422,13 @@
+
+ _leave(" = %p %d:[%s]", key, len, key);
+ return key;
-+
-+} /* end cachefiles_cook_key() */
-Index: latest/fs/cachefiles/cf-main.c
-===================================================================
++}
+diff --git a/fs/cachefiles/cf-main.c b/fs/cachefiles/cf-main.c
+new file mode 100644
+index 0000000..da8d020
--- /dev/null
-+++ latest/fs/cachefiles/cf-main.c
-@@ -0,0 +1,131 @@
++++ b/fs/cachefiles/cf-main.c
+@@ -0,0 +1,129 @@
+/* cf-main.c: network filesystem caching backend to use cache files on a
+ * premounted filesystem
+ *
@@ -2862,8 +2544,7 @@
+error_proc:
+ kerror("failed to register: %d", ret);
+ return ret;
-+
-+} /* end cachefiles_init() */
++}
+
+/*****************************************************************************/
+/*
@@ -2876,13 +2557,13 @@
+ kmem_cache_destroy(cachefiles_object_jar);
+ remove_proc_entry("cachefiles", proc_root_fs);
+ cachefiles_sysctl_cleanup();
-+
-+} /* end cachefiles_exit() */
-Index: latest/fs/cachefiles/cf-namei.c
-===================================================================
++}
+diff --git a/fs/cachefiles/cf-namei.c b/fs/cachefiles/cf-namei.c
+new file mode 100644
+index 0000000..20db88a
--- /dev/null
-+++ latest/fs/cachefiles/cf-namei.c
-@@ -0,0 +1,837 @@
++++ b/fs/cachefiles/cf-namei.c
+@@ -0,0 +1,825 @@
+/* cf-namei.c: CacheFiles path walking and related routines
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -2937,8 +2618,7 @@
+ rb_insert_color(&object->active_node, &cache->active_nodes);
+
+ write_unlock(&cache->active_lock);
-+
-+} /* end cachefiles_mark_object_active() */
++}
+
+/*****************************************************************************/
+/*
@@ -2972,8 +2652,7 @@
+ if (ret == 0) {
+ _debug("d_delete");
+ d_delete(rep);
-+ }
-+ else if (ret == -EIO) {
++ } else if (ret == -EIO) {
+ cachefiles_io_error(cache, "Unlink failed");
+ }
+
@@ -3109,8 +2788,7 @@
+ fsnotify_move(dir->d_inode, cache->graveyard->d_inode,
+ old_name, rep->d_name.name, 1,
+ grave->d_inode, rep->d_inode);
-+ }
-+ else if (ret != -ENOMEM) {
++ } else if (ret != -ENOMEM) {
+ cachefiles_io_error(cache, "Rename failed with error %d", ret);
+ }
+
@@ -3120,8 +2798,7 @@
+ dput(grave);
+ _leave(" = 0");
+ return 0;
-+
-+} /* end cachefiles_bury_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -3147,8 +2824,7 @@
+ dput(dir);
+ _leave(" = %d", ret);
+ return ret;
-+
-+} /* end cachefiles_delete_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -3162,7 +2838,6 @@
+{
+ struct cachefiles_cache *cache;
+ struct dentry *dir, *next = NULL, *new;
-+ struct file *file;
+ struct qstr name;
+ uid_t fsuid;
+ gid_t fsgid;
@@ -3196,8 +2871,7 @@
+ if (key) {
+ name.len = key - (char *) name.name;
+ *key++ = 0;
-+ }
-+ else {
++ } else {
+ name.len = strlen(name.name);
+ }
+
@@ -3276,16 +2950,15 @@
+
+ _debug("mkdir -> %p{%p{ino=%lu}}",
+ next, next->d_inode, next->d_inode->i_ino);
-+ }
-+ /* we need to make sure a positive match found a directory */
-+ else if (!S_ISDIR(next->d_inode->i_mode)) {
++
++ } else if (!S_ISDIR(next->d_inode->i_mode)) {
+ kerror("inode %lu is not a directory",
+ next->d_inode->i_ino);
+ ret = -ENOBUFS;
+ goto error;
+ }
-+ }
-+ else {
++
++ } else {
+ /* non-index objects start out life as files */
+ if (!next->d_inode) {
+ DQUOT_INIT(dir->d_inode);
@@ -3300,12 +2973,10 @@
+
+ _debug("create -> %p{%p{ino=%lu}}",
+ next, next->d_inode, next->d_inode->i_ino);
-+ }
-+ /* we need to make sure a positive match found a directory or a
-+ * file */
-+ else if (!S_ISDIR(next->d_inode->i_mode) &&
-+ !S_ISREG(next->d_inode->i_mode)
-+ ) {
++
++ } else if (!S_ISDIR(next->d_inode->i_mode) &&
++ !S_ISREG(next->d_inode->i_mode)
++ ) {
+ kerror("inode %lu is not a file or directory",
+ next->d_inode->i_ino);
+ ret = -ENOBUFS;
@@ -3362,8 +3033,7 @@
+ ret = cachefiles_set_object_xattr(object, auxdata);
+ if (ret < 0)
+ goto check_error;
-+ }
-+ else {
++ } else {
+ /* always update the atime on an object we've just looked up
+ * (this is used to keep track of culling, and atimes are only
+ * updated by read, write and readdir but not lookup or
@@ -3374,14 +3044,17 @@
+ /* open a file interface onto a data file */
+ if (object->type != FSCACHE_COOKIE_TYPE_INDEX) {
+ if (S_ISREG(object->dentry->d_inode->i_mode)) {
-+ file = dentry_open_kernel(dget(object->dentry),
-+ mntget(cache->mnt), 0);
-+ if (IS_ERR(file))
-+ goto open_error;
++ const struct address_space_operations *aops;
+
-+ object->backer = file;
-+ }
-+ else {
++ ret = -EPERM;
++ aops = object->dentry->d_inode->i_mapping->a_ops;
++ if (!aops->bmap ||
++ !aops->prepare_write ||
++ !aops->commit_write)
++ goto check_error;
++
++ object->backer = object->dentry;
++ } else {
+ BUG(); // TODO: open file in data-class subdir
+ }
+ }
@@ -3398,8 +3071,6 @@
+ cachefiles_io_error(cache, "create/mkdir failed");
+ goto error;
+
-+open_error:
-+ ret = PTR_ERR(file);
+check_error:
+ write_lock(&cache->active_lock);
+ rb_erase(&object->active_node, &cache->active_nodes);
@@ -3435,8 +3106,7 @@
+
+ _leave(" = ret");
+ return ret;
-+
-+} /* end cachefiles_walk_to_object() */
++}
+
+/*****************************************************************************/
+/*
@@ -3573,8 +3243,7 @@
+ current->fsgid = fsgid;
+ _leave(" = %d", ret);
+ return ERR_PTR(ret);
-+
-+} /* end cachefiles_get_directory() */
++}
+
+/*****************************************************************************/
+/*
@@ -3629,7 +3298,8 @@
+ dput(new);
+ }
+
-+ _debug("victim -> %p %s", victim, victim->d_inode ? "positive" : "negative");
++ _debug("victim -> %p %s",
++ victim, victim->d_inode ? "positive" : "negative");
+
+ /* if the object is no longer there then we probably retired the object
+ * at the netfs's request whilst the cull was in progress
@@ -3718,13 +3388,13 @@
+
+ _leave(" = %d", ret);
+ return ret;
-+
-+} /* end cachefiles_cull() */
-Index: latest/fs/cachefiles/cf-proc.c
-===================================================================
++}
+diff --git a/fs/cachefiles/cf-proc.c b/fs/cachefiles/cf-proc.c
+new file mode 100644
+index 0000000..c14320e
--- /dev/null
-+++ latest/fs/cachefiles/cf-proc.c
-@@ -0,0 +1,510 @@
++++ b/fs/cachefiles/cf-proc.c
+@@ -0,0 +1,498 @@
+/* cf-proc.c: /proc/fs/cachefiles interface
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -3832,8 +3502,7 @@
+ file->private_data = cache;
+ cache->cachefilesd = file;
+ return 0;
-+
-+} /* end cachefiles_proc_open() */
++}
+
+/*****************************************************************************/
+/*
@@ -3862,8 +3531,7 @@
+
+ _leave("");
+ return 0;
-+
-+} /* end cachefiles_proc_release() */
++}
+
+/*****************************************************************************/
+/*
@@ -3903,8 +3571,7 @@
+ return -EFAULT;
+
+ return n;
-+
-+} /* end cachefiles_proc_read() */
++}
+
+/*****************************************************************************/
+/*
@@ -3989,8 +3656,7 @@
+ if (ret == 0)
+ ret = datalen;
+ goto error;
-+
-+} /* end cachefiles_proc_write() */
++}
+
+/*****************************************************************************/
+/*
@@ -4003,8 +3669,7 @@
+ " 0%%<=bstop<bcull<brun<100%%");
+
+ return -EINVAL;
-+
-+} /* end cachefiles_proc_range_error() */
++}
+
+/*****************************************************************************/
+/*
@@ -4029,8 +3694,7 @@
+
+ cache->brun_percent = brun;
+ return 0;
-+
-+} /* end cachefiles_proc_brun() */
++}
+
+/*****************************************************************************/
+/*
@@ -4055,8 +3719,7 @@
+
+ cache->bcull_percent = bcull;
+ return 0;
-+
-+} /* end cachefiles_proc_bcull() */
++}
+
+/*****************************************************************************/
+/*
@@ -4081,8 +3744,7 @@
+
+ cache->bstop_percent = bstop;
+ return 0;
-+
-+} /* end cachefiles_proc_bstop() */
++}
+
+/*****************************************************************************/
+/*
@@ -4111,8 +3773,7 @@
+
+ cache->rootdirname = dir;
+ return 0;
-+
-+} /* end cachefiles_proc_dir() */
++}
+
+/*****************************************************************************/
+/*
@@ -4139,8 +3800,7 @@
+
+ cache->tag = tag;
+ return 0;
-+
-+} /* end cachefiles_proc_tag() */
++}
+
+/*****************************************************************************/
+/*
@@ -4207,8 +3867,7 @@
+inval:
+ kerror("cull command requires dirfd and filename");
+ return -EINVAL;
-+
-+} /* end cachefiles_proc_cull() */
++}
+
+/*****************************************************************************/
+/*
@@ -4233,12 +3892,12 @@
+inval:
+ kerror("debug command requires mask");
+ return -EINVAL;
-+
-+} /* end cachefiles_proc_debug() */
-Index: latest/fs/cachefiles/cf-sysctl.c
-===================================================================
++}
+diff --git a/fs/cachefiles/cf-sysctl.c b/fs/cachefiles/cf-sysctl.c
+new file mode 100644
+index 0000000..4d6fc04
--- /dev/null
-+++ latest/fs/cachefiles/cf-sysctl.c
++++ b/fs/cachefiles/cf-sysctl.c
@@ -0,0 +1,69 @@
+/* cf-sysctl.c: Control parameters
+ *
@@ -4309,11 +3968,12 @@
+{
+ unregister_sysctl_table(cachefiles_sysctl);
+}
-Index: latest/fs/cachefiles/cf-xattr.c
-===================================================================
+diff --git a/fs/cachefiles/cf-xattr.c b/fs/cachefiles/cf-xattr.c
+new file mode 100644
+index 0000000..8952bf0
--- /dev/null
-+++ latest/fs/cachefiles/cf-xattr.c
-@@ -0,0 +1,299 @@
++++ b/fs/cachefiles/cf-xattr.c
+@@ -0,0 +1,295 @@
+/* cf-xattr.c: CacheFiles extended attribute management
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -4422,8 +4082,7 @@
+ xtype, type);
+ ret = -EIO;
+ goto error;
-+
-+} /* end cachefiles_check_object_type() */
++}
+
+/*****************************************************************************/
+/*
@@ -4460,8 +4119,7 @@
+ mutex_unlock(&dentry->d_inode->i_mutex);
+ _leave(" = %d", ret);
+ return ret;
-+
-+} /* end cachefiles_set_object_xattr() */
++}
+
+/*****************************************************************************/
+/*
@@ -4580,8 +4238,7 @@
+stale:
+ ret = -ESTALE;
+ goto error;
-+
-+} /* end cachefiles_check_object_xattr() */
++}
+
+/*****************************************************************************/
+/*
@@ -4611,12 +4268,12 @@
+
+ _leave(" = %d", ret);
+ return ret;
-+
-+} /* end cachefiles_remove_object_xattr() */
-Index: latest/fs/cachefiles/internal.h
-===================================================================
++}
+diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
+new file mode 100644
+index 0000000..edda6e7
--- /dev/null
-+++ latest/fs/cachefiles/internal.h
++++ b/fs/cachefiles/internal.h
@@ -0,0 +1,308 @@
+/* internal.h: general netfs cache on cache files internal defs
+ *
@@ -4670,7 +4327,7 @@
+struct cachefiles_object {
+ struct fscache_object fscache; /* fscache handle */
+ struct dentry *dentry; /* the file/dir representing this object */
-+ struct file *backer; /* backing file */
++ struct dentry *backer; /* backing file */
+ loff_t i_size; /* object size */
+ atomic_t usage; /* basic object usage count */
+ atomic_t fscache_usage; /* FSDEF object usage count */
@@ -4926,11 +4583,11 @@
+} while(0)
+
+#endif
-Index: latest/fs/fcntl.c
-===================================================================
---- latest.orig/fs/fcntl.c
-+++ latest/fs/fcntl.c
-@@ -531,6 +531,8 @@ int send_sigurg(struct fown_struct *fown
+diff --git a/fs/fcntl.c b/fs/fcntl.c
+index d35cbc6..b43d821 100644
+--- a/fs/fcntl.c
++++ b/fs/fcntl.c
+@@ -529,6 +529,8 @@ int send_sigurg(struct fown_struct *fown
return ret;
}
@@ -4939,11 +4596,11 @@
static DEFINE_RWLOCK(fasync_lock);
static kmem_cache_t *fasync_cache __read_mostly;
-Index: latest/fs/file_table.c
-===================================================================
---- latest.orig/fs/file_table.c
-+++ latest/fs/file_table.c
-@@ -263,6 +263,7 @@ struct file fastcall *fget_light(unsigne
+diff --git a/fs/file_table.c b/fs/file_table.c
+index 0131ba0..47a3fa8 100644
+--- a/fs/file_table.c
++++ b/fs/file_table.c
+@@ -234,6 +234,7 @@ struct file fastcall *fget_light(unsigne
return file;
}
@@ -4951,10 +4608,23 @@
void put_filp(struct file *file)
{
-Index: latest/include/linux/pagemap.h
-===================================================================
---- latest.orig/include/linux/pagemap.h
-+++ latest/include/linux/pagemap.h
+diff --git a/include/linux/fs.h b/include/linux/fs.h
+index 2561020..3cc9657 100644
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -1651,6 +1651,8 @@ extern ssize_t generic_file_direct_write
+ unsigned long *, loff_t, loff_t *, size_t, size_t);
+ extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
+ unsigned long, loff_t, loff_t *, size_t, ssize_t);
++extern int generic_file_buffered_write_one_kernel_page(struct address_space *,
++ pgoff_t, struct page *);
+ extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
+ extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
+ ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
+diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
+index 82b2753..acc3481 100644
+--- a/include/linux/pagemap.h
++++ b/include/linux/pagemap.h
@@ -181,6 +181,12 @@ static inline void wait_on_page_fs_misc(
extern void fastcall end_page_fs_misc(struct page *page);
@@ -4968,11 +4638,11 @@
* Fault a userspace page into pagetables. Return non-zero on a fault.
*
* This assumes that two userspace pages are always sufficient. That's
-Index: latest/kernel/auditsc.c
-===================================================================
---- latest.orig/kernel/auditsc.c
-+++ latest/kernel/auditsc.c
-@@ -1314,6 +1314,8 @@ update_context:
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c
+index ae40ac8..61b484f 100644
+--- a/kernel/auditsc.c
++++ b/kernel/auditsc.c
+@@ -1314,6 +1314,8 @@ #endif
context->names[idx].ino = (unsigned long)-1;
}
@@ -4981,10 +4651,10 @@
/**
* auditsc_get_stamp - get local copies of audit_context values
* @ctx: audit_context for the task
-Index: latest/mm/filemap.c
-===================================================================
---- latest.orig/mm/filemap.c
-+++ latest/mm/filemap.c
+diff --git a/mm/filemap.c b/mm/filemap.c
+index c71d8fd..d04f557 100644
+--- a/mm/filemap.c
++++ b/mm/filemap.c
@@ -520,6 +520,18 @@ void fastcall wait_on_page_bit(struct pa
}
EXPORT_SYMBOL(wait_on_page_bit);
@@ -5004,7 +4674,7 @@
/**
* unlock_page - unlock a locked page
* @page: the page
-@@ -2256,6 +2268,97 @@ zero_length_segment:
+@@ -2237,6 +2249,92 @@ zero_length_segment:
}
EXPORT_SYMBOL(generic_file_buffered_write);
@@ -5015,25 +4685,30 @@
+ * page offset
+ */
+int
-+generic_file_buffered_write_one_kernel_page(struct file *file,
++generic_file_buffered_write_one_kernel_page(struct address_space *mapping,
+ pgoff_t index,
+ struct page *src)
+{
-+ struct address_space *mapping = file->f_mapping;
-+ struct address_space_operations *a_ops = mapping->a_ops;
++ const struct address_space_operations *a_ops = mapping->a_ops;
+ struct pagevec lru_pvec;
+ struct page *page, *cached_page = NULL;
+ long status = 0;
+
+ pagevec_init(&lru_pvec, 0);
+
++#if 0
++ if (mapping->tree_lock.magic != RWLOCK_MAGIC)
++ printk("RWLOCK magic incorrect: %x != %x\n",
++ mapping->tree_lock.magic, RWLOCK_MAGIC);
++#endif
++
+ page = __grab_cache_page(mapping, index, &cached_page, &lru_pvec);
+ if (!page) {
+ BUG_ON(cached_page);
+ return -ENOMEM;
+ }
+
-+ status = a_ops->prepare_write(file, page, 0, PAGE_CACHE_SIZE);
++ status = a_ops->prepare_write(NULL, page, 0, PAGE_CACHE_SIZE);
+ if (unlikely(status)) {
+ loff_t isize = i_size_read(mapping->host);
+
@@ -5054,7 +4729,7 @@
+ copy_highpage(page, src);
+ flush_dcache_page(page);
+
-+ status = a_ops->commit_write(file, page, 0, PAGE_CACHE_SIZE);
++ status = a_ops->commit_write(NULL, page, 0, PAGE_CACHE_SIZE);
+ if (status == AOP_TRUNCATED_PAGE) {
+ page_cache_release(page);
+ goto sync;
@@ -5076,23 +4751,13 @@
+ if (cached_page)
+ page_cache_release(cached_page);
+
-+ /*
-+ * For now, when the user asks for O_SYNC, we'll actually give O_DSYNC
-+ */
-+ if (unlikely((file->f_flags & O_SYNC) || IS_SYNC(mapping->host))) {
-+ if (!a_ops->writepage)
-+ status = generic_osync_inode(
-+ mapping->host, mapping,
-+ OSYNC_METADATA | OSYNC_DATA);
-+ }
-+
-+ /*
-+ * If we get here for O_DIRECT writes then we must have fallen through
-+ * to buffered writes (block instantiation inside i_size). So we sync
-+ * the file data here, to try to honour O_DIRECT expectations.
-+ */
-+ if (unlikely(file->f_flags & O_DIRECT))
-+ status = filemap_write_and_wait(mapping);
++ /* the caller must handle O_SYNC themselves, but we handle S_SYNC and
++ * MS_SYNCHRONOUS here */
++ if (unlikely(IS_SYNC(mapping->host)) && !a_ops->writepage)
++ status = generic_osync_inode(mapping->host, mapping,
++ OSYNC_METADATA | OSYNC_DATA);
++
++ /* the caller must handle O_DIRECT for themselves */
+
+ pagevec_lru_add(&lru_pvec);
+ return status;
@@ -5102,3 +4767,4 @@
static ssize_t
__generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos)
+
linux-2.6-nfs-superblock-unmount-optimization.patch:
fs/autofs4/autofs_i.h | 3 -
fs/autofs4/init.c | 2
fs/autofs4/inode.c | 22 +-------
fs/autofs4/waitq.c | 1
fs/dcache.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++
fs/super.c | 12 ++--
include/linux/dcache.h | 1
7 files changed, 146 insertions(+), 28 deletions(-)
Index: linux-2.6-nfs-superblock-unmount-optimization.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-nfs-superblock-unmount-optimization.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-nfs-superblock-unmount-optimization.patch 20 Jul 2006 00:27:30 -0000 1.1
+++ linux-2.6-nfs-superblock-unmount-optimization.patch 28 Jul 2006 21:41:06 -0000 1.2
@@ -1,6 +1,153 @@
-Date: Fri, 14 Jul 2006 16:51:35 +0100
+Date: Thu, 27 Jul 2006 19:53:50 +0100
From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 27/28] VFS: Destroy the dentries contributed by a superblock on unmounting
+Subject: [RHEL5 PATCH 29/30] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super()
+
+Make sure all dentries refs are released before calling kill_anon_super() so
+that the assumption that generic_shutdown_super() can completely destroy the
+dentry tree for there will be no external references holds true.
+
+What was being done in the put_super() superblock op, is now done in the
+kill_sb() filesystem op instead, prior to calling kill_anon_super().
+
+This makes the struct autofs_sb_info::root member variable redundant (since
+sb->s_root is still available), and so that is removed. The calls to
+shrink_dcache_sb() are also removed since they're also redundant as
+shrink_dcache_for_umount() will now be called after the cleanup routine.
+
+Signed-Off-By: David Howells <dhowells at redhat.com>
+Acked-by: Ian Kent <raven at themaw.net>
+---
+
+ fs/autofs4/autofs_i.h | 3 +--
+ fs/autofs4/init.c | 2 +-
+ fs/autofs4/inode.c | 22 ++++------------------
+ fs/autofs4/waitq.c | 1 -
+ 4 files changed, 6 insertions(+), 22 deletions(-)
+
+diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
+index d6603d0..47e38f3 100644
+--- a/fs/autofs4/autofs_i.h
++++ b/fs/autofs4/autofs_i.h
+@@ -96,7 +96,6 @@ #define AUTOFS_TYPE_OFFSET 0x0004
+
+ struct autofs_sb_info {
+ u32 magic;
+- struct dentry *root;
+ int pipefd;
+ struct file *pipe;
+ pid_t oz_pgrp;
+@@ -231,4 +230,4 @@ out:
+ }
+
+ void autofs4_dentry_release(struct dentry *);
+-
++extern void autofs4_kill_sb(struct super_block *);
+diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c
+index 5d91933..723a1c5 100644
+--- a/fs/autofs4/init.c
++++ b/fs/autofs4/init.c
+@@ -24,7 +24,7 @@ static struct file_system_type autofs_fs
+ .owner = THIS_MODULE,
+ .name = "autofs",
+ .get_sb = autofs_get_sb,
+- .kill_sb = kill_anon_super,
++ .kill_sb = autofs4_kill_sb,
+ };
+
+ static int __init init_autofs4_fs(void)
+diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
+index fde78b1..1bf68c5 100644
+--- a/fs/autofs4/inode.c
++++ b/fs/autofs4/inode.c
+@@ -95,7 +95,7 @@ void autofs4_free_ino(struct autofs_info
+ */
+ static void autofs4_force_release(struct autofs_sb_info *sbi)
+ {
+- struct dentry *this_parent = sbi->root;
++ struct dentry *this_parent = sbi->sb->s_root;
+ struct list_head *next;
+
+ spin_lock(&dcache_lock);
+@@ -126,7 +126,7 @@ resume:
+ spin_lock(&dcache_lock);
+ }
+
+- if (this_parent != sbi->root) {
++ if (this_parent != sbi->sb->s_root) {
+ struct dentry *dentry = this_parent;
+
+ next = this_parent->d_u.d_child.next;
+@@ -139,15 +139,9 @@ resume:
+ goto resume;
+ }
+ spin_unlock(&dcache_lock);
+-
+- dput(sbi->root);
+- sbi->root = NULL;
+- shrink_dcache_sb(sbi->sb);
+-
+- return;
+ }
+
+-static void autofs4_put_super(struct super_block *sb)
++void autofs4_kill_sb(struct super_block *sb)
+ {
+ struct autofs_sb_info *sbi = autofs4_sbi(sb);
+
+@@ -162,6 +156,7 @@ static void autofs4_put_super(struct sup
+ kfree(sbi);
+
+ DPRINTK("shutting down");
++ kill_anon_super(sb);
+ }
+
+ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
+@@ -188,7 +183,6 @@ static int autofs4_show_options(struct s
+ }
+
+ static struct super_operations autofs4_sops = {
+- .put_super = autofs4_put_super,
+ .statfs = simple_statfs,
+ .show_options = autofs4_show_options,
+ };
+@@ -314,7 +308,6 @@ int autofs4_fill_super(struct super_bloc
+
+ s->s_fs_info = sbi;
+ sbi->magic = AUTOFS_SBI_MAGIC;
+- sbi->root = NULL;
+ sbi->pipefd = -1;
+ sbi->catatonic = 0;
+ sbi->exp_timeout = 0;
+@@ -396,13 +389,6 @@ int autofs4_fill_super(struct super_bloc
+ sbi->pipefd = pipefd;
+
+ /*
+- * Take a reference to the root dentry so we get a chance to
+- * clean up the dentry tree on umount.
+- * See autofs4_force_release.
+- */
+- sbi->root = dget(root);
+-
+- /*
+ * Success! Install the root dentry now to indicate completion.
+ */
+ s->s_root = root;
+diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
+index ce103e7..c0a6c8d 100644
+--- a/fs/autofs4/waitq.c
++++ b/fs/autofs4/waitq.c
+@@ -45,7 +45,6 @@ void autofs4_catatonic_mode(struct autof
+ fput(sbi->pipe); /* Close the pipe */
+ sbi->pipe = NULL;
+ }
+- shrink_dcache_sb(sbi->sb);
+ }
+
+ static int autofs4_write(struct file *file, const void *addr, int bytes)
+
+Date: Thu, 27 Jul 2006 19:53:52 +0100
+From: David Howells <dhowells at redhat.com>
+Subject: [RHEL5 PATCH 30/30] VFS: Destroy the dentries contributed by a superblock on unmounting
The attached patch destroys all the dentries attached to a superblock in one go
by:
@@ -52,11 +199,11 @@
include/linux/dcache.h | 1
3 files changed, 140 insertions(+), 6 deletions(-)
-Index: latest/fs/dcache.c
-===================================================================
---- latest.orig/fs/dcache.c
-+++ latest/fs/dcache.c
-@@ -551,6 +551,139 @@ repeat:
+diff --git a/fs/dcache.c b/fs/dcache.c
+index 17b392a..780f014 100644
+--- a/fs/dcache.c
++++ b/fs/dcache.c
+@@ -547,6 +547,139 @@ repeat:
}
/*
@@ -196,10 +343,10 @@
* Search for at least 1 mount point in the dentry's subdirs.
* We descend to the next level whenever the d_subdirs
* list is non-empty and continue searching.
-Index: latest/fs/super.c
-===================================================================
---- latest.orig/fs/super.c
-+++ latest/fs/super.c
+diff --git a/fs/super.c b/fs/super.c
+index 6d4e817..3bf8e5f 100644
+--- a/fs/super.c
++++ b/fs/super.c
@@ -228,17 +228,17 @@ static int grab_super(struct super_block
* that need destruction out of superblock, call generic_shutdown_super()
* and release aforementioned objects. Note: dentries and inodes _are_
@@ -224,161 +371,16 @@
fsync_super(sb);
lock_super(sb);
sb->s_flags &= ~MS_ACTIVE;
-Index: latest/include/linux/dcache.h
-===================================================================
---- latest.orig/include/linux/dcache.h
-+++ latest/include/linux/dcache.h
-@@ -231,6 +231,7 @@ extern struct dentry * d_alloc_anon(stru
+diff --git a/include/linux/dcache.h b/include/linux/dcache.h
+index 44605be..63f64a9 100644
+--- a/include/linux/dcache.h
++++ b/include/linux/dcache.h
+@@ -230,6 +230,7 @@ extern struct dentry * d_alloc_anon(stru
extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
extern void shrink_dcache_sb(struct super_block *);
extern void shrink_dcache_parent(struct dentry *);
+extern void shrink_dcache_for_umount(struct super_block *);
extern int d_invalidate(struct dentry *);
- extern void flush_dentry_attributes(void);
-Date: Fri, 14 Jul 2006 16:51:37 +0100
-From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 28/28] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super()
-
-Make sure all dentries refs are released before calling kill_anon_super() so
-that the assumption that generic_shutdown_super() can completely destroy the
-dentry tree for there will be no external references holds true.
-
-What was being done in the put_super() superblock op, is now done in the
-kill_sb() filesystem op instead, prior to calling kill_anon_super().
-
-This makes the struct autofs_sb_info::root member variable redundant (since
-sb->s_root is still available), and so that is removed. The calls to
-shrink_dcache_sb() are also removed since they're also redundant as
-shrink_dcache_for_umount() will now be called after the cleanup routine.
-
-Signed-Off-By: David Howells <dhowells at redhat.com>
-Acked-by: Ian Kent <raven at themaw.net>
----
-
- fs/autofs4/autofs_i.h | 3 +--
- fs/autofs4/init.c | 2 +-
- fs/autofs4/inode.c | 22 ++++------------------
- fs/autofs4/waitq.c | 1 -
- 4 files changed, 6 insertions(+), 22 deletions(-)
+ /* only used at mount-time */
-Index: latest/fs/autofs4/autofs_i.h
-===================================================================
---- latest.orig/fs/autofs4/autofs_i.h
-+++ latest/fs/autofs4/autofs_i.h
-@@ -96,7 +96,6 @@ struct autofs_wait_queue {
-
- struct autofs_sb_info {
- u32 magic;
-- struct dentry *root;
- int pipefd;
- struct file *pipe;
- pid_t oz_pgrp;
-@@ -231,4 +230,4 @@ out:
- }
-
- void autofs4_dentry_release(struct dentry *);
--
-+extern void autofs4_kill_sb(struct super_block *);
-Index: latest/fs/autofs4/init.c
-===================================================================
---- latest.orig/fs/autofs4/init.c
-+++ latest/fs/autofs4/init.c
-@@ -24,7 +24,7 @@ static struct file_system_type autofs_fs
- .owner = THIS_MODULE,
- .name = "autofs",
- .get_sb = autofs_get_sb,
-- .kill_sb = kill_anon_super,
-+ .kill_sb = autofs4_kill_sb,
- };
-
- static int __init init_autofs4_fs(void)
-Index: latest/fs/autofs4/inode.c
-===================================================================
---- latest.orig/fs/autofs4/inode.c
-+++ latest/fs/autofs4/inode.c
-@@ -95,7 +95,7 @@ void autofs4_free_ino(struct autofs_info
- */
- static void autofs4_force_release(struct autofs_sb_info *sbi)
- {
-- struct dentry *this_parent = sbi->root;
-+ struct dentry *this_parent = sbi->sb->s_root;
- struct list_head *next;
-
- spin_lock(&dcache_lock);
-@@ -126,7 +126,7 @@ resume:
- spin_lock(&dcache_lock);
- }
-
-- if (this_parent != sbi->root) {
-+ if (this_parent != sbi->sb->s_root) {
- struct dentry *dentry = this_parent;
-
- next = this_parent->d_u.d_child.next;
-@@ -139,15 +139,9 @@ resume:
- goto resume;
- }
- spin_unlock(&dcache_lock);
--
-- dput(sbi->root);
-- sbi->root = NULL;
-- shrink_dcache_sb(sbi->sb);
--
-- return;
- }
-
--static void autofs4_put_super(struct super_block *sb)
-+void autofs4_kill_sb(struct super_block *sb)
- {
- struct autofs_sb_info *sbi = autofs4_sbi(sb);
-
-@@ -162,6 +156,7 @@ static void autofs4_put_super(struct sup
- kfree(sbi);
-
- DPRINTK("shutting down");
-+ kill_anon_super(sb);
- }
-
- static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
-@@ -188,7 +183,6 @@ static int autofs4_show_options(struct s
- }
-
- static struct super_operations autofs4_sops = {
-- .put_super = autofs4_put_super,
- .statfs = simple_statfs,
- .show_options = autofs4_show_options,
- };
-@@ -314,7 +308,6 @@ int autofs4_fill_super(struct super_bloc
-
- s->s_fs_info = sbi;
- sbi->magic = AUTOFS_SBI_MAGIC;
-- sbi->root = NULL;
- sbi->pipefd = -1;
- sbi->catatonic = 0;
- sbi->exp_timeout = 0;
-@@ -396,13 +389,6 @@ int autofs4_fill_super(struct super_bloc
- sbi->pipefd = pipefd;
-
- /*
-- * Take a reference to the root dentry so we get a chance to
-- * clean up the dentry tree on umount.
-- * See autofs4_force_release.
-- */
-- sbi->root = dget(root);
--
-- /*
- * Success! Install the root dentry now to indicate completion.
- */
- s->s_root = root;
-Index: latest/fs/autofs4/waitq.c
-===================================================================
---- latest.orig/fs/autofs4/waitq.c
-+++ latest/fs/autofs4/waitq.c
-@@ -45,7 +45,6 @@ void autofs4_catatonic_mode(struct autof
- fput(sbi->pipe); /* Close the pipe */
- sbi->pipe = NULL;
- }
-- shrink_dcache_sb(sbi->sb);
- }
-
- static int autofs4_write(struct file *file, const void *addr, int bytes)
linux-2.6-nfs-superblock-sharing.patch:
b/fs/Kconfig | 7
b/fs/dcache.c | 164 +++-
b/fs/nfs/Makefile | 6
b/fs/nfs/callback.c | 15
b/fs/nfs/callback.h | 7
b/fs/nfs/callback_proc.c | 4
b/fs/nfs/client.c | 312 ++++++++
b/fs/nfs/delegation.c | 24
b/fs/nfs/delegation.h | 10
b/fs/nfs/dir.c | 2
b/fs/nfs/file.c | 2
b/fs/nfs/fscache.c | 346 +++++++++
b/fs/nfs/fscache.h | 466 ++++++++++++
b/fs/nfs/getroot.c | 306 ++++++++
b/fs/nfs/idmap.c | 14
b/fs/nfs/inode.c | 4
b/fs/nfs/internal.h | 12
b/fs/nfs/namespace.c | 3
b/fs/nfs/nfs3proc.c | 2
b/fs/nfs/nfs4_fs.h | 30
b/fs/nfs/nfs4namespace.c | 8
b/fs/nfs/nfs4proc.c | 32
b/fs/nfs/nfs4renewd.c | 8
b/fs/nfs/nfs4state.c | 50 -
b/fs/nfs/nfs4xdr.c | 14
b/fs/nfs/pagelist.c | 3
b/fs/nfs/proc.c | 2
b/fs/nfs/read.c | 2
b/fs/nfs/super.c | 40 -
b/fs/nfs/sysctl.c | 43 +
b/fs/nfs/write.c | 2
b/include/linux/dcache.h | 1
b/include/linux/nfs4_mount.h | 1
b/include/linux/nfs_fs.h | 1
b/include/linux/nfs_fs_sb.h | 2
b/include/linux/nfs_idmap.h | 14
b/include/linux/nfs_mount.h | 1
b/include/linux/nfs_xdr.h | 1
fs/nfs/Makefile | 3
fs/nfs/callback.c | 16
fs/nfs/callback_proc.c | 9
fs/nfs/client.c | 1152 ++++++++++++++++++++++++++++++
fs/nfs/delegation.c | 21
fs/nfs/dir.c | 16
fs/nfs/file.c | 33
fs/nfs/getroot.c | 5
fs/nfs/idmap.c | 27
fs/nfs/inode.c | 31
fs/nfs/internal.h | 134 ++-
fs/nfs/namespace.c | 31
fs/nfs/nfs3proc.c | 8
fs/nfs/nfs4_fs.h | 58 -
fs/nfs/nfs4namespace.c | 110 ++
fs/nfs/nfs4proc.c | 149 +--
fs/nfs/nfs4renewd.c | 15
fs/nfs/nfs4state.c | 156 ----
fs/nfs/nfs4xdr.c | 28
fs/nfs/proc.c | 4
fs/nfs/read.c | 30
fs/nfs/super.c | 1630 +++++++++++++++----------------------------
fs/nfs/write.c | 11
include/linux/nfs_fs.h | 7
include/linux/nfs_fs_sb.h | 99 ++
include/linux/nfs_idmap.h | 2
include/linux/nfs_xdr.h | 9
65 files changed, 4086 insertions(+), 1669 deletions(-)
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.1 -r 1.2 linux-2.6-nfs-superblock-sharing.patch
Index: linux-2.6-nfs-superblock-sharing.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-nfs-superblock-sharing.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-nfs-superblock-sharing.patch 20 Jul 2006 00:27:30 -0000 1.1
+++ linux-2.6-nfs-superblock-sharing.patch 28 Jul 2006 21:41:06 -0000 1.2
@@ -1,6 +1,6 @@
-Date: Fri, 14 Jul 2006 16:50:38 +0100
+Date: Thu, 27 Jul 2006 19:52:48 +0100
From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 01/28] NFS: Add dentry materialisation op
+Subject: [RHEL5 PATCH 01/30] NFS: Add dentry materialisation op
The attached patch adds a new directory cache management function that prepares
a disconnected anonymous function to be connected into the dentry tree. The
@@ -40,11 +40,11 @@
include/linux/dcache.h | 1
2 files changed, 151 insertions(+), 14 deletions(-)
-Index: latest/fs/dcache.c
-===================================================================
---- latest.orig/fs/dcache.c
-+++ latest/fs/dcache.c
-@@ -833,17 +833,19 @@ void d_instantiate(struct dentry *entry,
+diff --git a/fs/dcache.c b/fs/dcache.c
+index 1b4a3a3..17b392a 100644
+--- a/fs/dcache.c
++++ b/fs/dcache.c
+@@ -828,17 +828,19 @@ void d_instantiate(struct dentry *entry,
* (or otherwise set) by the caller to indicate that it is now
* in use by the dcache.
*/
@@ -69,7 +69,7 @@
list_for_each_entry(alias, &inode->i_dentry, d_alias) {
struct qstr *qstr = &alias->d_name;
-@@ -856,19 +858,35 @@ struct dentry *d_instantiate_unique(stru
+@@ -851,19 +853,35 @@ struct dentry *d_instantiate_unique(stru
if (memcmp(qstr->name, name, len))
continue;
dget_locked(alias);
@@ -111,7 +111,7 @@
EXPORT_SYMBOL(d_instantiate_unique);
/**
-@@ -1240,6 +1258,11 @@ static void __d_rehash(struct dentry * e
+@@ -1235,6 +1253,11 @@ static void __d_rehash(struct dentry * e
hlist_add_head_rcu(&entry->d_hash, list);
}
@@ -123,7 +123,7 @@
/**
* d_rehash - add an entry back to the hash
* @entry: dentry to add to the hash
-@@ -1249,11 +1272,9 @@ static void __d_rehash(struct dentry * e
+@@ -1244,11 +1267,9 @@ static void __d_rehash(struct dentry * e
void d_rehash(struct dentry * entry)
{
@@ -136,7 +136,7 @@
spin_unlock(&entry->d_lock);
spin_unlock(&dcache_lock);
}
-@@ -1401,6 +1422,120 @@ already_unhashed:
+@@ -1386,6 +1407,120 @@ already_unhashed:
spin_unlock(&dcache_lock);
}
@@ -257,7 +257,7 @@
/**
* d_path - return the path of a dentry
* @dentry: dentry to report
-@@ -1818,6 +1953,7 @@ EXPORT_SYMBOL(d_instantiate);
+@@ -1784,6 +1919,7 @@ EXPORT_SYMBOL(d_instantiate);
EXPORT_SYMBOL(d_invalidate);
EXPORT_SYMBOL(d_lookup);
EXPORT_SYMBOL(d_move);
@@ -265,11 +265,11 @@
EXPORT_SYMBOL(d_path);
EXPORT_SYMBOL(d_prune_aliases);
EXPORT_SYMBOL(d_rehash);
-Index: latest/include/linux/dcache.h
-===================================================================
---- latest.orig/include/linux/dcache.h
-+++ latest/include/linux/dcache.h
-@@ -222,6 +222,7 @@ static inline int dname_external(struct
+diff --git a/include/linux/dcache.h b/include/linux/dcache.h
+index 471781f..44605be 100644
+--- a/include/linux/dcache.h
++++ b/include/linux/dcache.h
+@@ -221,6 +221,7 @@ static inline int dname_external(struct
*/
extern void d_instantiate(struct dentry *, struct inode *);
extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
@@ -277,9 +277,10 @@
extern void d_delete(struct dentry *);
/* allocate/de-allocate */
-Date: Fri, 14 Jul 2006 16:50:40 +0100
+
+Date: Thu, 27 Jul 2006 19:52:50 +0100
From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 02/28] NFS: Fix up split of fs/nfs/inode.c
+Subject: [RHEL5 PATCH 02/30] NFS: Fix up split of fs/nfs/inode.c
Fix ups for the splitting of the superblock stuff out of fs/nfs/inode.c,
including:
@@ -312,10 +313,10 @@
fs/nfs/super.c | 40 ++++------------------------------------
4 files changed, 39 insertions(+), 42 deletions(-)
-Index: latest/fs/nfs/callback.c
-===================================================================
---- latest.orig/fs/nfs/callback.c
-+++ latest/fs/nfs/callback.c
+diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
+index fe0a6b8..d6c4bae 100644
+--- a/fs/nfs/callback.c
++++ b/fs/nfs/callback.c
@@ -36,6 +36,21 @@ static struct svc_program nfs4_callback_
unsigned int nfs_callback_set_tcpport;
@@ -338,11 +339,11 @@
/*
* This is the callback kernel thread.
-Index: latest/fs/nfs/idmap.c
-===================================================================
---- latest.orig/fs/nfs/idmap.c
-+++ latest/fs/nfs/idmap.c
-@@ -57,6 +57,20 @@
+diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
+index b81e7ed..447ae91 100644
+--- a/fs/nfs/idmap.c
++++ b/fs/nfs/idmap.c
+@@ -57,6 +57,20 @@ #define IDMAP_HASH_SZ 128
/* Default cache timeout is 10 minutes */
unsigned int nfs_idmap_cache_timeout = 600 * HZ;
@@ -363,10 +364,10 @@
struct idmap_hashent {
unsigned long ih_expires;
__u32 ih_id;
-Index: latest/fs/nfs/internal.h
-===================================================================
---- latest.orig/fs/nfs/internal.h
-+++ latest/fs/nfs/internal.h
+diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
+index e4f4e5d..94a7870 100644
+--- a/fs/nfs/internal.h
++++ b/fs/nfs/internal.h
@@ -15,7 +15,7 @@ struct nfs_clone_mount {
rpc_authflavor_t authflavor;
};
@@ -376,7 +377,7 @@
#ifdef CONFIG_NFS_V4
extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry);
#else
-@@ -46,6 +46,7 @@ extern void nfs_destroy_directcache(void
+@@ -46,6 +46,7 @@ #define nfs_destroy_directcache() do {}
#endif
/* nfs2xdr.c */
@@ -413,10 +414,10 @@
/*
* Determine the device name as a string
-Index: latest/fs/nfs/super.c
-===================================================================
---- latest.orig/fs/nfs/super.c
-+++ latest/fs/nfs/super.c
+diff --git a/fs/nfs/super.c b/fs/nfs/super.c
+index e8a9bee..1c20ff0 100644
+--- a/fs/nfs/super.c
++++ b/fs/nfs/super.c
@@ -187,40 +187,6 @@ static struct super_operations nfs4_sops
};
#endif
@@ -480,9 +481,10 @@
if (IS_ERR(s)) {
error = PTR_ERR(s);
goto out_free;
-Date: Fri, 14 Jul 2006 16:50:42 +0100
+
+Date: Thu, 27 Jul 2006 19:52:53 +0100
From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 03/28] NFS: Disambiguate nfs_stat_to_errno()
+Subject: [RHEL5 PATCH 03/30] NFS: Disambiguate nfs_stat_to_errno()
Rename the NFS4 version of nfs_stat_to_errno() so that it doesn't conflict with
the common one used by NFS2 and NFS3.
@@ -493,11 +495,11 @@
fs/nfs/nfs4xdr.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
-Index: latest/fs/nfs/nfs4xdr.c
-===================================================================
---- latest.orig/fs/nfs/nfs4xdr.c
[...4045 lines suppressed...]
+index 7b266b7..f54315e 100644
+--- a/fs/nfs/super.c
++++ b/fs/nfs/super.c
+@@ -286,6 +286,7 @@ static void nfs_show_mount_options(struc
+ { NFS_MOUNT_NOAC, ",noac", "" },
+ { NFS_MOUNT_NONLM, ",nolock", "" },
+ { NFS_MOUNT_NOACL, ",noacl", "" },
++ { NFS_MOUNT_FSCACHE, ",fsc", "" },
+ { 0, NULL, NULL }
+ };
+ const struct proc_nfs_info *nfs_infop;
+diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
+index 2fe3403..7a25a6d 100644
+--- a/fs/nfs/sysctl.c
++++ b/fs/nfs/sysctl.c
+@@ -14,6 +14,7 @@ #include <linux/nfs_idmap.h>
+ #include <linux/nfs_fs.h>
+
+ #include "callback.h"
++#include "internal.h"
+
+ static const int nfs_set_port_min = 0;
+ static const int nfs_set_port_max = 65535;
+@@ -55,6 +56,48 @@ #endif
+ .proc_handler = &proc_dointvec_jiffies,
+ .strategy = &sysctl_jiffies,
+ },
++#ifdef CONFIG_NFS_FSCACHE
++ {
++ .ctl_name = CTL_UNNUMBERED,
++ .procname = "fscache_from_error",
++ .data = &nfs_fscache_from_error,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = &proc_dointvec,
++ },
++ {
++ .ctl_name = CTL_UNNUMBERED,
++ .procname = "fscache_to_error",
++ .data = &nfs_fscache_to_error,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = &proc_dointvec,
++ },
++ {
++ .ctl_name = CTL_UNNUMBERED,
++ .procname = "fscache_uncache_page",
++ .data = &nfs_fscache_uncache_page,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = &proc_dointvec,
++ },
++ {
++ .ctl_name = CTL_UNNUMBERED,
++ .procname = "fscache_to_pages",
++ .data = &nfs_fscache_to_pages,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = &proc_dointvec_minmax,
++ },
++ {
++ .ctl_name = CTL_UNNUMBERED,
++ .procname = "fscache_from_pages",
++ .data = &nfs_fscache_from_pages,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = &proc_dointvec,
++ },
++#endif
+ { .ctl_name = 0 }
+ };
+
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c
+index a3f3f04..cd8d972 100644
+--- a/fs/nfs/write.c
++++ b/fs/nfs/write.c
+@@ -63,6 +63,7 @@ #include <linux/smp_lock.h>
+
+ #include "delegation.h"
+ #include "iostat.h"
++#include "internal.h"
+
+ #define NFSDBG_FACILITY NFSDBG_PAGECACHE
+
+@@ -163,6 +164,9 @@ static void nfs_grow_file(struct page *p
+ return;
+ nfs_inc_stats(inode, NFSIOS_EXTENDWRITE);
+ i_size_write(inode, end);
++#ifdef FSCACHE_WRITE_SUPPORT
++ nfs_set_fscsize(NFS_SERVER(inode), NFS_I(inode), end);
++#endif
+ }
+
+ /* We can set the PG_uptodate flag if we see that a write request
+@@ -342,6 +346,9 @@ do_it:
+ err = -EBADF;
+ goto out;
+ }
++
++ nfs_writepage_to_fscache(inode, page);
++
+ lock_kernel();
+ if (!IS_SYNC(inode) && inode_referenced) {
+ err = nfs_writepage_async(ctx, inode, page, 0, offset);
+@@ -424,7 +431,7 @@ static int nfs_inode_add_request(struct
+ if (nfs_have_delegation(inode, FMODE_WRITE))
+ nfsi->change_attr++;
+ }
+- SetPagePrivate(req->wb_page);
++ SetPageNfsWriting(req->wb_page);
+ nfsi->npages++;
+ atomic_inc(&req->wb_count);
+ return 0;
+@@ -441,7 +448,7 @@ static void nfs_inode_remove_request(str
+ BUG_ON (!NFS_WBACK_BUSY(req));
+
+ spin_lock(&nfsi->req_lock);
+- ClearPagePrivate(req->wb_page);
++ ClearPageNfsWriting(req->wb_page);
+ radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index);
+ nfsi->npages--;
+ if (!nfsi->npages) {
+diff --git a/include/linux/nfs4_mount.h b/include/linux/nfs4_mount.h
+index 26b4c83..15199cc 100644
+--- a/include/linux/nfs4_mount.h
++++ b/include/linux/nfs4_mount.h
+@@ -65,6 +65,7 @@ #define NFS4_MOUNT_INTR 0x0002 /* 1 */
+ #define NFS4_MOUNT_NOCTO 0x0010 /* 1 */
+ #define NFS4_MOUNT_NOAC 0x0020 /* 1 */
+ #define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */
++#define NFS4_MOUNT_FSCACHE 0x4000 /* 1 */
+ #define NFS4_MOUNT_FLAGMASK 0xFFFF
+
+ #endif
+diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
+index b7b4371..71cf935 100644
+--- a/include/linux/nfs_fs.h
++++ b/include/linux/nfs_fs.h
+@@ -29,6 +29,7 @@ #include <linux/nfs_fs_sb.h>
+
+ #include <linux/rwsem.h>
+ #include <linux/mempool.h>
++#include <linux/fscache.h>
+
+ /*
+ * Enable debugging support for nfs client.
+@@ -180,6 +181,9 @@ #ifdef CONFIG_NFS_V4
+ int delegation_state;
+ struct rw_semaphore rwsem;
+ #endif /* CONFIG_NFS_V4*/
++#ifdef CONFIG_NFS_FSCACHE
++ struct fscache_cookie *fscache;
++#endif
+ struct inode vfs_inode;
+ };
+
+@@ -582,6 +586,7 @@ #define NFSDBG_FILE 0x0040
+ #define NFSDBG_ROOT 0x0080
+ #define NFSDBG_CALLBACK 0x0100
+ #define NFSDBG_CLIENT 0x0200
++#define NFSDBG_FSCACHE 0x0400
+ #define NFSDBG_ALL 0xFFFF
+
+ #ifdef __KERNEL__
+diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
+index 6d0be0e..54221e0 100644
+--- a/include/linux/nfs_fs_sb.h
++++ b/include/linux/nfs_fs_sb.h
+@@ -3,6 +3,7 @@ #define _NFS_FS_SB
+
+ #include <linux/list.h>
+ #include <linux/backing-dev.h>
++#include <linux/fscache.h>
+
+ struct nfs_iostats;
+
+@@ -66,6 +67,10 @@ #ifdef CONFIG_NFS_V4
+ char cl_ipaddr[16];
+ unsigned char cl_id_uniquifier;
+ #endif
++
++#ifdef CONFIG_NFS_FSCACHE
++ struct fscache_cookie *fscache; /* client index cache cookie */
++#endif
+ };
+
+ /*
+diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
+index 659c754..278bb4e 100644
+--- a/include/linux/nfs_mount.h
++++ b/include/linux/nfs_mount.h
+@@ -61,6 +61,7 @@ #define NFS_MOUNT_BROKEN_SUID 0x0400 /*
+ #define NFS_MOUNT_NOACL 0x0800 /* 4 */
+ #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
+ #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
++#define NFS_MOUNT_FSCACHE 0x4000
+ #define NFS_MOUNT_FLAGMASK 0xFFFF
+
+ #endif
+
linux-2.6-filesystem-caching-for-afs-and-nfs.patch:
b/Documentation/filesystems/caching/backend-api.txt | 357 ++++++
b/Documentation/filesystems/caching/fscache.txt | 151 ++
b/Documentation/filesystems/caching/netfs-api.txt | 752 ++++++++++++++
b/fs/Kconfig | 15
b/fs/Makefile | 1
b/fs/afs/cell.c | 109 +-
b/fs/afs/cell.h | 16
b/fs/afs/cmservice.c | 2
b/fs/afs/dir.c | 5
b/fs/afs/file.c | 246 +++-
b/fs/afs/fsclient.c | 4
b/fs/afs/inode.c | 45
b/fs/afs/internal.h | 25
b/fs/afs/main.c | 24
b/fs/afs/mntpt.c | 12
b/fs/afs/proc.c | 1
b/fs/afs/server.c | 3
b/fs/afs/vlocation.c | 179 ++-
b/fs/afs/vnode.c | 248 +++-
b/fs/afs/vnode.h | 10
b/fs/afs/volume.c | 78 -
b/fs/afs/volume.h | 28
b/fs/ext2/dir.c | 6
b/fs/ext3/inode.c | 10
b/fs/freevxfs/vxfs_subr.c | 2
b/fs/fscache/Makefile | 11
b/fs/fscache/cookie.c | 1045 ++++++++++++++++++++
b/fs/fscache/fscache-int.h | 93 +
b/fs/fscache/fsdef.c | 110 ++
b/fs/fscache/main.c | 105 ++
b/fs/fscache/page.c | 537 ++++++++++
b/fs/reiserfs/inode.c | 10
b/fs/ufs/dir.c | 6
b/include/linux/fscache-cache.h | 243 ++++
b/include/linux/fscache.h | 496 +++++++++
b/include/linux/page-flags.h | 15
b/include/linux/pagemap.h | 11
b/mm/filemap.c | 17
b/mm/migrate.c | 4
b/mm/page_alloc.c | 2
b/mm/readahead.c | 25
fs/Kconfig | 7
fs/afs/cache.h | 27
fs/afs/dir.c | 10
44 files changed, 4660 insertions(+), 443 deletions(-)
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.1 -r 1.2 linux-2.6-filesystem-caching-for-afs-and-nfs.patch
Index: linux-2.6-filesystem-caching-for-afs-and-nfs.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-filesystem-caching-for-afs-and-nfs.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-filesystem-caching-for-afs-and-nfs.patch 20 Jul 2006 00:27:30 -0000 1.1
+++ linux-2.6-filesystem-caching-for-afs-and-nfs.patch 28 Jul 2006 21:41:06 -0000 1.2
@@ -1,6 +1,6 @@
-Date: Fri, 14 Jul 2006 16:51:20 +0100
+Date: Thu, 27 Jul 2006 19:53:35 +0100
From: David Howells <dhowells at redhat.com>
-Subject: [RHEL5 PATCH 20/28] FS-Cache: Provide a filesystem-specific sync'able page bit
+Subject: [RHEL5 PATCH 22/30] FS-Cache: Provide a filesystem-specific sync'able page bit
The attached patch provides a filesystem-specific page bit that a filesystem
can synchronise upon. This can be used, for example, by a netfs to synchronise
@@ -28,11 +28,11 @@
mm/page_alloc.c | 2 +-
11 files changed, 59 insertions(+), 29 deletions(-)
-Index: latest/fs/afs/dir.c
-===================================================================
---- latest.orig/fs/afs/dir.c
-+++ latest/fs/afs/dir.c
-@@ -155,11 +155,9 @@ static inline void afs_dir_check_page(st
+diff --git a/fs/afs/dir.c b/fs/afs/dir.c
+index 2fc9987..3b78e70 100644
+--- a/fs/afs/dir.c
++++ b/fs/afs/dir.c
+@@ -155,11 +155,9 @@ #endif
}
}
@@ -54,10 +54,10 @@
if (PageError(page))
goto fail;
}
-Index: latest/fs/ext2/dir.c
-===================================================================
---- latest.orig/fs/ext2/dir.c
-+++ latest/fs/ext2/dir.c
+diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
+index 92ea826..b0e7d9f 100644
+--- a/fs/ext2/dir.c
++++ b/fs/ext2/dir.c
@@ -112,7 +112,7 @@ static void ext2_check_page(struct page
if (offs != limit)
goto Eend;
@@ -85,10 +85,10 @@
ext2_check_page(page);
if (PageError(page))
goto fail;
-Index: latest/fs/ext3/inode.c
-===================================================================
---- latest.orig/fs/ext3/inode.c
-+++ latest/fs/ext3/inode.c
+diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
+index f804d5e..8073fc9 100644
+--- a/fs/ext3/inode.c
++++ b/fs/ext3/inode.c
@@ -1527,12 +1527,12 @@ static int ext3_journalled_writepage(str
goto no_write;
}
@@ -131,10 +131,10 @@
return __set_page_dirty_nobuffers(page);
}
-Index: latest/fs/freevxfs/vxfs_subr.c
-===================================================================
---- latest.orig/fs/freevxfs/vxfs_subr.c
-+++ latest/fs/freevxfs/vxfs_subr.c
+diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c
+index decac62..805bbb2 100644
+--- a/fs/freevxfs/vxfs_subr.c
++++ b/fs/freevxfs/vxfs_subr.c
@@ -78,7 +78,7 @@ vxfs_get_page(struct address_space *mapp
kmap(pp);
if (!PageUptodate(pp))
@@ -144,11 +144,11 @@
/** vxfs_check_page(pp); **/
if (PageError(pp))
goto fail;
-Index: latest/fs/reiserfs/inode.c
-===================================================================
---- latest.orig/fs/reiserfs/inode.c
-+++ latest/fs/reiserfs/inode.c
-@@ -2347,7 +2347,7 @@ static int reiserfs_write_full_page(stru
+diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
+index 12dfdcf..df64f04 100644
+--- a/fs/reiserfs/inode.c
++++ b/fs/reiserfs/inode.c
+@@ -2351,7 +2351,7 @@ static int reiserfs_write_full_page(stru
struct buffer_head *head, *bh;
int partial = 0;
int nr = 0;
@@ -157,7 +157,7 @@
struct reiserfs_transaction_handle th;
struct super_block *s = inode->i_sb;
int bh_per_page = PAGE_CACHE_SIZE / s->s_blocksize;
-@@ -2416,7 +2416,7 @@ static int reiserfs_write_full_page(stru
+@@ -2420,7 +2420,7 @@ static int reiserfs_write_full_page(stru
* blocks we're going to log
*/
if (checked) {
@@ -166,7 +166,7 @@
reiserfs_write_lock(s);
error = journal_begin(&th, s, bh_per_page + 1);
if (error) {
-@@ -2797,7 +2797,7 @@ static void reiserfs_invalidatepage(stru
+@@ -2801,7 +2801,7 @@ static void reiserfs_invalidatepage(stru
BUG_ON(!PageLocked(page));
if (offset == 0)
@@ -175,7 +175,7 @@
if (!page_has_buffers(page))
goto out;
-@@ -2838,7 +2838,7 @@ static int reiserfs_set_page_dirty(struc
+@@ -2842,7 +2842,7 @@ static int reiserfs_set_page_dirty(struc
{
struct inode *inode = page->mapping->host;
if (reiserfs_file_data_log(inode)) {
@@ -184,7 +184,7 @@
return __set_page_dirty_nobuffers(page);
}
return __set_page_dirty_buffers(page);
-@@ -2861,7 +2861,7 @@ static int reiserfs_releasepage(struct p
+@@ -2865,7 +2865,7 @@ static int reiserfs_releasepage(struct p
struct buffer_head *bh;
int ret = 1;
@@ -193,10 +193,10 @@
spin_lock(&j->j_dirty_buffers_lock);
head = page_buffers(page);
bh = head;
-Index: latest/fs/ufs/dir.c
-===================================================================
---- latest.orig/fs/ufs/dir.c
-+++ latest/fs/ufs/dir.c
+diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
+index 7f0a0aa..e04327c 100644
+--- a/fs/ufs/dir.c
++++ b/fs/ufs/dir.c
@@ -135,7 +135,7 @@ static void ufs_check_page(struct page *
if (offs != limit)
goto Eend;
@@ -224,11 +224,11 @@
ufs_check_page(page);
if (PageError(page))
goto fail;
-Index: latest/include/linux/page-flags.h
-===================================================================
---- latest.orig/include/linux/page-flags.h
-+++ latest/include/linux/page-flags.h
-@@ -71,7 +71,7 @@
+diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
+index 5748642..6e017b7 100644
+--- a/include/linux/page-flags.h
++++ b/include/linux/page-flags.h
+@@ -71,7 +71,7 @@ #define PG_lru 5
#define PG_active 6
#define PG_slab 7 /* slab debug (Suparna wants this) */
@@ -237,7 +237,7 @@
#define PG_arch_1 9
#define PG_reserved 10
#define PG_private 11 /* Has something at ->private */
-@@ -161,10 +161,6 @@
+@@ -161,10 +161,6 @@ #else
#define PageHighMem(page) 0 /* needed to optimize away at compile time */
#endif
@@ -262,10 +262,10 @@
+#define TestClearPageFsMisc(page) test_and_clear_bit(PG_fs_misc, &(page)->flags)
+
#endif /* PAGE_FLAGS_H */
-Index: latest/include/linux/pagemap.h
-===================================================================
---- latest.orig/include/linux/pagemap.h
-+++ latest/include/linux/pagemap.h
+diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
+index 0a2f5d2..82b2753 100644
+--- a/include/linux/pagemap.h
++++ b/include/linux/pagemap.h
@@ -170,6 +170,17 @@ static inline void wait_on_page_writebac
extern void end_page_writeback(struct page *page);
@@ -284,11 +284,11 @@
* Fault a userspace page into pagetables. Return non-zero on a fault.
*
* This assumes that two userspace pages are always sufficient. That's
-Index: latest/mm/filemap.c
-===================================================================
---- latest.orig/mm/filemap.c
-+++ latest/mm/filemap.c
-@@ -584,6 +584,23 @@ void fastcall __lock_page(struct page *p
+diff --git a/mm/filemap.c b/mm/filemap.c
+index d087fc3..c71d8fd 100644
+--- a/mm/filemap.c
[...2598 lines suppressed...]
-Index: latest/fs/nfs/super.c
-===================================================================
---- latest.orig/fs/nfs/super.c
-+++ latest/fs/nfs/super.c
-@@ -286,6 +286,7 @@ static void nfs_show_mount_options(struc
- { NFS_MOUNT_NOAC, ",noac", "" },
- { NFS_MOUNT_NONLM, ",nolock", "" },
- { NFS_MOUNT_NOACL, ",noacl", "" },
-+ { NFS_MOUNT_FSCACHE, ",fsc", "" },
- { 0, NULL, NULL }
- };
- const struct proc_nfs_info *nfs_infop;
-Index: latest/fs/nfs/sysctl.c
-===================================================================
---- latest.orig/fs/nfs/sysctl.c
-+++ latest/fs/nfs/sysctl.c
-@@ -14,6 +14,7 @@
- #include <linux/nfs_fs.h>
-
- #include "callback.h"
-+#include "internal.h"
-
- static const int nfs_set_port_min = 0;
- static const int nfs_set_port_max = 65535;
-@@ -55,6 +56,48 @@ static ctl_table nfs_cb_sysctls[] = {
- .proc_handler = &proc_dointvec_jiffies,
- .strategy = &sysctl_jiffies,
- },
-+#ifdef CONFIG_NFS_FSCACHE
-+ {
-+ .ctl_name = CTL_UNNUMBERED,
-+ .procname = "fscache_from_error",
-+ .data = &nfs_fscache_from_error,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = CTL_UNNUMBERED,
-+ .procname = "fscache_to_error",
-+ .data = &nfs_fscache_to_error,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = CTL_UNNUMBERED,
-+ .procname = "fscache_uncache_page",
-+ .data = &nfs_fscache_uncache_page,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+ {
-+ .ctl_name = CTL_UNNUMBERED,
-+ .procname = "fscache_to_pages",
-+ .data = &nfs_fscache_to_pages,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec_minmax,
-+ },
-+ {
-+ .ctl_name = CTL_UNNUMBERED,
-+ .procname = "fscache_from_pages",
-+ .data = &nfs_fscache_from_pages,
-+ .maxlen = sizeof(int),
-+ .mode = 0644,
-+ .proc_handler = &proc_dointvec,
-+ },
-+#endif
- { .ctl_name = 0 }
- };
-
-Index: latest/fs/nfs/write.c
-===================================================================
---- latest.orig/fs/nfs/write.c
-+++ latest/fs/nfs/write.c
-@@ -63,6 +63,7 @@
-
- #include "delegation.h"
- #include "iostat.h"
-+#include "internal.h"
-
- #define NFSDBG_FACILITY NFSDBG_PAGECACHE
-
-@@ -163,6 +164,9 @@ static void nfs_grow_file(struct page *p
- return;
- nfs_inc_stats(inode, NFSIOS_EXTENDWRITE);
- i_size_write(inode, end);
-+#ifdef FSCACHE_WRITE_SUPPORT
-+ nfs_set_fscsize(NFS_SERVER(inode), NFS_I(inode), end);
-+#endif
- }
-
- /* We can set the PG_uptodate flag if we see that a write request
-@@ -342,6 +346,9 @@ do_it:
- err = -EBADF;
- goto out;
- }
-+
-+ nfs_writepage_to_fscache(inode, page);
-+
- lock_kernel();
- if (!IS_SYNC(inode) && inode_referenced) {
- err = nfs_writepage_async(ctx, inode, page, 0, offset);
-@@ -424,7 +431,7 @@ static int nfs_inode_add_request(struct
- if (nfs_have_delegation(inode, FMODE_WRITE))
- nfsi->change_attr++;
- }
-- SetPagePrivate(req->wb_page);
-+ SetPageNfsWriting(req->wb_page);
- nfsi->npages++;
- atomic_inc(&req->wb_count);
- return 0;
-@@ -441,7 +448,7 @@ static void nfs_inode_remove_request(str
- BUG_ON (!NFS_WBACK_BUSY(req));
-
- spin_lock(&nfsi->req_lock);
-- ClearPagePrivate(req->wb_page);
-+ ClearPageNfsWriting(req->wb_page);
- radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index);
- nfsi->npages--;
- if (!nfsi->npages) {
-Index: latest/include/linux/nfs4_mount.h
-===================================================================
---- latest.orig/include/linux/nfs4_mount.h
-+++ latest/include/linux/nfs4_mount.h
-@@ -65,6 +65,7 @@ struct nfs4_mount_data {
- #define NFS4_MOUNT_NOCTO 0x0010 /* 1 */
- #define NFS4_MOUNT_NOAC 0x0020 /* 1 */
- #define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */
-+#define NFS4_MOUNT_FSCACHE 0x4000 /* 1 */
- #define NFS4_MOUNT_FLAGMASK 0xFFFF
-
- #endif
-Index: latest/include/linux/nfs_fs.h
-===================================================================
---- latest.orig/include/linux/nfs_fs.h
-+++ latest/include/linux/nfs_fs.h
-@@ -29,6 +29,7 @@
-
- #include <linux/rwsem.h>
- #include <linux/mempool.h>
-+#include <linux/fscache.h>
-
- /*
- * Enable debugging support for nfs client.
-@@ -180,6 +181,9 @@ struct nfs_inode {
- int delegation_state;
- struct rw_semaphore rwsem;
- #endif /* CONFIG_NFS_V4*/
-+#ifdef CONFIG_NFS_FSCACHE
-+ struct fscache_cookie *fscache;
-+#endif
- struct inode vfs_inode;
- };
-
-@@ -582,6 +586,7 @@ extern void * nfs_root_data(void);
- #define NFSDBG_ROOT 0x0080
- #define NFSDBG_CALLBACK 0x0100
- #define NFSDBG_CLIENT 0x0200
-+#define NFSDBG_FSCACHE 0x0400
- #define NFSDBG_ALL 0xFFFF
-
- #ifdef __KERNEL__
-Index: latest/include/linux/nfs_fs_sb.h
-===================================================================
---- latest.orig/include/linux/nfs_fs_sb.h
-+++ latest/include/linux/nfs_fs_sb.h
-@@ -3,6 +3,7 @@
-
- #include <linux/list.h>
- #include <linux/backing-dev.h>
-+#include <linux/fscache.h>
-
- struct nfs_iostats;
-
-@@ -66,6 +67,10 @@ struct nfs_client {
- char cl_ipaddr[16];
- unsigned char cl_id_uniquifier;
- #endif
-+
-+#ifdef CONFIG_NFS_FSCACHE
-+ struct fscache_cookie *fscache; /* client index cache cookie */
-+#endif
- };
-
- /*
-Index: latest/include/linux/nfs_mount.h
-===================================================================
---- latest.orig/include/linux/nfs_mount.h
-+++ latest/include/linux/nfs_mount.h
-@@ -61,6 +61,7 @@ struct nfs_mount_data {
- #define NFS_MOUNT_NOACL 0x0800 /* 4 */
- #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
- #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
-+#define NFS_MOUNT_FSCACHE 0x4000
- #define NFS_MOUNT_FLAGMASK 0xFFFF
-
- #endif
More information about the fedora-cvs-commits
mailing list