From: Frank Zago Date: Mon, 8 Sep 2014 00:24:35 +0000 (-0500) Subject: LU-5396 llite: make some functions static X-Git-Tag: 2.6.92~77 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=26bcb8fcd034f2edc993fa27a9158479836523b8 LU-5396 llite: make some functions static Some functions and variables are only used in their C file, so reduce their scope. This reduces the code size, and fixes sparse warnings such as: warning: symbol 'proc_lnet_routes' was not declared. Should it be static? warning: symbol 'proc_lnet_routers' was not declared. Should it be static? Some prototypes were removed from C files and added to the proper header. Signed-off-by: Frank Zago Change-Id: Id6b13d2b5ceb30de02b60ed6be24d4a496454b70 Reviewed-on: http://review.whamcloud.com/12211 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 4e992e6..5b62f8f 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -776,7 +776,7 @@ static int name##_single_open(struct inode *inode, struct file *file) \ LPROCFS_ENTRY_CHECK(PDE(inode)); \ return single_open(file, name##_seq_show, PDE_DATA(inode)); \ } \ -struct file_operations name##_fops = { \ +static const struct file_operations name##_fops = { \ .owner = THIS_MODULE, \ .open = name##_single_open, \ .read = seq_read, \ diff --git a/lustre/llite/file.c b/lustre/llite/file.c index eb1a85a..28cb292 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1669,7 +1669,8 @@ ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg) RETURN(0); } -int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg) +static int ll_put_grouplock(struct inode *inode, struct file *file, + unsigned long arg) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); @@ -4035,4 +4036,3 @@ int ll_layout_restore(struct inode *inode, loff_t offset, __u64 length) OBD_FREE(hur, len); RETURN(rc); } - diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index b71ab58..25b92b8 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1081,9 +1081,10 @@ struct vvp_thread_info { struct ll_cl_context vti_io_ctx; }; +extern struct lu_context_key vvp_key; + static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env) { - extern struct lu_context_key vvp_key; struct vvp_thread_info *info; info = lu_context_key_get(&env->le_ctx, &vvp_key); @@ -1105,9 +1106,10 @@ struct vvp_session { struct vvp_io vs_ios; }; +extern struct lu_context_key vvp_session_key; + static inline struct vvp_session *vvp_env_session(const struct lu_env *env) { - extern struct lu_context_key vvp_session_key; struct vvp_session *ses; ses = lu_context_key_get(env->le_ses, &vvp_session_key); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index b1dec67..91993d7 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1477,8 +1477,8 @@ void ll_clear_inode(struct inode *inode) EXIT; } -int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data, - struct md_open_data **mod) +static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data, + struct md_open_data **mod) { struct lustre_md md; struct inode *inode = dentry->d_inode; diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index a4d374e..a622863 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -47,9 +47,9 @@ struct proc_dir_entry *proc_lustre_fs_root; #ifdef LPROCFS /* /proc/lustre/llite mount point registration */ -struct file_operations ll_rw_extents_stats_fops; -struct file_operations ll_rw_extents_stats_pp_fops; -struct file_operations ll_rw_offset_stats_fops; +static const struct file_operations ll_rw_extents_stats_fops; +static const struct file_operations ll_rw_extents_stats_pp_fops; +static const struct file_operations ll_rw_offset_stats_fops; static int ll_blksize_seq_show(struct seq_file *m, void *v) { diff --git a/lustre/llite/range_lock.c b/lustre/llite/range_lock.c index 4685144..27fbbef 100644 --- a/lustre/llite/range_lock.c +++ b/lustre/llite/range_lock.c @@ -90,7 +90,7 @@ static inline struct range_lock *next_lock(struct range_lock *lock) * overlapping range node * \retval INTERVAL_ITER_STOP indicate to stop the search */ -enum interval_iter range_unlock_cb(struct interval_node *node, void *arg) +static enum interval_iter range_unlock_cb(struct interval_node *node, void *arg) { struct range_lock *lock = arg; struct range_lock *overlap = node2rangelock(node); @@ -171,7 +171,7 @@ void range_unlock(struct range_lock_tree *tree, struct range_lock *lock) * overlapping range node * \retval INTERVAL_ITER_STOP indicate to stop the search */ -enum interval_iter range_lock_cb(struct interval_node *node, void *arg) +static enum interval_iter range_lock_cb(struct interval_node *node, void *arg) { struct range_lock *lock = (struct range_lock *)arg; struct range_lock *overlap = node2rangelock(node);