Staging: lustre: Fixed sparse complaints
cover Staging: lustre: Fixed sparse complaints
This patchset fixes the following sparse complaints:
[1/3]: use of a plain integer as NULL pointer [2/3]: symbols that should declared as static [3/3]: use of an unsigned int as gfp_t
Fabio Falzoi (3):
Staging: lustre: Avoid using 0 instead of NULL
Staging: lustre: ops structs should be declared static
Staging: lustre: gfp_mask should be of gfp_t type
drivers/staging/lustre/lustre/include/lprocfs_status.h | 4 ++-- drivers/staging/lustre/lustre/include/lustre_dlm.h | 6 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 16 ++++++++-------- drivers/staging/lustre/lustre/llite/lproc_llite.c | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 Staging: lustre: Avoid using 0 instead of NULL
Fixed the following sparse complaints:
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:755:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:757:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:758:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:759:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:760:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:762:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:764:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:765:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:766:9:
warning: Using plain integer as NULL pointerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:768:9:
warning: Using plain integer as NULL pointer
--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +1 -1
@@ -718,7 +718,7 @@ LPROC_SEQ_FOPS_RO(lprocfs_grant_speed); snprintf(var_name, MAX_STRING_SIZE, #name); \ pool_vars[0].data = var; \ pool_vars[0].fops = ops; \ - lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);\ + lprocfs_add_vars(pl->pl_proc_dir, pool_vars, NULL);\ } while (0)static int ldlm_pool_proc_init (struct ldlm_pool *pl)
Signature · 1 line
1.9.1
PATCH 2/3 Staging: lustre: ops structs should be declared static
In reply to Fabio FalzoiFixed the following sparse complaints:
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:549:22:
warning: symbol 'ldlm_srv_pool_ops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:555:22:
warning: symbol 'ldlm_cli_pool_ops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:681:1:
warning: symbol 'lprocfs_pool_state_fops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:697:1:
warning: symbol 'lprocfs_grant_plan_fops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:700:1:
warning: symbol 'lprocfs_wr_recalc_period' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:708:1:
warning: symbol 'lprocfs_recalc_period_fops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:710:1:
warning: symbol 'ldlm_pool_u64_fops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:711:1:
warning: symbol 'ldlm_pool_atomic_fops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:712:1:
warning: symbol 'ldlm_pool_rw_atomic_fops' was not declared. Should it be static?drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:714:1:
warning: symbol 'lprocfs_grant_speed_fops' was not declared. Should it be static?
--- drivers/staging/lustre/lustre/include/lprocfs_status.h | 4 ++-- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 4 ++-- drivers/staging/lustre/lustre/llite/lproc_llite.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/include/lprocfs_status.h +2 -2
@@ -687,7 +687,7 @@ static int name##_single_open(cfs_inode_t *inode, struct file *file) \ { \ return single_open(file, name##_seq_show, PDE_DATA(inode)); \ } \ -struct file_operations name##_fops = { \ +static struct file_operations name##_fops = { \ .owner =THIS_MODULE , \ .open = name##_single_open, \ .read = seq_read, \
@@ -730,7 +730,7 @@ struct file_operations name##_fops = { \ { \return single_open (file,NULL ,PDE_DATA (inode)); \ } \ - struct file_operations name##_##type##_fops = { \ + static struct file_operations name##_##type##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write, \ .release = lprocfs_single_release, \
drivers/staging/lustre/lustre/include/lustre_dlm.h +1 -1
@@ -260,7 +260,7 @@ struct ldlm_pool {/** Recalculation period for pool. */ time_t pl_recalc_period;/** Recalculation and shrink operations. */ -struct ldlm_pool_ops *pl_ops; +const struct ldlm_pool_ops *pl_ops;/** Number of planned locks for next period. */ int pl_grant_plan;/** Pool statistics. */
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +1 -1
@@ -247,7 +247,7 @@ typedef enum ldlm_policy_res ldlm_policy_res_t; struct __##var##__dummy_read {;} /* semicolon catcher */#define LDLM_POOL_PROC_WRITER (var, type) \ - int lprocfs_wr_##var(struct file *file, const char *buffer, \ + static int lprocfs_wr_##var(struct file *file, const char *buffer, \ unsigned long count, void *data) \ { \ struct ldlm_pool *pl = data; \
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -2
@@ -546,13 +546,13 @@ static int ldlm_cli_pool_shrink(struct ldlm_pool *pl,return ldlm_cancel_lru (ns, nr,LCF_ASYNC ,LDLM_CANCEL_SHRINK ); } -struct ldlm_pool_ops ldlm_srv_pool_ops = { +static const 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 }; -struct ldlm_pool_ops ldlm_cli_pool_ops = { +static const struct ldlm_pool_ops ldlm_cli_pool_ops = { .po_recalc = ldlm_cli_pool_recalc, .po_shrink = ldlm_cli_pool_shrink };
drivers/staging/lustre/lustre/llite/lproc_llite.c +3 -3
@@ -44,9 +44,9 @@/* /proc/lustre/llite mount point registration */ extern struct file_operations vvp_dump_pgcache_file_ops; -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 struct file_operations ll_rw_extents_stats_fops; +static struct file_operations ll_rw_extents_stats_pp_fops; +static struct file_operations ll_rw_offset_stats_fops;static int ll_blksize_seq_show (struct seq_file *m,void *v) {
Signature · 1 line
1.9.1
PATCH 3/3 Staging: lustre: gfp_mask should be of gfp_t type
In reply to Fabio FalzoiFixed the following sparse complaints:
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1039:61:
warning: restricted gfp_t degrades to integerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1092:61:
warning: restricted gfp_t degrades to integerdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1136:58:
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_maskdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1142:34:
warning: incorrect type in argument 3 (different base types) expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_maskdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1147:58:
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_maskdrivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:1153:34:
warning: incorrect type in argument 3 (different base types) expected unsigned int [unsigned] gfp_mask
got restricted gfp_t [usertype] gfp_mask
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 4 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +2 -2
@@ -212,7 +212,7 @@ struct ldlm_pool_ops {int (*po_recalc)(struct ldlm_pool *pl);/** Cancel at least \a nr locks from pool \a pl */ int (*po_shrink)(struct ldlm_pool *pl,int nr, -unsigned int gfp_mask); +gfp_t gfp_mask);int (*po_setup)(struct ldlm_pool *pl,int limit); };
@@ -1463,7 +1463,7 @@ void ldlm_pools_fini(void);int ldlm_pool_init (struct ldlm_pool *pl,struct ldlm_namespace *ns,int idx,ldlm_side_t client);int ldlm_pool_shrink (struct ldlm_pool *pl,int nr, -unsigned int gfp_mask); +gfp_t gfp_mask);void ldlm_pool_fini (struct ldlm_pool *pl);int ldlm_pool_setup (struct ldlm_pool *pl,int limit);int ldlm_pool_recalc (struct ldlm_pool *pl);
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +5 -5
@@ -378,7 +378,7 @@ static int ldlm_srv_pool_recalc(struct ldlm_pool *pl)* locks smaller in next 10h. */ static int ldlm_srv_pool_shrink (struct ldlm_pool *pl, -int nr,unsigned int gfp_mask) +int nr,gfp_t gfp_mask) {__u32 limit;
@@ -518,7 +518,7 @@ static int ldlm_cli_pool_recalc(struct ldlm_pool *pl)* passed \a pl according to \a nr and \a gfp_mask. */ static int ldlm_cli_pool_shrink (struct ldlm_pool *pl, -int nr,unsigned int gfp_mask) +int nr,gfp_t gfp_mask) {struct ldlm_namespace *ns;int unused;
@@ -603,7 +603,7 @@ int ldlm_pool_recalc(struct ldlm_pool *pl)* freeable locks. Otherwise, return the number of canceled locks. */ int ldlm_pool_shrink (struct ldlm_pool *pl,int nr, -unsigned int gfp_mask) +gfp_t gfp_mask) {int cancel =0 ;
@@ -1029,7 +1029,7 @@ static struct completion ldlm_pools_comp;* count locks from all namespaces (if possible). Returns number of * cached locks. */ -static unsigned long ldlm_pools_count (ldlm_side_t client,unsigned int gfp_mask) +static unsigned long ldlm_pools_count (ldlm_side_t client,gfp_t gfp_mask) {int total =0 , nr_ns;struct ldlm_namespace *ns;
@@ -1082,7 +1082,7 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, unsigned int gfp_mask)return total; } -static unsigned long ldlm_pools_scan (ldlm_side_t client,int nr,unsigned int gfp_mask) +static unsigned long ldlm_pools_scan (ldlm_side_t client,int nr,gfp_t gfp_mask) {unsigned long freed =0 ;int tmp, nr_ns;
Signature · 1 line
1.9.1