From 0bd3fc672123c5ca6ec01295532d06cec95b4492 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 17 Jul 2008 18:23:32 +0000 Subject: [PATCH] Use gfp_t instead of int to hold GFP_* masks. Signed-off-by: Dotan Barak git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@465 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/event.c | 2 +- scst/include/scst.h | 6 +++--- scst/src/dev_handlers/scst_user.c | 9 +++++---- scst/src/scst_lib.c | 14 +++++++------- scst/src/scst_mem.c | 8 ++++---- scst/src/scst_priv.h | 8 ++++---- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/iscsi-scst/kernel/event.c b/iscsi-scst/kernel/event.c index e3e224314..ac99037ed 100644 --- a/iscsi-scst/kernel/event.c +++ b/iscsi-scst/kernel/event.c @@ -86,7 +86,7 @@ static void event_recv(struct sock *sk, int length) } #endif -static int notify(void *data, int len, int gfp_mask) +static int notify(void *data, int len, gfp_t gfp_mask) { struct sk_buff *skb; struct nlmsghdr *nlh; diff --git a/scst/include/scst.h b/scst/include/scst.h index d94c6e4bb..218b06787 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1455,7 +1455,7 @@ struct scst_tgt_dev { /* How many cmds alive on this dev in this session */ atomic_t tgt_dev_cmd_count; - int gfp_mask; + gfp_t gfp_mask; struct sgv_pool *pool; int max_sg_cnt; @@ -2624,7 +2624,7 @@ void scst_cmd_put(struct scst_cmd *cmd); * In *count returned the count of entries in the vector. * Returns NULL for failure. */ -struct scatterlist *scst_alloc(int size, unsigned long gfp_mask, int *count); +struct scatterlist *scst_alloc(int size, gfp_t gfp_mask, int *count); /* Frees SG vector returned by scst_alloc() */ void scst_free(struct scatterlist *sg, int count); @@ -2679,7 +2679,7 @@ void sgv_pool_set_allocator(struct sgv_pool *pool, void (*free_pages_fn)(struct scatterlist *, int, void *)); struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, - unsigned long gfp_mask, int flags, int *count, + gfp_t gfp_mask, int flags, int *count, struct sgv_pool_obj **sgv, struct scst_mem_lim *mem_lim, void *priv); void sgv_pool_free(struct sgv_pool_obj *sgv, struct scst_mem_lim *mem_lim); diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 8d2f8e842..232ae53de 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -137,7 +137,7 @@ struct scst_user_cmd { }; static struct scst_user_cmd *dev_user_alloc_ucmd(struct scst_user_dev *dev, - int gfp_mask); + gfp_t gfp_mask); static void dev_user_free_ucmd(struct scst_user_cmd *ucmd); static int dev_user_parse(struct scst_cmd *cmd); @@ -484,7 +484,8 @@ static int dev_user_alloc_sg(struct scst_user_cmd *ucmd, int cached_buff) int res = 0; struct scst_cmd *cmd = ucmd->cmd; struct scst_user_dev *dev = ucmd->dev; - int gfp_mask, flags = 0; + gfp_t gfp_mask; + int flags = 0; int bufflen = cmd->bufflen; int last_len = 0; @@ -636,7 +637,7 @@ out: } static struct scst_user_cmd *dev_user_alloc_ucmd(struct scst_user_dev *dev, - int gfp_mask) + gfp_t gfp_mask) { struct scst_user_cmd *ucmd = NULL; @@ -683,7 +684,7 @@ static int dev_user_parse(struct scst_cmd *cmd) struct scst_user_cmd *ucmd; int atomic = scst_cmd_atomic(cmd); struct scst_user_dev *dev = (struct scst_user_dev *)cmd->dev->dh_priv; - int gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; + gfp_t gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; TRACE_ENTRY(); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index e2f6ba5e2..ac64f1a02 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -45,7 +45,7 @@ static void scst_check_internal_sense(struct scst_device *dev, int result, int scst_alloc_sense(struct scst_cmd *cmd, int atomic) { int res = 0; - unsigned long gfp_mask = atomic ? GFP_ATOMIC : (GFP_KERNEL|__GFP_NOFAIL); + gfp_t gfp_mask = atomic ? GFP_ATOMIC : (GFP_KERNEL|__GFP_NOFAIL); TRACE_ENTRY(); @@ -278,7 +278,7 @@ out: EXPORT_SYMBOL(scst_set_resp_data_len); /* Called under scst_mutex and suspended activity */ -int scst_alloc_device(int gfp_mask, struct scst_device **out_dev) +int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev) { struct scst_device *dev; int res = 0; @@ -955,7 +955,7 @@ struct scst_cmd *scst_create_prepare_internal_cmd( struct scst_cmd *orig_cmd, int bufsize) { struct scst_cmd *res; - int gfp_mask = scst_cmd_atomic(orig_cmd) ? GFP_ATOMIC : GFP_KERNEL; + gfp_t gfp_mask = scst_cmd_atomic(orig_cmd) ? GFP_ATOMIC : GFP_KERNEL; TRACE_ENTRY(); @@ -1215,7 +1215,7 @@ static void scst_clear_reservation(struct scst_tgt_dev *tgt_dev) return; } -struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask, +struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, const char *initiator_name) { struct scst_session *sess; @@ -1354,7 +1354,7 @@ void scst_cmd_put(struct scst_cmd *cmd) } EXPORT_SYMBOL(scst_cmd_put); -struct scst_cmd *scst_alloc_cmd(int gfp_mask) +struct scst_cmd *scst_alloc_cmd(gfp_t gfp_mask) { struct scst_cmd *cmd; @@ -1556,7 +1556,7 @@ void scst_tgt_retry_timer_fn(unsigned long arg) return; } -struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(int gfp_mask) +struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(gfp_t gfp_mask) { struct scst_mgmt_cmd *mcmd; @@ -1641,7 +1641,7 @@ void scst_release_request(struct scst_cmd *cmd) int scst_alloc_space(struct scst_cmd *cmd) { - int gfp_mask; + gfp_t gfp_mask; int res = -ENOMEM; int atomic = scst_cmd_atomic(cmd); int flags; diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index b0bde505d..52279da41 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -255,7 +255,7 @@ out_no_mem: } static int sgv_alloc_arrays(struct sgv_pool_obj *obj, - int pages_to_alloc, int order, unsigned long gfp_mask) + int pages_to_alloc, int order, gfp_t gfp_mask) { int sz, tsz = 0; int res = 0; @@ -327,7 +327,7 @@ static void sgv_dtor_and_free(struct sgv_pool_obj *obj) } static struct sgv_pool_obj *sgv_pool_cached_get(struct sgv_pool *pool, - int order, unsigned long gfp_mask) + int order, gfp_t gfp_mask) { struct sgv_pool_obj *obj; int pages = 1 << order; @@ -561,7 +561,7 @@ static void scst_uncheck_allowed_mem(struct scst_mem_lim *mem_lim, int pages) } struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size, - unsigned long gfp_mask, int flags, int *count, + gfp_t gfp_mask, int flags, int *count, struct sgv_pool_obj **sgv, struct scst_mem_lim *mem_lim, void *priv) { struct sgv_pool_obj *obj; @@ -840,7 +840,7 @@ void sgv_pool_free(struct sgv_pool_obj *sgv, struct scst_mem_lim *mem_lim) } EXPORT_SYMBOL(sgv_pool_free); -struct scatterlist *scst_alloc(int size, unsigned long gfp_mask, int *count) +struct scatterlist *scst_alloc(int size, gfp_t gfp_mask, int *count) { struct scatterlist *res; int pages = (size >> PAGE_SHIFT) + ((size & ~PAGE_MASK) != 0); diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 2bda16067..e3a47267f 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -273,7 +273,7 @@ int scst_mgmt_thread(void *arg); int scst_add_dev_threads(struct scst_device *dev, int num); void scst_del_dev_threads(struct scst_device *dev, int num); -int scst_alloc_device(int gfp_mask, struct scst_device **out_dev); +int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev); void scst_free_device(struct scst_device *dev); struct scst_acg *scst_alloc_add_acg(const char *acg_name); @@ -302,12 +302,12 @@ struct scst_cmd *scst_complete_request_sense(struct scst_cmd *cmd); int scst_assign_dev_handler(struct scst_device *dev, struct scst_dev_type *handler); -struct scst_session *scst_alloc_session(struct scst_tgt *tgt, int gfp_mask, +struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, const char *initiator_name); void scst_free_session(struct scst_session *sess); void scst_free_session_callback(struct scst_session *sess); -struct scst_cmd *scst_alloc_cmd(int gfp_mask); +struct scst_cmd *scst_alloc_cmd(gfp_t gfp_mask); void scst_free_cmd(struct scst_cmd *cmd); static inline void scst_destroy_cmd(struct scst_cmd *cmd) { @@ -364,7 +364,7 @@ uint64_t scst_unpack_lun(const uint8_t *lun, int len); struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag); -struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(int gfp_mask); +struct scst_mgmt_cmd *scst_alloc_mgmt_cmd(gfp_t gfp_mask); void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd); void scst_done_cmd_mgmt(struct scst_cmd *cmd);