[PATCH 01/14] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.
All usages of the form LIBCFS_ALLOC(variable, sizeof(variable)) or LIBCFS_ALLOC(variable, sizeof(variable's-type)) are changed to variable = kzalloc(sizeof(...), GFP_NOFS); Similarly, all LIBCFS_FREE(variable, sizeof(variable)) become kfree(variable); None of these need the vmalloc option, or any of the other minor benefits of LIBCFS_ALLOC(). Signed-off-by: NeilBrown--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 39 ++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |4 +- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c |4 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c| 22 ++- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |2 + .../lustre/lnet/klnds/socklnd/socklnd_proto.c |8 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c|4 +- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c |6 ++- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 10 +++-- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 19 -- drivers/staging/lustre/lnet/libcfs/workitem.c |8 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c |4 +- drivers/staging/lustre/lnet/lnet/config.c |7 ++-- drivers/staging/lustre/lnet/lnet/lib-move.c|6 ++- drivers/staging/lustre/lnet/lnet/nidstrings.c |8 ++-- drivers/staging/lustre/lnet/lnet/peer.c|2 + drivers/staging/lustre/lnet/lnet/router.c | 28 ++ drivers/staging/lustre/lnet/lnet/router_proc.c |6 ++- drivers/staging/lustre/lnet/selftest/conrpc.c | 10 +++-- drivers/staging/lustre/lnet/selftest/console.c | 26 +++-- drivers/staging/lustre/lnet/selftest/framework.c | 22 ++- drivers/staging/lustre/lnet/selftest/rpc.c | 12 +++--- 22 files changed, 124 insertions(+), 133 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 8024843521ab..3aa81168c84f 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -367,7 +367,7 @@ void kiblnd_destroy_peer(struct kib_peer *peer) LASSERT(kiblnd_peer_idle(peer)); LASSERT(list_empty(>ibp_tx_queue)); - LIBCFS_FREE(peer, sizeof(*peer)); + kfree(peer); /* * NB a peer's connections keep a reference on their peer until @@ -776,7 +776,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm goto failed_2; } - LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr)); + kfree(init_qp_attr); /* 1 ref for caller and each rxmsg */ atomic_set(>ibc_refcount, 1 + IBLND_RX_MSGS(conn)); @@ -828,7 +828,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm failed_2: kiblnd_destroy_conn(conn, true); failed_1: - LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr)); + kfree(init_qp_attr); failed_0: return NULL; } @@ -882,8 +882,7 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) IBLND_RX_MSGS(conn) * sizeof(struct kib_rx)); } - if (conn->ibc_connvars) - LIBCFS_FREE(conn->ibc_connvars, sizeof(*conn->ibc_connvars)); + kfree(conn->ibc_connvars); if (conn->ibc_hdev) kiblnd_hdev_decref(conn->ibc_hdev); @@ -897,7 +896,7 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) atomic_dec(>ibn_nconns); } - LIBCFS_FREE(conn, sizeof(*conn)); + kfree(conn); } int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why) @@ -1299,7 +1298,7 @@ static void kiblnd_destroy_fmr_pool(struct kib_fmr_pool *fpo) frd_list) { list_del(>frd_list); ib_dereg_mr(frd->frd_mr); - LIBCFS_FREE(frd, sizeof(*frd)); + kfree(frd); i++; } if (i < fpo->fast_reg.fpo_pool_size) @@ -1310,7 +1309,7 @@ static void kiblnd_destroy_fmr_pool(struct kib_fmr_pool *fpo) if (fpo->fpo_hdev) kiblnd_hdev_decref(fpo->fpo_hdev); - LIBCFS_FREE(fpo, sizeof(*fpo)); + kfree(fpo); } static void kiblnd_destroy_fmr_pool_list(struct list_head *head) @@ -1405,14 +1404,14 @@ static int kiblnd_alloc_freg_pool(struct kib_fmr_poolset *fps, struct kib_fmr_po out_middle: if (frd->frd_mr) ib_dereg_mr(frd->frd_mr); - LIBCFS_FREE(frd, sizeof(*frd)); + kfree(frd); out: list_for_each_entry_safe(frd, tmp, >fast_reg.fpo_pool_list, frd_list) { list_del(>frd_list); ib_dereg_mr(frd->frd_mr); - LIBCFS_FREE(frd,
[PATCH 01/14] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.
All usages of the form LIBCFS_ALLOC(variable, sizeof(variable)) or LIBCFS_ALLOC(variable, sizeof(variable's-type)) are changed to variable = kzalloc(sizeof(...), GFP_NOFS); Similarly, all LIBCFS_FREE(variable, sizeof(variable)) become kfree(variable); None of these need the vmalloc option, or any of the other minor benefits of LIBCFS_ALLOC(). Signed-off-by: NeilBrown --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 39 ++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |4 +- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c |4 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c| 22 ++- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |2 + .../lustre/lnet/klnds/socklnd/socklnd_proto.c |8 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c|4 +- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c |6 ++- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 10 +++-- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 19 -- drivers/staging/lustre/lnet/libcfs/workitem.c |8 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c |4 +- drivers/staging/lustre/lnet/lnet/config.c |7 ++-- drivers/staging/lustre/lnet/lnet/lib-move.c|6 ++- drivers/staging/lustre/lnet/lnet/nidstrings.c |8 ++-- drivers/staging/lustre/lnet/lnet/peer.c|2 + drivers/staging/lustre/lnet/lnet/router.c | 28 ++ drivers/staging/lustre/lnet/lnet/router_proc.c |6 ++- drivers/staging/lustre/lnet/selftest/conrpc.c | 10 +++-- drivers/staging/lustre/lnet/selftest/console.c | 26 +++-- drivers/staging/lustre/lnet/selftest/framework.c | 22 ++- drivers/staging/lustre/lnet/selftest/rpc.c | 12 +++--- 22 files changed, 124 insertions(+), 133 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 8024843521ab..3aa81168c84f 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -367,7 +367,7 @@ void kiblnd_destroy_peer(struct kib_peer *peer) LASSERT(kiblnd_peer_idle(peer)); LASSERT(list_empty(>ibp_tx_queue)); - LIBCFS_FREE(peer, sizeof(*peer)); + kfree(peer); /* * NB a peer's connections keep a reference on their peer until @@ -776,7 +776,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm goto failed_2; } - LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr)); + kfree(init_qp_attr); /* 1 ref for caller and each rxmsg */ atomic_set(>ibc_refcount, 1 + IBLND_RX_MSGS(conn)); @@ -828,7 +828,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm failed_2: kiblnd_destroy_conn(conn, true); failed_1: - LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr)); + kfree(init_qp_attr); failed_0: return NULL; } @@ -882,8 +882,7 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) IBLND_RX_MSGS(conn) * sizeof(struct kib_rx)); } - if (conn->ibc_connvars) - LIBCFS_FREE(conn->ibc_connvars, sizeof(*conn->ibc_connvars)); + kfree(conn->ibc_connvars); if (conn->ibc_hdev) kiblnd_hdev_decref(conn->ibc_hdev); @@ -897,7 +896,7 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) atomic_dec(>ibn_nconns); } - LIBCFS_FREE(conn, sizeof(*conn)); + kfree(conn); } int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why) @@ -1299,7 +1298,7 @@ static void kiblnd_destroy_fmr_pool(struct kib_fmr_pool *fpo) frd_list) { list_del(>frd_list); ib_dereg_mr(frd->frd_mr); - LIBCFS_FREE(frd, sizeof(*frd)); + kfree(frd); i++; } if (i < fpo->fast_reg.fpo_pool_size) @@ -1310,7 +1309,7 @@ static void kiblnd_destroy_fmr_pool(struct kib_fmr_pool *fpo) if (fpo->fpo_hdev) kiblnd_hdev_decref(fpo->fpo_hdev); - LIBCFS_FREE(fpo, sizeof(*fpo)); + kfree(fpo); } static void kiblnd_destroy_fmr_pool_list(struct list_head *head) @@ -1405,14 +1404,14 @@ static int kiblnd_alloc_freg_pool(struct kib_fmr_poolset *fps, struct kib_fmr_po out_middle: if (frd->frd_mr) ib_dereg_mr(frd->frd_mr); - LIBCFS_FREE(frd, sizeof(*frd)); + kfree(frd); out: list_for_each_entry_safe(frd, tmp, >fast_reg.fpo_pool_list, frd_list) { list_del(>frd_list); ib_dereg_mr(frd->frd_mr); - LIBCFS_FREE(frd, sizeof(*frd)); +