FS-Cache/CacheFS mark II
Subsystems (2)
Quoted 3 lines · David Howells
(*) http://people.redhat.com/~dhowells/cachefs/fscache-nfs-2612mm1-10.diff
Cached NFS changes.
Attached is an update to David's patch that adds back the barriers that stops calls into the fscache routines on filesystems that are not mounted with the 'fsc' flag. Now, it can be argued that these barriers are overkill, due to the designed of the fscache interface, but having these barriers will guarantee the stability of NFS will not be compromise by new and untested code paths... I do think these barriers should be temporary, but, again, to maintain the the stability of "normal" code paths, I think they should be added....
The patch also does some general clean up and reworks some of the debugging statements, tying them to NFSDBG_FSCACHE
steved.
This patch adds back the barriers that stop calls into the fscache routines on filesystems that are not mounted with the 'fsc' flag.
=========================================
fs/nfs/nfs-fscache.h renamed from fs/nfs/nfs-fscache.h.orig +21 -7
@@ -17,9 +17,6 @@#include <linux/fscache.h> #ifdef CONFIG_NFS_FSCACHE -#ifndef CONFIG_FSCACHE -#error "CONFIG_NFS_FSCACHE is defined but not CONFIG_FSCACHE" -#endif extern struct fscache_netfs nfs_cache_netfs;extern struct fscache_cookie_def nfs_cache_server_index_def;
@@ -34,6 +31,9 @@ nfs_renew_fscookie(struct nfs_server *se {struct fscache_cookie *old = nfsi->fscache; +if (!(server->flags &NFS_MOUNT_FSCACHE )) +return ; +/* retire the current fscache cache and get a new one */ fscache_relinquish_cookie (nfsi->fscache,1 ); nfsi->fscache =fscache_acquire_cookie (server->fscache,NULL , nfsi);
@@ -90,6 +90,9 @@ nfs_fhget_fscookie(struct super_block *s {struct nfs_server *server =NFS_SB (sb); +if (!(server->flags &NFS_MOUNT_FSCACHE )) +return ; + nfsi->fscache =fscache_acquire_cookie (server->fscache, &nfs_cache_fh_index_def, nfsi);if (server->fscache ==FSCACHE_NEGATIVE_COOKIE )
@@ -105,6 +108,9 @@ nfs_fhget_fscookie(struct super_block *sstatic inline void nfs_kill_fscookie (struct nfs_server *server) { +if (!(server->flags &NFS_MOUNT_FSCACHE )) +return ; +dfprintk (FSCACHE ,"NFS: killing cookie (0x%p/0x%p)\n" , server, server->fscache);
@@ -114,8 +120,12 @@ static inline void nfs_kill_fscookie(strreturn ; } -static inline void nfs_clear_fscookie (struct nfs_inode *nfsi) +static inline void nfs_clear_fscookie (struct nfs_server *server, +struct nfs_inode *nfsi) { +if (!(server->flags &NFS_MOUNT_FSCACHE )) +return ; +dfprintk (FSCACHE ,"NFS: clear cookie (0x%p/0x%p)\n" , nfsi, nfsi->fscache);
@@ -125,8 +135,12 @@ static inline void nfs_clear_fscookie(streturn ; } -static inline void nfs_zap_fscookie (struct nfs_inode *nfsi) +static inline void nfs_zap_fscookie (struct nfs_server *server, +struct nfs_inode *nfsi) { +if (!(server->flags &NFS_MOUNT_FSCACHE )) +return ; +dfprintk (FSCACHE ,"NFS: zapping cookie (0x%p/0x%p)\n" , nfsi, nfsi->fscache);
@@ -156,8 +170,8 @@ static inline void nfs_fill_fscookie(strstatic inline void nfs_fhget_fscookie (struct super_block *sb,struct nfs_inode *nfsi) {}static inline void nfs4_fill_fscookie (struct super_block *sb) {}static inline void nfs_kill_fscookie (struct nfs_server *server) {} -static inline void nfs_clear_fscookie (struct nfs_inode *nfsi) {} -static inline void nfs_zap_fscookie (struct nfs_inode *nfsi) {} +static inline void nfs_clear_fscookie (struct nfs_server *server,struct nfs_inode *nfsi) {} +static inline void nfs_zap_fscookie (struct nfs_server *server,struct nfs_inode *nfsi) {}static inline void nfs_renew_fscookie (struct nfs_server *server,struct nfs_inode *nfsi) {}static inline int nfs_register_netfs (void ) {return 0 ; }
fs/nfs/inode.c renamed from fs/nfs/inode.c.orig +9 -3
@@ -172,7 +172,7 @@ nfs_clear_inode(struct inode *inode)if (cred)put_rpccred (cred); -nfs_clear_fscookie (nfsi); +nfs_clear_fscookie (NFS_SERVER (inode), nfsi);BUG_ON (atomic_read (&nfsi->data_updates) !=0 ); }
@@ -586,7 +586,7 @@ static int nfs_show_options(struct seq_f { NFS_MOUNT_NOAC, ",noac", "" }, { NFS_MOUNT_NONLM, ",nolock", ",lock" }, { NFS_MOUNT_NOACL, ",noacl", "" }, - { NFS_MOUNT_FSCACHE, ",fscache", "" }, + { NFS_MOUNT_FSCACHE, ",fsc", "" }, { 0, NULL, NULL } };struct proc_nfs_info *nfs_infop;
@@ -632,7 +632,7 @@ nfs_zap_caches(struct inode *inode)else nfsi->flags |=NFS_INO_INVALID_ATTR |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL ; -nfs_zap_fscookie (nfsi); +nfs_zap_fscookie (NFS_SERVER (inode), nfsi); }static void nfs_zap_acl_cache (struct inode *inode)
@@ -841,7 +841,9 @@ nfs_setattr(struct dentry *dentry, struc inode->i_gid = attr->ia_gid;if ((attr->ia_valid &ATTR_SIZE ) !=0 ) { inode->i_size = attr->ia_size; +#ifdef CONFIG_NFS_FSCACHE fscache_set_i_size (nfsi->fscache, inode->i_size); +#endif vmtruncate (inode, attr->ia_size); } }
@@ -1324,12 +1326,16 @@ static int nfs_update_inode(struct inodeif (S_ISREG (inode->i_mode) && data_unstable) {if (new_isize > cur_isize) { inode->i_size = new_isize; +#ifdef CONFIG_NFS_FSCACHE fscache_set_i_size (nfsi->fscache, inode->i_size); +#endif invalid |=NFS_INO_INVALID_ATTR |NFS_INO_INVALID_DATA ; } }else { inode->i_size = new_isize; +#ifdef CONFIG_NFS_FSCACHE fscache_set_i_size (nfsi->fscache, inode->i_size); +#endif invalid |=NFS_INO_INVALID_ATTR |NFS_INO_INVALID_DATA ; } }
fs/nfs/write.c renamed from fs/nfs/write.c.orig +9 -2
@@ -124,7 +124,9 @@ static void nfs_grow_file(struct page *pif (i_size >= end)return ;i_size_write (inode, end); +#ifdef CONFIG_NFS_FSCACHE fscache_set_i_size (nfsi->fscache, end); +#endif }/* We can set the PG_uptodate flag if we see that a write request
@@ -270,15 +272,20 @@ nfs_writepage_to_fscache(struct inode *i {int ret; +if (!(NFS_SERVER (inode)->flags &NFS_MOUNT_FSCACHE )) +return ; +if (PagePrivate (page)) { -dprintk ("NFS: writepage_to_fscache (0x%p/0x%p/0x%p)\n" , +dfprintk (FSCACHE , +"NFS: writepage_to_fscache (0x%p/0x%p/0x%p)\n" ,NFS_I (inode)->fscache, page, inode); ret =fscache_write_page (NFS_I (inode)->fscache, page, nfs_writepage_to_fscache_complete,NULL ,GFP_KERNEL );if (ret !=0 ) { -dprintk ("NFS: fscache_write_page error %d\n" , ret); +dfprintk (FSCACHE , +"NFS: fscache_write_page error %d\n" , ret);fscache_uncache_page (NFS_I (inode)->fscache, page); } }
fs/nfs/read.c renamed from fs/nfs/read.c.orig +32 -11
79 lines not on this page · raw message