From ed2430bd5a8b1b61ce9ae5c4a321598dee728199 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Tue, 22 Jul 2014 15:33:25 -0500 Subject: [PATCH] LU-5396: use gfp_t for gfp mask, instead of (unsigned) int This fixes sparse warnings, such as: .../echo.c:670:62: warning: incorrect type in initializer (different base types) .../echo.c:670:62: expected int [signed] gfp_mask .../echo.c:670:62: got restricted gfp_t gfp_t was introduced in 2.6.14 (end of 2005), so that should work all recent distributions. Besides using gfp_t, there is no code change. Signed-off-by: frank zago Change-Id: I3464fb21c47c174c3a04cb512ce05e0e9de146fb Reviewed-on: http://review.whamcloud.com/11200 Tested-by: Maloo Reviewed-by: John L. Hammond Tested-by: Jenkins Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/linux/linux-mem.h | 6 +++--- libcfs/libcfs/linux/linux-mem.c | 6 +++--- libcfs/libcfs/module.c | 3 ++- libcfs/libcfs/tracefile.c | 4 ++-- libcfs/libcfs/tracefile.h | 2 +- lustre/include/lustre_dlm.h | 6 ++---- lustre/ldlm/ldlm_pool.c | 15 +++++++-------- lustre/llite/lloop.c | 4 ++-- lustre/llite/rw.c | 2 +- lustre/obdecho/echo.c | 4 ++-- lustre/obdecho/echo_client.c | 2 +- lustre/ptlrpc/client.c | 2 +- lustre/ptlrpc/ptlrpc_internal.h | 2 +- 13 files changed, 28 insertions(+), 30 deletions(-) diff --git a/libcfs/include/libcfs/linux/linux-mem.h b/libcfs/include/libcfs/linux/linux-mem.h index 0ad0e6f..6b6553e 100644 --- a/libcfs/include/libcfs/linux/linux-mem.h +++ b/libcfs/include/libcfs/linux/linux-mem.h @@ -96,14 +96,14 @@ extern void *cfs_cpt_malloc(struct cfs_cpt_table *cptab, int cpt, - size_t nr_bytes, unsigned int flags); + size_t nr_bytes, gfp_t flags); extern void *cfs_cpt_vzalloc(struct cfs_cpt_table *cptab, int cpt, size_t nr_bytes); extern struct page *cfs_page_cpt_alloc(struct cfs_cpt_table *cptab, - int cpt, unsigned int flags); + int cpt, gfp_t flags); extern void *cfs_mem_cache_cpt_alloc(struct kmem_cache *cachep, struct cfs_cpt_table *cptab, - int cpt, unsigned int flags); + int cpt, gfp_t flags); /* * Shrinker diff --git a/libcfs/libcfs/linux/linux-mem.c b/libcfs/libcfs/linux/linux-mem.c index 0887a31..323ad88 100644 --- a/libcfs/libcfs/linux/linux-mem.c +++ b/libcfs/libcfs/linux/linux-mem.c @@ -43,7 +43,7 @@ void * cfs_cpt_malloc(struct cfs_cpt_table *cptab, int cpt, - size_t nr_bytes, unsigned int flags) + size_t nr_bytes, gfp_t flags) { return kmalloc_node(nr_bytes, flags, cfs_cpt_spread_node(cptab, cpt)); @@ -66,7 +66,7 @@ cfs_cpt_vzalloc(struct cfs_cpt_table *cptab, int cpt, size_t nr_bytes) EXPORT_SYMBOL(cfs_cpt_vzalloc); struct page * -cfs_page_cpt_alloc(struct cfs_cpt_table *cptab, int cpt, unsigned int flags) +cfs_page_cpt_alloc(struct cfs_cpt_table *cptab, int cpt, gfp_t flags) { return alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), flags, 0); } @@ -74,7 +74,7 @@ EXPORT_SYMBOL(cfs_page_cpt_alloc); void * cfs_mem_cache_cpt_alloc(struct kmem_cache *cachep, struct cfs_cpt_table *cptab, - int cpt, unsigned int flags) + int cpt, gfp_t flags) { return kmem_cache_alloc_node(cachep, flags, cfs_cpt_spread_node(cptab, cpt)); diff --git a/libcfs/libcfs/module.c b/libcfs/libcfs/module.c index 950db2f..efd4213 100644 --- a/libcfs/libcfs/module.c +++ b/libcfs/libcfs/module.c @@ -86,7 +86,8 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu) } int -kportal_memhog_alloc (struct libcfs_device_userstate *ldu, int npages, int flags) +kportal_memhog_alloc(struct libcfs_device_userstate *ldu, int npages, + gfp_t flags) { struct page **level0p; struct page **level1p; diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 1478a3a..53fa9d6 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -66,7 +66,7 @@ cfs_tage_from_list(struct list_head *list) return list_entry(list, struct cfs_trace_page, linkage); } -static struct cfs_trace_page *cfs_tage_alloc(int gfp) +static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp) { struct page *page; struct cfs_trace_page *tage; @@ -114,7 +114,7 @@ static void cfs_tage_to_tail(struct cfs_trace_page *tage, list_move_tail(&tage->linkage, queue); } -int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, int gfp, +int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp, struct list_head *stock) { int i; diff --git a/libcfs/libcfs/tracefile.h b/libcfs/libcfs/tracefile.h index d4fe104..9ba2ff7 100644 --- a/libcfs/libcfs/tracefile.h +++ b/libcfs/libcfs/tracefile.h @@ -302,7 +302,7 @@ static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd) put_cpu(); } -int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, int gfp, +int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp, struct list_head *stock); diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 7aab315..74a62b8 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -215,8 +215,7 @@ struct ldlm_pool_ops { /** Recalculate pool \a pl usage */ 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); + int (*po_shrink)(struct ldlm_pool *pl, int nr, gfp_t gfp_mask); int (*po_setup)(struct ldlm_pool *pl, int limit); }; @@ -1547,8 +1546,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); +int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, 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); diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c index 295cf0e..f3c620d 100644 --- a/lustre/ldlm/ldlm_pool.c +++ b/lustre/ldlm/ldlm_pool.c @@ -386,7 +386,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; @@ -537,7 +537,7 @@ out: * 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; @@ -633,8 +633,7 @@ int ldlm_pool_recalc(struct ldlm_pool *pl) * Pool shrink wrapper. Will call either client or server pool recalc callback * depending what pool \a pl is used. */ -int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, - unsigned int gfp_mask) +int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, gfp_t gfp_mask) { int cancel = 0; @@ -1062,7 +1061,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; @@ -1116,7 +1115,7 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, unsigned int gfp_mask) } static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, - unsigned int gfp_mask) + gfp_t gfp_mask) { unsigned long freed = 0; int tmp, nr_ns; @@ -1198,7 +1197,7 @@ static unsigned long ldlm_pools_cli_scan(struct shrinker *s, * cancel approximately equal amount of locks to keep balancing. */ static int ldlm_pools_shrink(ldlm_side_t client, int nr, - unsigned int gfp_mask) + gfp_t gfp_mask) { unsigned int total = 0; @@ -1535,7 +1534,7 @@ int ldlm_pool_recalc(struct ldlm_pool *pl) EXPORT_SYMBOL(ldlm_pool_recalc); int ldlm_pool_shrink(struct ldlm_pool *pl, - int nr, unsigned int gfp_mask) + int nr, gfp_t gfp_mask) { return 0; } diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c index 5c3bd7b..c053464 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -127,7 +127,7 @@ struct lloop_device { struct block_device *lo_device; unsigned lo_blocksize; - int old_gfp_mask; + gfp_t old_gfp_mask; spinlock_t lo_lock; struct bio *lo_bio; @@ -587,7 +587,7 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev, int count) { struct file *filp = lo->lo_backing_file; - int gfp = lo->old_gfp_mask; + gfp_t gfp = lo->old_gfp_mask; if (lo->lo_state != LLOOP_BOUND) return -ENXIO; diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 4aab3d1..4b8c539 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -297,7 +297,7 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io, struct page *vmpage; struct cl_page *page; enum ra_stat which = _NR_RA_STAT; /* keep gcc happy */ - unsigned int gfp_mask; + gfp_t gfp_mask; int rc = 0; const char *msg = NULL; diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 122eb70..74d3b9d9 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -291,7 +291,7 @@ static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj, struct niobuf_remote *nb, int *pages, struct niobuf_local *lb, int cmd, int *left) { - int gfp_mask = (ostid_id(&obj->ioo_oid) & 1) ? + gfp_t gfp_mask = (ostid_id(&obj->ioo_oid) & 1) ? GFP_HIGHUSER : GFP_IOFS; int ispersistent = ostid_id(&obj->ioo_oid) == ECHO_PERSISTENT_OBJID; int debug_setup = (!ispersistent && @@ -668,7 +668,7 @@ int echo_persistent_pages_init(void) int i; for (i = 0; i < ECHO_PERSISTENT_PAGES; i++) { - int gfp_mask = (i < ECHO_PERSISTENT_PAGES/2) ? + gfp_t gfp_mask = (i < ECHO_PERSISTENT_PAGES/2) ? GFP_IOFS : GFP_HIGHUSER; OBD_PAGE_ALLOC(pg, gfp_mask); diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 8b1a526..c7fcb5b 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2405,7 +2405,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, int i; int rc; int verify; - int gfp_mask; + gfp_t gfp_mask; int brw_flags = 0; ENTRY; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 1621367..6416e5f 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -406,7 +406,7 @@ void ptlrpc_request_cache_fini(void) kmem_cache_destroy(request_cache); } -struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags) +struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags) { struct ptlrpc_request *req; diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index 5530e7a..9d8bd46 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -58,7 +58,7 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned npages, unsigned max_brw, unsigned type, unsigned portal); int ptlrpc_request_cache_init(void); void ptlrpc_request_cache_fini(void); -struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags); +struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags); void ptlrpc_request_cache_free(struct ptlrpc_request *req); void ptlrpc_init_xid(void); -- 1.8.3.1