Whamcloud - gitweb
LU-5396: use gfp_t for gfp mask, instead of (unsigned) int 00/11200/3
authorFrank Zago <fzago@cray.com>
Tue, 22 Jul 2014 20:33:25 +0000 (15:33 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 27 Aug 2014 16:00:52 +0000 (16:00 +0000)
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 <fzago@cray.com>
Change-Id: I3464fb21c47c174c3a04cb512ce05e0e9de146fb
Reviewed-on: http://review.whamcloud.com/11200
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
13 files changed:
libcfs/include/libcfs/linux/linux-mem.h
libcfs/libcfs/linux/linux-mem.c
libcfs/libcfs/module.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h
lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_pool.c
lustre/llite/lloop.c
lustre/llite/rw.c
lustre/obdecho/echo.c
lustre/obdecho/echo_client.c
lustre/ptlrpc/client.c
lustre/ptlrpc/ptlrpc_internal.h

index 0ad0e6f..6b6553e 100644 (file)
 
 
 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
index 0887a31..323ad88 100644 (file)
@@ -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));
index 950db2f..efd4213 100644 (file)
@@ -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;
index 1478a3a..53fa9d6 100644 (file)
@@ -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;
index d4fe104..9ba2ff7 100644 (file)
@@ -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);
 
 
index 7aab315..74a62b8 100644 (file)
@@ -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);
index 295cf0e..f3c620d 100644 (file)
@@ -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;
 }
index 5c3bd7b..c053464 100644 (file)
@@ -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;
index 4aab3d1..4b8c539 100644 (file)
@@ -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;
 
index 122eb70..74d3b9d 100644 (file)
@@ -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);
index 8b1a526..c7fcb5b 100644 (file)
@@ -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;
 
index 1621367..6416e5f 100644 (file)
@@ -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;
 
index 5530e7a..9d8bd46 100644 (file)
@@ -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);