NFS: This patch makes some needlessly global code static. Signed-off-by: Adrian Bunk Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 8 +++++--- fs/nfs/mount_clnt.c | 4 ++-- fs/nfs/nfs4proc.c | 9 +++++---- fs/nfs/nfsroot.c | 4 ++-- fs/nfs/read.c | 2 +- fs/nfs/write.c | 29 +++++++++++++++++++++++------ include/linux/nfs_fs.h | 24 ------------------------ include/linux/nfs_xdr.h | 2 -- 8 files changed, 38 insertions(+), 44 deletions(-) Index: linux-2.6.11/include/linux/nfs_xdr.h =================================================================== --- linux-2.6.11.orig/include/linux/nfs_xdr.h +++ linux-2.6.11/include/linux/nfs_xdr.h @@ -731,7 +731,5 @@ extern struct nfs_rpc_ops nfs_v4_cliento extern struct rpc_version nfs_version2; extern struct rpc_version nfs_version3; extern struct rpc_version nfs_version4; -extern struct rpc_program nfs_program; -extern struct rpc_stat nfs_rpcstat; #endif Index: linux-2.6.11/fs/nfs/inode.c =================================================================== --- linux-2.6.11.orig/fs/nfs/inode.c +++ linux-2.6.11/fs/nfs/inode.c @@ -64,6 +64,8 @@ static void nfs_umount_begin(struct supe static int nfs_statfs(struct super_block *, struct kstatfs *); static int nfs_show_options(struct seq_file *, struct vfsmount *); +static struct rpc_program nfs_program; + static struct super_operations nfs_sops = { .alloc_inode = nfs_alloc_inode, .destroy_inode = nfs_destroy_inode, @@ -78,7 +80,7 @@ static struct super_operations nfs_sops /* * RPC cruft for NFS */ -struct rpc_stat nfs_rpcstat = { +static struct rpc_stat nfs_rpcstat = { .program = &nfs_program }; static struct rpc_version * nfs_version[] = { @@ -95,7 +97,7 @@ static struct rpc_version * nfs_version[ #endif }; -struct rpc_program nfs_program = { +static struct rpc_program nfs_program = { .name = "nfs", .number = NFS_PROGRAM, .nrvers = sizeof(nfs_version) / sizeof(nfs_version[0]), @@ -792,7 +794,7 @@ nfs_setattr(struct dentry *dentry, struc * Wait for the inode to get unlocked. * (Used for NFS_INO_LOCKED and NFS_INO_REVALIDATING). */ -int +static int nfs_wait_on_inode(struct inode *inode, int flag) { struct rpc_clnt *clnt = NFS_CLIENT(inode); Index: linux-2.6.11/fs/nfs/mount_clnt.c =================================================================== --- linux-2.6.11.orig/fs/nfs/mount_clnt.c +++ linux-2.6.11/fs/nfs/mount_clnt.c @@ -31,7 +31,7 @@ static struct rpc_clnt * mnt_create(char *, struct sockaddr_in *, int, int); -struct rpc_program mnt_program; +static struct rpc_program mnt_program; struct mnt_fhstatus { unsigned int status; @@ -174,7 +174,7 @@ static struct rpc_version * mnt_version[ static struct rpc_stat mnt_stats; -struct rpc_program mnt_program = { +static struct rpc_program mnt_program = { .name = "mount", .number = NFS_MNT_PROGRAM, .nrvers = sizeof(mnt_version)/sizeof(mnt_version[0]), Index: linux-2.6.11/include/linux/nfs_fs.h =================================================================== --- linux-2.6.11.orig/include/linux/nfs_fs.h +++ linux-2.6.11/include/linux/nfs_fs.h @@ -374,11 +374,8 @@ extern void nfs_commit_done(struct rpc_t * return value!) */ extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); -extern int nfs_flush_inode(struct inode *, unsigned long, unsigned int, int); -extern int nfs_flush_list(struct list_head *, int, int); #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) extern int nfs_commit_inode(struct inode *, unsigned long, unsigned int, int); -extern int nfs_commit_list(struct list_head *, int); #else static inline int nfs_commit_inode(struct inode *inode, unsigned long idx_start, unsigned int npages, int how) @@ -419,7 +416,6 @@ static inline int nfs_wb_page(struct ino * Allocate and free nfs_write_data structures */ extern mempool_t *nfs_wdata_mempool; -extern mempool_t *nfs_commit_mempool; static inline struct nfs_write_data *nfs_writedata_alloc(void) { @@ -436,23 +432,6 @@ static inline void nfs_writedata_free(st mempool_free(p, nfs_wdata_mempool); } -extern void nfs_writedata_release(struct rpc_task *task); - -static inline struct nfs_write_data *nfs_commit_alloc(void) -{ - struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS); - if (p) { - memset(p, 0, sizeof(*p)); - INIT_LIST_HEAD(&p->pages); - } - return p; -} - -static inline void nfs_commit_free(struct nfs_write_data *p) -{ - mempool_free(p, nfs_commit_mempool); -} - /* Hack for future NFS swap support */ #ifndef IS_SWAPFILE # define IS_SWAPFILE(inode) (0) @@ -464,7 +443,6 @@ static inline void nfs_commit_free(struc extern int nfs_readpage(struct file *, struct page *); extern int nfs_readpages(struct file *, struct address_space *, struct list_head *, unsigned); -extern int nfs_pagein_list(struct list_head *, int); extern void nfs_readpage_result(struct rpc_task *); /* @@ -701,10 +679,8 @@ extern int nfs4_open_reclaim(struct nfs4 extern int nfs4_proc_async_renew(struct nfs4_client *); extern int nfs4_proc_renew(struct nfs4_client *); extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode); -extern int nfs4_wait_clnt_recover(struct rpc_clnt *, struct nfs4_client *); extern struct inode *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); extern int nfs4_open_revalidate(struct inode *, struct dentry *, int); -extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *); extern int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request); /* nfs4renewd.c */ Index: linux-2.6.11/fs/nfs/nfs4proc.c =================================================================== --- linux-2.6.11.orig/fs/nfs/nfs4proc.c +++ linux-2.6.11/fs/nfs/nfs4proc.c @@ -57,6 +57,7 @@ static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); static int nfs4_async_handle_error(struct rpc_task *, struct nfs_server *); static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry); +static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_exception *exception); extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); extern struct rpc_procinfo nfs4_procedures[]; @@ -381,7 +382,7 @@ out: /* * Returns an nfs4_state + an extra reference to the inode */ -int _nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred, struct nfs4_state **res) +static int _nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred, struct nfs4_state **res) { struct nfs_delegation *delegation; struct nfs_server *server = NFS_SERVER(inode); @@ -581,7 +582,7 @@ out_err: } -struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) +static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, struct iattr *sattr, struct rpc_cred *cred) { struct nfs4_exception exception = { }; struct nfs4_state *res; @@ -645,7 +646,7 @@ static int _nfs4_do_setattr(struct nfs_s return rpc_call_sync(server->client, &msg, 0); } -int nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, +static int nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, struct nfs_fh *fhandle, struct iattr *sattr, struct nfs4_state *state) { @@ -2078,7 +2079,7 @@ nfs4_async_handle_error(struct rpc_task return 0; } -int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs4_client *clp) +static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs4_client *clp) { DEFINE_WAIT(wait); sigset_t oldset; Index: linux-2.6.11/fs/nfs/nfsroot.c =================================================================== --- linux-2.6.11.orig/fs/nfs/nfsroot.c +++ linux-2.6.11/fs/nfs/nfsroot.c @@ -351,7 +351,7 @@ static void __init root_nfs_print(void) #endif -int __init root_nfs_init(void) +static int __init root_nfs_init(void) { #ifdef NFSROOT_DEBUG nfs_debug |= NFSDBG_ROOT; @@ -379,7 +379,7 @@ int __init root_nfs_init(void) * Parse NFS server and directory information passed on the kernel * command line. */ -int __init nfs_root_setup(char *line) +static int __init nfs_root_setup(char *line) { ROOT_DEV = Root_NFS; if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) { Index: linux-2.6.11/fs/nfs/read.c =================================================================== --- linux-2.6.11.orig/fs/nfs/read.c +++ linux-2.6.11/fs/nfs/read.c @@ -370,7 +370,7 @@ out_bad: return -ENOMEM; } -int +static int nfs_pagein_list(struct list_head *head, int rpages) { LIST_HEAD(one_request); Index: linux-2.6.11/fs/nfs/write.c =================================================================== --- linux-2.6.11.orig/fs/nfs/write.c +++ linux-2.6.11/fs/nfs/write.c @@ -80,14 +80,31 @@ static void nfs_writeback_done_partial(s static void nfs_writeback_done_full(struct nfs_write_data *, int); static int nfs_wait_on_write_congestion(struct address_space *, int); static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int); +static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, + unsigned int npages, int how); static kmem_cache_t *nfs_wdata_cachep; mempool_t *nfs_wdata_mempool; -mempool_t *nfs_commit_mempool; +static mempool_t *nfs_commit_mempool; static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion); -void nfs_writedata_release(struct rpc_task *task) +static inline struct nfs_write_data *nfs_commit_alloc(void) +{ + struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS); + if (p) { + memset(p, 0, sizeof(*p)); + INIT_LIST_HEAD(&p->pages); + } + return p; +} + +static inline void nfs_commit_free(struct nfs_write_data *p) +{ + mempool_free(p, nfs_commit_mempool); +} + +static void nfs_writedata_release(struct rpc_task *task) { struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata; nfs_writedata_free(wdata); @@ -990,7 +1007,7 @@ static int nfs_flush_one(struct list_hea return -ENOMEM; } -int +static int nfs_flush_list(struct list_head *head, int wpages, int how) { LIST_HEAD(one_request); @@ -1240,7 +1257,7 @@ static void nfs_commit_rpcsetup(struct l /* * Commit dirty pages */ -int +static int nfs_commit_list(struct list_head *head, int how) { struct nfs_write_data *data; @@ -1314,8 +1331,8 @@ nfs_commit_done(struct rpc_task *task) } #endif -int nfs_flush_inode(struct inode *inode, unsigned long idx_start, - unsigned int npages, int how) +static int nfs_flush_inode(struct inode *inode, unsigned long idx_start, + unsigned int npages, int how) { struct nfs_inode *nfsi = NFS_I(inode); LIST_HEAD(head);