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 <fzago@cray.com>
Change-Id: I86b7ada5c768f4b875fce55745f7492faabd4617
Reviewed-on: http://review.whamcloud.com/12221
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
15 files changed:
{ \
return single_open(file, NULL, PDE_DATA(inode)); \
} \
{ \
return single_open(file, NULL, PDE_DATA(inode)); \
} \
- struct file_operations name##_##type##_fops = { \
+ static const struct file_operations name##_##type##_fops = { \
.open = name##_##type##_open, \
.write = name##_##type##_write, \
.release = lprocfs_single_release, \
.open = name##_##type##_open, \
.write = name##_##type##_write, \
.release = lprocfs_single_release, \
extern struct mutex ldlm_cli_namespace_lock;
extern struct list_head ldlm_cli_active_namespace_list;
extern struct list_head ldlm_cli_inactive_namespace_list;
extern struct mutex ldlm_cli_namespace_lock;
extern struct list_head ldlm_cli_active_namespace_list;
extern struct list_head ldlm_cli_inactive_namespace_list;
+extern unsigned int ldlm_cancel_unused_locks_before_replay;
static inline int ldlm_namespace_nr_read(ldlm_side_t client)
{
static inline int ldlm_namespace_nr_read(ldlm_side_t client)
{
ldlm_cancel_flags_t cancel_flags, int flags);
extern unsigned int ldlm_enqueue_min;
/* ldlm_resource.c */
ldlm_cancel_flags_t cancel_flags, int flags);
extern unsigned int ldlm_enqueue_min;
/* ldlm_resource.c */
+extern struct kmem_cache *ldlm_resource_slab;
+extern struct kmem_cache *ldlm_lock_slab;
+
int ldlm_resource_putref_locked(struct ldlm_resource *res);
void ldlm_resource_insert_lock_after(struct ldlm_lock *original,
struct ldlm_lock *new);
void ldlm_namespace_free_prior(struct ldlm_namespace *ns,
struct obd_import *imp, int force);
void ldlm_namespace_free_post(struct ldlm_namespace *ns);
int ldlm_resource_putref_locked(struct ldlm_resource *res);
void ldlm_resource_insert_lock_after(struct ldlm_lock *original,
struct ldlm_lock *new);
void ldlm_namespace_free_prior(struct ldlm_namespace *ns,
struct obd_import *imp, int force);
void ldlm_namespace_free_post(struct ldlm_namespace *ns);
/* ldlm_lock.c */
struct ldlm_cb_set_arg {
/* ldlm_lock.c */
struct ldlm_cb_set_arg {
void l_check_no_ns_lock(struct ldlm_namespace *ns);
extern struct proc_dir_entry *ldlm_svc_proc_dir;
void l_check_no_ns_lock(struct ldlm_namespace *ns);
extern struct proc_dir_entry *ldlm_svc_proc_dir;
-extern struct proc_dir_entry *ldlm_type_proc_dir;
struct ldlm_state {
struct ptlrpc_service *ldlm_cb_service;
struct ldlm_state {
struct ptlrpc_service *ldlm_cb_service;
struct __##var##__dummy_read {;} /* semicolon catcher */
#define LDLM_POOL_PROC_WRITER(var, type) \
struct __##var##__dummy_read {;} /* semicolon catcher */
#define LDLM_POOL_PROC_WRITER(var, type) \
- int lprocfs_wr_##var(struct file *file, \
+ static int lprocfs_wr_##var(struct file *file, \
const char __user *buffer, \
unsigned long count, void *data) \
{ \
const char __user *buffer, \
unsigned long count, void *data) \
{ \
}
EXPORT_SYMBOL(target_pack_pool_reply);
}
EXPORT_SYMBOL(target_pack_pool_reply);
-int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
+static int target_send_reply_msg(struct ptlrpc_request *req,
+ int rc, int fail_id)
{
if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) {
DEBUG_REQ(D_ERROR, req, "dropping reply");
{
if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) {
DEBUG_REQ(D_ERROR, req, "dropping reply");
* ldlm_lock_destroy, you can never drop your final references on this lock.
* Because it's not in the hash table anymore. -phil
*/
* ldlm_lock_destroy, you can never drop your final references on this lock.
* Because it's not in the hash table anymore. -phil
*/
-int ldlm_lock_destroy_internal(struct ldlm_lock *lock)
+static int ldlm_lock_destroy_internal(struct ldlm_lock *lock)
OBD_SLAB_FREE(lock, ldlm_lock_slab, size);
}
OBD_SLAB_FREE(lock, ldlm_lock_slab, size);
}
-struct portals_handle_ops lock_handle_ops = {
+static struct portals_handle_ops lock_handle_ops = {
.hop_addref = lock_handle_addref,
.hop_free = lock_handle_free,
};
.hop_addref = lock_handle_addref,
.hop_free = lock_handle_free,
};
*
* Only add if we have not sent a blocking AST to the lock yet.
*/
*
* Only add if we have not sent a blocking AST to the lock yet.
*/
-void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
- struct list_head *work_list)
+static void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
+ struct list_head *work_list)
{
if (!ldlm_is_ast_sent(lock)) {
LDLM_DEBUG(lock, "lock incompatible; sending blocking AST.");
{
if (!ldlm_is_ast_sent(lock)) {
LDLM_DEBUG(lock, "lock incompatible; sending blocking AST.");
/**
* Add a lock to list of just granted locks to send completion AST to.
*/
/**
* Add a lock to list of just granted locks to send completion AST to.
*/
-void ldlm_add_cp_work_item(struct ldlm_lock *lock, struct list_head *work_list)
+static void ldlm_add_cp_work_item(struct ldlm_lock *lock,
+ struct list_head *work_list)
{
if (!ldlm_is_cp_reqd(lock)) {
ldlm_set_cp_reqd(lock);
{
if (!ldlm_is_cp_reqd(lock)) {
ldlm_set_cp_reqd(lock);
* Iterator function for ldlm_cancel_locks_for_export.
* Cancels passed locks.
*/
* Iterator function for ldlm_cancel_locks_for_export.
* Cancels passed locks.
*/
-int ldlm_cancel_locks_for_export_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd,
- struct hlist_node *hnode, void *data)
+static int ldlm_cancel_locks_for_export_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd,
+ struct hlist_node *hnode, void *data)
{
struct export_cl_data *ecl = (struct export_cl_data *)data;
{
struct export_cl_data *ecl = (struct export_cl_data *)data;
CFS_MODULE_PARM(ldlm_cpts, "s", charp, 0444,
"CPU partitions ldlm threads should run on");
CFS_MODULE_PARM(ldlm_cpts, "s", charp, 0444,
"CPU partitions ldlm threads should run on");
-extern struct kmem_cache *ldlm_resource_slab;
-extern struct kmem_cache *ldlm_lock_slab;
static struct mutex ldlm_ref_mutex;
static int ldlm_refcount;
static struct mutex ldlm_ref_mutex;
static int ldlm_refcount;
-int ldlm_revoke_lock_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd,
- struct hlist_node *hnode, void *data)
+static int ldlm_revoke_lock_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd,
+ struct hlist_node *hnode, void *data)
{
struct list_head *rpc_list = data;
{
struct list_head *rpc_list = data;
return ldlm_cancel_lru(ns, nr, LCF_ASYNC, LDLM_CANCEL_SHRINK);
}
return ldlm_cancel_lru(ns, nr, LCF_ASYNC, LDLM_CANCEL_SHRINK);
}
-struct ldlm_pool_ops ldlm_srv_pool_ops = {
+static struct ldlm_pool_ops ldlm_srv_pool_ops = {
.po_recalc = ldlm_srv_pool_recalc,
.po_shrink = ldlm_srv_pool_shrink,
.po_setup = ldlm_srv_pool_setup
};
.po_recalc = ldlm_srv_pool_recalc,
.po_shrink = ldlm_srv_pool_shrink,
.po_setup = ldlm_srv_pool_setup
};
-struct ldlm_pool_ops ldlm_cli_pool_ops = {
+static struct ldlm_pool_ops ldlm_cli_pool_ops = {
.po_recalc = ldlm_cli_pool_recalc,
.po_shrink = ldlm_cli_pool_shrink
};
.po_recalc = ldlm_cli_pool_recalc,
.po_shrink = ldlm_cli_pool_shrink
};
/* Client namespaces that don't have any locks in them */
struct list_head ldlm_cli_inactive_namespace_list;
/* Client namespaces that don't have any locks in them */
struct list_head ldlm_cli_inactive_namespace_list;
-struct proc_dir_entry *ldlm_type_proc_dir = NULL;
-struct proc_dir_entry *ldlm_ns_proc_dir = NULL;
-struct proc_dir_entry *ldlm_svc_proc_dir = NULL;
-
-extern unsigned int ldlm_cancel_unused_locks_before_replay;
+static struct proc_dir_entry *ldlm_type_proc_dir;
+static struct proc_dir_entry *ldlm_ns_proc_dir;
+struct proc_dir_entry *ldlm_svc_proc_dir;
/* during debug dump certain amount of granted locks for one resource to avoid
* DDOS. */
/* during debug dump certain amount of granted locks for one resource to avoid
* DDOS. */
-unsigned int ldlm_dump_granted_max = 256;
+static unsigned int ldlm_dump_granted_max = 256;
#ifdef LPROCFS
static ssize_t
#ifdef LPROCFS
static ssize_t
}
LPROC_SEQ_FOPS(lprocfs_elc);
}
LPROC_SEQ_FOPS(lprocfs_elc);
-void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns)
+static void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns)
{
if (ns->ns_proc_dir_entry == NULL)
CERROR("dlm namespace %s has no procfs dir?\n",
{
if (ns->ns_proc_dir_entry == NULL)
CERROR("dlm namespace %s has no procfs dir?\n",
lprocfs_free_stats(&ns->ns_stats);
}
lprocfs_free_stats(&ns->ns_stats);
}
-int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
+static int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
{
struct lprocfs_seq_vars lock_vars[2];
char lock_name[MAX_STRING_SIZE + 1];
{
struct lprocfs_seq_vars lock_vars[2];
char lock_name[MAX_STRING_SIZE + 1];
ldlm_resource_putref(res);
}
ldlm_resource_putref(res);
}
-cfs_hash_ops_t ldlm_ns_hash_ops = {
+static cfs_hash_ops_t ldlm_ns_hash_ops = {
.hs_hash = ldlm_res_hop_hash,
.hs_key = ldlm_res_hop_key,
.hs_keycmp = ldlm_res_hop_keycmp,
.hs_hash = ldlm_res_hop_hash,
.hs_key = ldlm_res_hop_key,
.hs_keycmp = ldlm_res_hop_keycmp,
.hs_put = ldlm_res_hop_put
};
.hs_put = ldlm_res_hop_put
};
-cfs_hash_ops_t ldlm_ns_fid_hash_ops = {
+static cfs_hash_ops_t ldlm_ns_fid_hash_ops = {
.hs_hash = ldlm_res_hop_fid_hash,
.hs_key = ldlm_res_hop_key,
.hs_keycmp = ldlm_res_hop_keycmp,
.hs_hash = ldlm_res_hop_fid_hash,
.hs_key = ldlm_res_hop_key,
.hs_keycmp = ldlm_res_hop_keycmp,
cfs_hash_ops_t *nsd_hops;
} ldlm_ns_hash_def_t;
cfs_hash_ops_t *nsd_hops;
} ldlm_ns_hash_def_t;
-ldlm_ns_hash_def_t ldlm_ns_hash_defs[] =
+static ldlm_ns_hash_def_t ldlm_ns_hash_defs[] =
{
{
.nsd_type = LDLM_NS_TYPE_MDC,
{
{
.nsd_type = LDLM_NS_TYPE_MDC,
EXPORT_SYMBOL(ldlm_namespace_get);
/* This is only for callers that care about refcount */
EXPORT_SYMBOL(ldlm_namespace_get);
/* This is only for callers that care about refcount */
-int ldlm_namespace_get_return(struct ldlm_namespace *ns)
+static int ldlm_namespace_get_return(struct ldlm_namespace *ns)
{
return atomic_inc_return(&ns->ns_bref);
}
{
return atomic_inc_return(&ns->ns_bref);
}
struct kmem_cache *lov_lock_link_kmem;
/** Lock class of lov_device::ld_mutex. */
struct kmem_cache *lov_lock_link_kmem;
/** Lock class of lov_device::ld_mutex. */
-struct lock_class_key cl_lov_device_mutex_class;
+static struct lock_class_key cl_lov_device_mutex_class;
struct lu_kmem_descr lov_caches[] = {
{
struct lu_kmem_descr lov_caches[] = {
{
return lsm_lmm_verify_common(lmm, lmm_bytes, *stripe_count);
}
return lsm_lmm_verify_common(lmm, lmm_bytes, *stripe_count);
}
-int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm,
- struct lov_mds_md_v1 *lmm)
+static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm,
+ struct lov_mds_md_v1 *lmm)
{
struct lov_oinfo *loi;
int i;
{
struct lov_oinfo *loi;
int i;
-int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm,
- struct lov_mds_md *lmmv1)
+static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm,
+ struct lov_mds_md *lmmv1)
{
struct lov_mds_md_v3 *lmm;
struct lov_oinfo *loi;
{
struct lov_mds_md_v3 *lmm;
struct lov_oinfo *loi;
extern struct kmem_cache *lov_oinfo_slab;
extern struct kmem_cache *lov_oinfo_slab;
+extern struct lu_kmem_descr lov_caches[];
+
void lov_finish_set(struct lov_request_set *set);
static inline void lov_put_reqset(struct lov_request_set *set)
void lov_finish_set(struct lov_request_set *set);
static inline void lov_put_reqset(struct lov_request_set *set)
int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname);
int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname);
void lov_dump_pool(int level, struct pool_desc *pool);
int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname);
int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname);
void lov_dump_pool(int level, struct pool_desc *pool);
-void lov_pool_putref(struct pool_desc *pool);
static inline struct lov_stripe_md *lsm_addref(struct lov_stripe_md *lsm)
{
static inline struct lov_stripe_md *lsm_addref(struct lov_stripe_md *lsm)
{
* \param fm_end logical end of mapping
* \param start_stripe starting stripe will be returned in this
*/
* \param fm_end logical end of mapping
* \param start_stripe starting stripe will be returned in this
*/
-obd_size fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap,
- struct lov_stripe_md *lsm, obd_size fm_start,
- obd_size fm_end, int *start_stripe)
+static obd_size fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap,
+ struct lov_stripe_md *lsm,
+ obd_size fm_start,
+ obd_size fm_end, int *start_stripe)
{
obd_size local_end = fiemap->fm_extents[0].fe_logical;
obd_off lun_start, lun_end;
{
obd_size local_end = fiemap->fm_extents[0].fe_logical;
obd_off lun_start, lun_end;
*
* \retval last_stripe return the last stripe of the mapping
*/
*
* \retval last_stripe return the last stripe of the mapping
*/
-int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, obd_size fm_start,
- obd_size fm_end, int start_stripe,
- int *stripe_count)
+static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, obd_size fm_start,
+ obd_size fm_end, int start_stripe,
+ int *stripe_count)
{
int last_stripe;
obd_off obd_start, obd_end;
{
int last_stripe;
obd_off obd_start, obd_end;
* \param ext_count number of extents to be copied
* \param current_extent where to start copying in main extent array
*/
* \param ext_count number of extents to be copied
* \param current_extent where to start copying in main extent array
*/
-void fiemap_prepare_and_copy_exts(struct ll_user_fiemap *fiemap,
- struct ll_fiemap_extent *lcl_fm_ext,
- int ost_index, unsigned int ext_count,
- int current_extent)
+static void fiemap_prepare_and_copy_exts(struct ll_user_fiemap *fiemap,
+ struct ll_fiemap_extent *lcl_fm_ext,
+ int ost_index, unsigned int ext_count,
+ int current_extent)
struct kmem_cache *lov_oinfo_slab;
struct kmem_cache *lov_oinfo_slab;
-extern struct lu_kmem_descr lov_caches[];
-
-int __init lov_init(void)
+static int __init lov_init(void)
{
bool enable_proc = true;
struct obd_type *type;
{
bool enable_proc = true;
struct obd_type *type;
#define DEBUG_SUBSYSTEM S_LOV
#include "lov_cl_internal.h"
#define DEBUG_SUBSYSTEM S_LOV
#include "lov_cl_internal.h"
/**
* Return lov_layout_type associated with a given lsm
*/
/**
* Return lov_layout_type associated with a given lsm
*/
-enum lov_layout_type lov_type(struct lov_stripe_md *lsm)
+static enum lov_layout_type lov_type(struct lov_stripe_md *lsm)
{
if (lsm == NULL)
return LLT_EMPTY;
{
if (lsm == NULL)
return LLT_EMPTY;
atomic_inc(&pool->pool_refcount);
}
atomic_inc(&pool->pool_refcount);
}
-void lov_pool_putref(struct pool_desc *pool)
+static void lov_pool_putref(struct pool_desc *pool)
{
CDEBUG(D_INFO, "pool %p\n", pool);
if (atomic_dec_and_test(&pool->pool_refcount)) {
{
CDEBUG(D_INFO, "pool %p\n", pool);
if (atomic_dec_and_test(&pool->pool_refcount)) {
-void lov_pool_putref_locked(struct pool_desc *pool)
+static void lov_pool_putref_locked(struct pool_desc *pool)
{
CDEBUG(D_INFO, "pool %p\n", pool);
LASSERT(atomic_read(&pool->pool_refcount) > 1);
{
CDEBUG(D_INFO, "pool %p\n", pool);
LASSERT(atomic_read(&pool->pool_refcount) > 1);
tgt->ltd_active ? "" : "IN");
}
tgt->ltd_active ? "" : "IN");
}
-struct seq_operations lov_tgt_sops = {
+static const struct seq_operations lov_tgt_sops = {
.start = lov_tgt_seq_start,
.stop = lov_tgt_seq_stop,
.next = lov_tgt_seq_next,
.start = lov_tgt_seq_start,
.stop = lov_tgt_seq_stop,
.next = lov_tgt_seq_next,