Whamcloud - gitweb
LU-9679 lnet: use LIST_HEAD() for local lists. 54/36954/4
authorMr NeilBrown <neilb@suse.de>
Thu, 5 Dec 2019 05:56:16 +0000 (16:56 +1100)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Feb 2020 04:00:27 +0000 (04:00 +0000)
When declaring a local list head, instead of

   struct list_head list;
   INIT_LIST_HEAD(&list);

use
   LIST_HEAD(list);

which does both steps.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ia1f1f1abf1b8a9f50e3033976990010b1d2100db
Reviewed-on: https://review.whamcloud.com/36954
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/gnilnd/gnilnd_cb.c
lnet/klnds/gnilnd/gnilnd_conn.c
lnet/klnds/o2iblnd/o2iblnd_cb.c
lnet/klnds/socklnd/socklnd_cb.c
lnet/lnet/api-ni.c
lnet/lnet/config.c
lnet/lnet/lib-move.c
lnet/lnet/net_fault.c
lnet/lnet/peer.c
lnet/lnet/router.c
lnet/selftest/console.c

index 812f6f2..93cae3d 100644 (file)
@@ -2983,11 +2983,8 @@ kgnilnd_reaper_check(int idx)
 {
        struct list_head  *peers = &kgnilnd_data.kgn_peers[idx];
        struct list_head  *ctmp, *ctmpN;
 {
        struct list_head  *peers = &kgnilnd_data.kgn_peers[idx];
        struct list_head  *ctmp, *ctmpN;
-       struct list_head   geriatrics;
-       struct list_head   souls;
-
-       INIT_LIST_HEAD(&geriatrics);
-       INIT_LIST_HEAD(&souls);
+       LIST_HEAD(geriatrics);
+       LIST_HEAD(souls);
 
        write_lock(&kgnilnd_data.kgn_peer_conn_lock);
 
 
        write_lock(&kgnilnd_data.kgn_peer_conn_lock);
 
index 047e8a6..9fa539c 100644 (file)
@@ -1546,9 +1546,9 @@ failed:
 int
 kgnilnd_cancel_net_dgrams(kgn_net_t *net)
 {
 int
 kgnilnd_cancel_net_dgrams(kgn_net_t *net)
 {
-       kgn_dgram_t            *dg, *dgN;
-       struct list_head        zombies;
-       int                     i;
+       kgn_dgram_t *dg, *dgN;
+       LIST_HEAD(zombies);
+       int i;
        ENTRY;
 
        /* we want to cancel any outstanding dgrams - we don't want to rely
        ENTRY;
 
        /* we want to cancel any outstanding dgrams - we don't want to rely
@@ -1561,8 +1561,6 @@ kgnilnd_cancel_net_dgrams(kgn_net_t *net)
                 "in reset %d\n", net->gnn_shutdown,
                 kgnilnd_data.kgn_in_reset);
 
                 "in reset %d\n", net->gnn_shutdown,
                 kgnilnd_data.kgn_in_reset);
 
-       INIT_LIST_HEAD(&zombies);
-
        spin_lock(&net->gnn_dev->gnd_dgram_lock);
 
        for (i = 0; i < *kgnilnd_tunables.kgn_peer_hash_size; i++) {
        spin_lock(&net->gnn_dev->gnd_dgram_lock);
 
        for (i = 0; i < *kgnilnd_tunables.kgn_peer_hash_size; i++) {
@@ -1588,7 +1586,7 @@ int
 kgnilnd_cancel_wc_dgrams(kgn_device_t *dev)
 {
        kgn_dgram_t *dg, *dgN;
 kgnilnd_cancel_wc_dgrams(kgn_device_t *dev)
 {
        kgn_dgram_t *dg, *dgN;
-       struct list_head zombies;
+       LIST_HEAD(zombies);
        ENTRY;
 
        /* Time to kill the outstanding WC's
        ENTRY;
 
        /* Time to kill the outstanding WC's
@@ -1600,7 +1598,6 @@ kgnilnd_cancel_wc_dgrams(kgn_device_t *dev)
                "in reset %d\n", kgnilnd_data.kgn_wc_kill,
                kgnilnd_data.kgn_in_reset);
 
                "in reset %d\n", kgnilnd_data.kgn_wc_kill,
                kgnilnd_data.kgn_in_reset);
 
-       INIT_LIST_HEAD(&zombies);
        spin_lock(&dev->gnd_dgram_lock);
 
        do {
        spin_lock(&dev->gnd_dgram_lock);
 
        do {
index 0e58ee6..d842943 100644 (file)
@@ -1464,12 +1464,10 @@ kiblnd_connect_peer(struct kib_peer_ni *peer_ni)
 bool
 kiblnd_reconnect_peer(struct kib_peer_ni *peer_ni)
 {
 bool
 kiblnd_reconnect_peer(struct kib_peer_ni *peer_ni)
 {
-       rwlock_t         *glock = &kiblnd_data.kib_global_lock;
-       char             *reason = NULL;
-       struct list_head  txs;
-       unsigned long     flags;
-
-       INIT_LIST_HEAD(&txs);
+       rwlock_t *glock = &kiblnd_data.kib_global_lock;
+       char *reason = NULL;
+       LIST_HEAD(txs);
+       unsigned long flags;
 
        write_lock_irqsave(glock, flags);
        if (peer_ni->ibp_reconnecting == 0) {
 
        write_lock_irqsave(glock, flags);
        if (peer_ni->ibp_reconnecting == 0) {
@@ -2295,7 +2293,7 @@ kiblnd_connreq_done(struct kib_conn *conn, int status)
 {
        struct kib_peer_ni *peer_ni = conn->ibc_peer;
        struct kib_tx *tx;
 {
        struct kib_peer_ni *peer_ni = conn->ibc_peer;
        struct kib_tx *tx;
-       struct list_head txs;
+       LIST_HEAD(txs);
        unsigned long    flags;
        int              active;
 
        unsigned long    flags;
        int              active;
 
@@ -2352,7 +2350,6 @@ kiblnd_connreq_done(struct kib_conn *conn, int status)
         }
 
        /* grab pending txs while I have the lock */
         }
 
        /* grab pending txs while I have the lock */
-       INIT_LIST_HEAD(&txs);
        list_splice_init(&peer_ni->ibp_tx_queue, &txs);
 
         if (!kiblnd_peer_active(peer_ni) ||        /* peer_ni has been deleted */
        list_splice_init(&peer_ni->ibp_tx_queue, &txs);
 
         if (!kiblnd_peer_active(peer_ni) ||        /* peer_ni has been deleted */
index 091637f..88000c9 100644 (file)
@@ -2608,7 +2608,7 @@ int ksocknal_reaper(void *arg)
        wait_queue_entry_t wait;
        struct ksock_conn *conn;
        struct ksock_sched *sched;
        wait_queue_entry_t wait;
        struct ksock_conn *conn;
        struct ksock_sched *sched;
-       struct list_head enomem_conns;
+       LIST_HEAD(enomem_conns);
        int nenomem_conns;
        time64_t timeout;
        int i;
        int nenomem_conns;
        time64_t timeout;
        int i;
@@ -2617,7 +2617,6 @@ int ksocknal_reaper(void *arg)
 
         cfs_block_allsigs ();
 
 
         cfs_block_allsigs ();
 
-       INIT_LIST_HEAD(&enomem_conns);
        init_waitqueue_entry(&wait, current);
 
        spin_lock_bh(&ksocknal_data.ksnd_reaper_lock);
        init_waitqueue_entry(&wait, current);
 
        spin_lock_bh(&ksocknal_data.ksnd_reaper_lock);
index a3a7e75..c3956d7 100644 (file)
@@ -2143,11 +2143,9 @@ static void
 lnet_shutdown_lndnets(void)
 {
        struct lnet_net *net;
 lnet_shutdown_lndnets(void)
 {
        struct lnet_net *net;
-       struct list_head resend;
+       LIST_HEAD(resend);
        struct lnet_msg *msg, *tmp;
 
        struct lnet_msg *msg, *tmp;
 
-       INIT_LIST_HEAD(&resend);
-
        /* NB called holding the global mutex */
 
        /* All quiet on the API front */
        /* NB called holding the global mutex */
 
        /* All quiet on the API front */
@@ -2278,21 +2276,19 @@ static int
 lnet_startup_lndnet(struct lnet_net *net, struct lnet_lnd_tunables *tun)
 {
        struct lnet_ni *ni;
 lnet_startup_lndnet(struct lnet_net *net, struct lnet_lnd_tunables *tun)
 {
        struct lnet_ni *ni;
-       struct lnet_net *net_l = NULL;
-       struct list_head        local_ni_list;
-       int                     rc;
-       int                     ni_count = 0;
-       __u32                   lnd_type;
+       struct lnet_net *net_l = NULL;
+       LIST_HEAD(local_ni_list);
+       int rc;
+       int ni_count = 0;
+       __u32 lnd_type;
        const struct lnet_lnd  *lnd;
        const struct lnet_lnd  *lnd;
-       int                     peer_timeout =
+       int peer_timeout =
                net->net_tunables.lct_peer_timeout;
                net->net_tunables.lct_peer_timeout;
-       int                     maxtxcredits =
+       int maxtxcredits =
                net->net_tunables.lct_max_tx_credits;
                net->net_tunables.lct_max_tx_credits;
-       int                     peerrtrcredits =
+       int peerrtrcredits =
                net->net_tunables.lct_peer_rtr_credits;
 
                net->net_tunables.lct_peer_rtr_credits;
 
-       INIT_LIST_HEAD(&local_ni_list);
-
        /*
         * make sure that this net is unique. If it isn't then
         * we are adding interfaces to an already existing network, and
        /*
         * make sure that this net is unique. If it isn't then
         * we are adding interfaces to an already existing network, and
@@ -2590,11 +2586,9 @@ LNetNIInit(lnet_pid_t requested_pid)
        int                     ni_count;
        struct lnet_ping_buffer *pbuf;
        struct lnet_handle_md   ping_mdh;
        int                     ni_count;
        struct lnet_ping_buffer *pbuf;
        struct lnet_handle_md   ping_mdh;
-       struct list_head        net_head;
+       LIST_HEAD(net_head);
        struct lnet_net         *net;
 
        struct lnet_net         *net;
 
-       INIT_LIST_HEAD(&net_head);
-
        mutex_lock(&the_lnet.ln_api_mutex);
 
        CDEBUG(D_OTHER, "refs %d\n", the_lnet.ln_refcount);
        mutex_lock(&the_lnet.ln_api_mutex);
 
        CDEBUG(D_OTHER, "refs %d\n", the_lnet.ln_refcount);
@@ -3181,9 +3175,7 @@ static int lnet_handle_legacy_ip2nets(char *ip2nets,
        struct lnet_net *net;
        char *nets;
        int rc;
        struct lnet_net *net;
        char *nets;
        int rc;
-       struct list_head net_head;
-
-       INIT_LIST_HEAD(&net_head);
+       LIST_HEAD(net_head);
 
        rc = lnet_parse_ip2nets(&nets, ip2nets);
        if (rc < 0)
 
        rc = lnet_parse_ip2nets(&nets, ip2nets);
        if (rc < 0)
@@ -3362,14 +3354,12 @@ unlock_api_mutex:
 int
 lnet_dyn_add_net(struct lnet_ioctl_config_data *conf)
 {
 int
 lnet_dyn_add_net(struct lnet_ioctl_config_data *conf)
 {
-       struct lnet_net         *net;
-       struct list_head        net_head;
-       int                     rc;
+       struct lnet_net *net;
+       LIST_HEAD(net_head);
+       int rc;
        struct lnet_ioctl_config_lnd_tunables tun;
        char *nets = conf->cfg_config_u.cfg_net.net_intf;
 
        struct lnet_ioctl_config_lnd_tunables tun;
        char *nets = conf->cfg_config_u.cfg_net.net_intf;
 
-       INIT_LIST_HEAD(&net_head);
-
        /* Create a net/ni structures for the network string */
        rc = lnet_parse_networks(&net_head, nets, use_tcp_bonding);
        if (rc <= 0)
        /* Create a net/ni structures for the network string */
        rc = lnet_parse_networks(&net_head, nets, use_tcp_bonding);
        if (rc <= 0)
index e375cd6..9559975 100644 (file)
@@ -904,13 +904,11 @@ lnet_free_text_bufs(struct list_head *tbs)
 static int
 lnet_str2tbs_sep(struct list_head *tbs, char *str)
 {
 static int
 lnet_str2tbs_sep(struct list_head *tbs, char *str)
 {
-       struct list_head  pending;
-       char             *sep;
-       int               nob;
-       int               i;
-       struct lnet_text_buf  *ltb;
-
-       INIT_LIST_HEAD(&pending);
+       LIST_HEAD(pending);
+       char *sep;
+       int nob;
+       int i;
+       struct lnet_text_buf *ltb;
 
        /* Split 'str' into separate commands */
        for (;;) {
 
        /* Split 'str' into separate commands */
        for (;;) {
@@ -988,7 +986,7 @@ static int
 lnet_str2tbs_expand(struct list_head *tbs, char *str)
 {
        char              num[16];
 lnet_str2tbs_expand(struct list_head *tbs, char *str)
 {
        char              num[16];
-       struct list_head  pending;
+       LIST_HEAD(pending);
        char             *sep;
        char             *sep2;
        char             *parsed;
        char             *sep;
        char             *sep2;
        char             *parsed;
@@ -1000,8 +998,6 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
        int               nob;
        int               scanned;
 
        int               nob;
        int               scanned;
 
-       INIT_LIST_HEAD(&pending);
-
        sep = strchr(str, '[');
        if (sep == NULL)                        /* nothing to expand */
                return 0;
        sep = strchr(str, '[');
        if (sep == NULL)                        /* nothing to expand */
                return 0;
@@ -1111,10 +1107,10 @@ static int
 lnet_parse_route (char *str, int *im_a_router)
 {
        /* static scratch buffer OK (single threaded) */
 lnet_parse_route (char *str, int *im_a_router)
 {
        /* static scratch buffer OK (single threaded) */
-       static char       cmd[LNET_SINGLE_TEXTBUF_NOB];
+       static char cmd[LNET_SINGLE_TEXTBUF_NOB];
 
 
-       struct list_head  nets;
-       struct list_head  gateways;
+       LIST_HEAD(nets);
+       LIST_HEAD(gateways);
        struct list_head *tmp1;
        struct list_head *tmp2;
        __u32             net;
        struct list_head *tmp1;
        struct list_head *tmp2;
        __u32             net;
@@ -1129,9 +1125,6 @@ lnet_parse_route (char *str, int *im_a_router)
        int               got_hops = 0;
        unsigned int      priority = 0;
 
        int               got_hops = 0;
        unsigned int      priority = 0;
 
-       INIT_LIST_HEAD(&gateways);
-       INIT_LIST_HEAD(&nets);
-
        /* save a copy of the string for error messages */
        strncpy(cmd, str, sizeof(cmd));
        cmd[sizeof(cmd) - 1] = '\0';
        /* save a copy of the string for error messages */
        strncpy(cmd, str, sizeof(cmd));
        cmd[sizeof(cmd) - 1] = '\0';
@@ -1276,13 +1269,11 @@ lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
 int
 lnet_parse_routes (char *routes, int *im_a_router)
 {
 int
 lnet_parse_routes (char *routes, int *im_a_router)
 {
-       struct list_head tbs;
-       int              rc = 0;
+       LIST_HEAD(tbs);
+       int rc = 0;
 
        *im_a_router = 0;
 
 
        *im_a_router = 0;
 
-       INIT_LIST_HEAD(&tbs);
-
        if (lnet_str2tbs_sep(&tbs, routes) < 0) {
                CERROR("Error parsing routes\n");
                rc = -EINVAL;
        if (lnet_str2tbs_sep(&tbs, routes) < 0) {
                CERROR("Error parsing routes\n");
                rc = -EINVAL;
@@ -1475,9 +1466,9 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
        static char       networks[LNET_SINGLE_TEXTBUF_NOB];
        static char       source[LNET_SINGLE_TEXTBUF_NOB];
 
        static char       networks[LNET_SINGLE_TEXTBUF_NOB];
        static char       source[LNET_SINGLE_TEXTBUF_NOB];
 
-       struct list_head  raw_entries;
-       struct list_head  matched_nets;
-       struct list_head  current_nets;
+       LIST_HEAD(raw_entries);
+       LIST_HEAD(matched_nets);
+       LIST_HEAD(current_nets);
        struct list_head *t;
        struct list_head *t2;
        struct lnet_text_buf  *tb;
        struct list_head *t;
        struct list_head *t2;
        struct lnet_text_buf  *tb;
@@ -1489,15 +1480,12 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
        int               dup;
        int               rc;
 
        int               dup;
        int               rc;
 
-       INIT_LIST_HEAD(&raw_entries);
        if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) {
                CERROR("Error parsing ip2nets\n");
                LASSERT(lnet_tbnob == 0);
                return -EINVAL;
        }
 
        if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) {
                CERROR("Error parsing ip2nets\n");
                LASSERT(lnet_tbnob == 0);
                return -EINVAL;
        }
 
-       INIT_LIST_HEAD(&matched_nets);
-       INIT_LIST_HEAD(&current_nets);
        networks[0] = 0;
        count = 0;
        len = 0;
        networks[0] = 0;
        count = 0;
        len = 0;
index 64dcd84..0bebc01 100644 (file)
@@ -165,7 +165,7 @@ lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
        struct lnet_test_peer *tp;
        struct list_head *el;
        struct list_head *next;
        struct lnet_test_peer *tp;
        struct list_head *el;
        struct list_head *next;
-       struct list_head  cull;
+       LIST_HEAD(cull);
 
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
        if (threshold != 0) {
 
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
        if (threshold != 0) {
@@ -183,9 +183,6 @@ lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
                return 0;
        }
 
                return 0;
        }
 
-       /* removing entries */
-       INIT_LIST_HEAD(&cull);
-
        lnet_net_lock(0);
 
        list_for_each_safe(el, next, &the_lnet.ln_test_peers) {
        lnet_net_lock(0);
 
        list_for_each_safe(el, next, &the_lnet.ln_test_peers) {
@@ -215,10 +212,8 @@ fail_peer (lnet_nid_t nid, int outgoing)
        struct lnet_test_peer *tp;
        struct list_head *el;
        struct list_head *next;
        struct lnet_test_peer *tp;
        struct list_head *el;
        struct list_head *next;
-       struct list_head  cull;
-       int               fail = 0;
-
-       INIT_LIST_HEAD(&cull);
+       LIST_HEAD(cull);
+       int fail = 0;
 
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
        lnet_net_lock(0);
 
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
        lnet_net_lock(0);
@@ -1269,8 +1264,7 @@ routing_off:
                /* drop all messages which are queued to be routed on that
                 * peer. */
                if (!the_lnet.ln_routing) {
                /* drop all messages which are queued to be routed on that
                 * peer. */
                if (!the_lnet.ln_routing) {
-                       struct list_head drop;
-                       INIT_LIST_HEAD(&drop);
+                       LIST_HEAD(drop);
                        list_splice_init(&lp->lp_rtrq, &drop);
                        spin_unlock(&lp->lp_lock);
                        spin_unlock(&rxpeerni->lpni_lock);
                        list_splice_init(&lp->lp_rtrq, &drop);
                        spin_unlock(&lp->lp_lock);
                        spin_unlock(&rxpeerni->lpni_lock);
@@ -2867,7 +2861,6 @@ static void
 lnet_finalize_expired_responses(void)
 {
        struct lnet_libmd *md;
 lnet_finalize_expired_responses(void)
 {
        struct lnet_libmd *md;
-       struct list_head local_queue;
        struct lnet_rsp_tracker *rspt, *tmp;
        ktime_t now;
        int i;
        struct lnet_rsp_tracker *rspt, *tmp;
        ktime_t now;
        int i;
@@ -2876,7 +2869,7 @@ lnet_finalize_expired_responses(void)
                return;
 
        cfs_cpt_for_each(i, lnet_cpt_table()) {
                return;
 
        cfs_cpt_for_each(i, lnet_cpt_table()) {
-               INIT_LIST_HEAD(&local_queue);
+               LIST_HEAD(local_queue);
 
                lnet_net_lock(i);
                if (!the_lnet.ln_mt_rstq[i]) {
 
                lnet_net_lock(i);
                if (!the_lnet.ln_mt_rstq[i]) {
@@ -3104,8 +3097,8 @@ static void
 lnet_recover_local_nis(void)
 {
        struct lnet_mt_event_info *ev_info;
 lnet_recover_local_nis(void)
 {
        struct lnet_mt_event_info *ev_info;
-       struct list_head processed_list;
-       struct list_head local_queue;
+       LIST_HEAD(processed_list);
+       LIST_HEAD(local_queue);
        struct lnet_handle_md mdh;
        struct lnet_ni *tmp;
        struct lnet_ni *ni;
        struct lnet_handle_md mdh;
        struct lnet_ni *tmp;
        struct lnet_ni *ni;
@@ -3113,9 +3106,6 @@ lnet_recover_local_nis(void)
        int healthv;
        int rc;
 
        int healthv;
        int rc;
 
-       INIT_LIST_HEAD(&local_queue);
-       INIT_LIST_HEAD(&processed_list);
-
        /*
         * splice the recovery queue on a local queue. We will iterate
         * through the local queue and update it as needed. Once we're
        /*
         * splice the recovery queue on a local queue. We will iterate
         * through the local queue and update it as needed. Once we're
@@ -3346,11 +3336,9 @@ static void
 lnet_clean_resendqs(void)
 {
        struct lnet_msg *msg, *tmp;
 lnet_clean_resendqs(void)
 {
        struct lnet_msg *msg, *tmp;
-       struct list_head msgs;
+       LIST_HEAD(msgs);
        int i;
 
        int i;
 
-       INIT_LIST_HEAD(&msgs);
-
        cfs_cpt_for_each(i, lnet_cpt_table()) {
                lnet_net_lock(i);
                list_splice_init(the_lnet.ln_mt_resendqs[i], &msgs);
        cfs_cpt_for_each(i, lnet_cpt_table()) {
                lnet_net_lock(i);
                list_splice_init(the_lnet.ln_mt_resendqs[i], &msgs);
@@ -3369,8 +3357,8 @@ static void
 lnet_recover_peer_nis(void)
 {
        struct lnet_mt_event_info *ev_info;
 lnet_recover_peer_nis(void)
 {
        struct lnet_mt_event_info *ev_info;
-       struct list_head processed_list;
-       struct list_head local_queue;
+       LIST_HEAD(processed_list);
+       LIST_HEAD(local_queue);
        struct lnet_handle_md mdh;
        struct lnet_peer_ni *lpni;
        struct lnet_peer_ni *tmp;
        struct lnet_handle_md mdh;
        struct lnet_peer_ni *lpni;
        struct lnet_peer_ni *tmp;
@@ -3378,9 +3366,6 @@ lnet_recover_peer_nis(void)
        int healthv;
        int rc;
 
        int healthv;
        int rc;
 
-       INIT_LIST_HEAD(&local_queue);
-       INIT_LIST_HEAD(&processed_list);
-
        /*
         * Always use cpt 0 for locking across all interactions with
         * ln_mt_peerNIRecovq
        /*
         * Always use cpt 0 for locking across all interactions with
         * ln_mt_peerNIRecovq
index 3af39dc..3d78ce4 100644 (file)
@@ -202,12 +202,10 @@ lnet_drop_rule_del(lnet_nid_t src, lnet_nid_t dst)
 {
        struct lnet_drop_rule *rule;
        struct lnet_drop_rule *tmp;
 {
        struct lnet_drop_rule *rule;
        struct lnet_drop_rule *tmp;
-       struct list_head       zombies;
-       int                    n = 0;
+       LIST_HEAD(zombies);
+       int n = 0;
        ENTRY;
 
        ENTRY;
 
-       INIT_LIST_HEAD(&zombies);
-
        lnet_net_lock(LNET_LOCK_EX);
        list_for_each_entry_safe(rule, tmp, &the_lnet.ln_drop_rules, dr_link) {
                if (rule->dr_attr.fa_src != src && src != 0)
        lnet_net_lock(LNET_LOCK_EX);
        list_for_each_entry_safe(rule, tmp, &the_lnet.ln_drop_rules, dr_link) {
                if (rule->dr_attr.fa_src != src && src != 0)
@@ -723,10 +721,9 @@ delayed_msg_process(struct list_head *msg_list, bool drop)
 void
 lnet_delay_rule_check(void)
 {
 void
 lnet_delay_rule_check(void)
 {
-       struct lnet_delay_rule  *rule;
-       struct list_head         msgs;
+       struct lnet_delay_rule *rule;
+       LIST_HEAD(msgs);
 
 
-       INIT_LIST_HEAD(&msgs);
        while (1) {
                if (list_empty(&delay_dd.dd_sched_rules))
                        break;
        while (1) {
                if (list_empty(&delay_dd.dd_sched_rules))
                        break;
@@ -888,16 +885,13 @@ int
 lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown)
 {
        struct lnet_delay_rule *rule;
 lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown)
 {
        struct lnet_delay_rule *rule;
-       struct lnet_delay_rule  *tmp;
-       struct list_head        rule_list;
-       struct list_head        msg_list;
-       int                     n = 0;
-       bool                    cleanup;
+       struct lnet_delay_rule *tmp;
+       LIST_HEAD(rule_list);
+       LIST_HEAD(msg_list);
+       int n = 0;
+       bool cleanup;
        ENTRY;
 
        ENTRY;
 
-       INIT_LIST_HEAD(&rule_list);
-       INIT_LIST_HEAD(&msg_list);
-
        if (shutdown)
                src = dst = 0;
 
        if (shutdown)
                src = dst = 0;
 
index b373f49..6336410 100644 (file)
@@ -1924,9 +1924,7 @@ static void lnet_peer_discovery_complete(struct lnet_peer *lp)
 {
        struct lnet_msg *msg, *tmp;
        int rc = 0;
 {
        struct lnet_msg *msg, *tmp;
        int rc = 0;
-       struct list_head pending_msgs;
-
-       INIT_LIST_HEAD(&pending_msgs);
+       LIST_HEAD(pending_msgs);
 
        CDEBUG(D_NET, "Discovery complete. Dequeue peer %s\n",
               libcfs_nid2str(lp->lp_primary_nid));
 
        CDEBUG(D_NET, "Discovery complete. Dequeue peer %s\n",
               libcfs_nid2str(lp->lp_primary_nid));
@@ -3254,11 +3252,9 @@ static int lnet_peer_discovery_wait_for_work(void)
 static void lnet_resend_msgs(void)
 {
        struct lnet_msg *msg, *tmp;
 static void lnet_resend_msgs(void)
 {
        struct lnet_msg *msg, *tmp;
-       struct list_head resend;
+       LIST_HEAD(resend);
        int rc;
 
        int rc;
 
-       INIT_LIST_HEAD(&resend);
-
        spin_lock(&the_lnet.ln_msg_resend_lock);
        list_splice(&the_lnet.ln_msg_resend, &resend);
        spin_unlock(&the_lnet.ln_msg_resend_lock);
        spin_lock(&the_lnet.ln_msg_resend_lock);
        list_splice(&the_lnet.ln_msg_resend, &resend);
        spin_unlock(&the_lnet.ln_msg_resend_lock);
index 6b45ffd..cae8da6 100644 (file)
@@ -747,19 +747,16 @@ lnet_del_route_from_rnet(lnet_nid_t gw_nid, struct list_head *route_list,
 int
 lnet_del_route(__u32 net, lnet_nid_t gw_nid)
 {
 int
 lnet_del_route(__u32 net, lnet_nid_t gw_nid)
 {
-       struct list_head rnet_zombies;
+       LIST_HEAD(rnet_zombies);
        struct lnet_remotenet *rnet;
        struct lnet_remotenet *tmp;
        struct list_head *rn_list;
        struct lnet_peer_ni *lpni;
        struct lnet_route *route;
        struct lnet_remotenet *rnet;
        struct lnet_remotenet *tmp;
        struct list_head *rn_list;
        struct lnet_peer_ni *lpni;
        struct lnet_route *route;
-       struct list_head zombies;
+       LIST_HEAD(zombies);
        struct lnet_peer *lp = NULL;
        int i = 0;
 
        struct lnet_peer *lp = NULL;
        int i = 0;
 
-       INIT_LIST_HEAD(&rnet_zombies);
-       INIT_LIST_HEAD(&zombies);
-
        CDEBUG(D_NET, "Del route: net %s : gw %s\n",
               libcfs_net2str(net), libcfs_nid2str(gw_nid));
 
        CDEBUG(D_NET, "Del route: net %s : gw %s\n",
               libcfs_net2str(net), libcfs_nid2str(gw_nid));
 
@@ -1198,13 +1195,11 @@ lnet_rtrpool_free_bufs(struct lnet_rtrbufpool *rbp, int cpt)
 {
        int npages = rbp->rbp_npages;
        struct lnet_rtrbuf *rb;
 {
        int npages = rbp->rbp_npages;
        struct lnet_rtrbuf *rb;
-       struct list_head tmp;
+       LIST_HEAD(tmp);
 
        if (rbp->rbp_nbuffers == 0) /* not initialized or already freed */
                return;
 
 
        if (rbp->rbp_nbuffers == 0) /* not initialized or already freed */
                return;
 
-       INIT_LIST_HEAD(&tmp);
-
        lnet_net_lock(cpt);
        list_splice_init(&rbp->rbp_msgs, &tmp);
        lnet_drop_routed_msgs_locked(&tmp, cpt);
        lnet_net_lock(cpt);
        list_splice_init(&rbp->rbp_msgs, &tmp);
        lnet_drop_routed_msgs_locked(&tmp, cpt);
@@ -1225,7 +1220,7 @@ lnet_rtrpool_free_bufs(struct lnet_rtrbufpool *rbp, int cpt)
 static int
 lnet_rtrpool_adjust_bufs(struct lnet_rtrbufpool *rbp, int nbufs, int cpt)
 {
 static int
 lnet_rtrpool_adjust_bufs(struct lnet_rtrbufpool *rbp, int nbufs, int cpt)
 {
-       struct list_head rb_list;
+       LIST_HEAD(rb_list);
        struct lnet_rtrbuf *rb;
        int             num_rb;
        int             num_buffers = 0;
        struct lnet_rtrbuf *rb;
        int             num_rb;
        int             num_buffers = 0;
@@ -1253,8 +1248,6 @@ lnet_rtrpool_adjust_bufs(struct lnet_rtrbufpool *rbp, int nbufs, int cpt)
        rbp->rbp_req_nbuffers = nbufs;
        lnet_net_unlock(cpt);
 
        rbp->rbp_req_nbuffers = nbufs;
        lnet_net_unlock(cpt);
 
-       INIT_LIST_HEAD(&rb_list);
-
        /* allocate the buffers on a local list first.  If all buffers are
         * allocated successfully then join this list to the rbp buffer
         * list.  If not then free all allocated buffers. */
        /* allocate the buffers on a local list first.  If all buffers are
         * allocated successfully then join this list to the rbp buffer
         * list.  If not then free all allocated buffers. */
index f250043..ccaced7 100644 (file)
@@ -1491,11 +1491,9 @@ static int
 lstcon_ndlist_stat(struct list_head *ndlist,
                   int timeout, struct list_head __user *result_up)
 {
 lstcon_ndlist_stat(struct list_head *ndlist,
                   int timeout, struct list_head __user *result_up)
 {
-       struct list_head    head;
+       LIST_HEAD(head);
        struct lstcon_rpc_trans *trans;
        struct lstcon_rpc_trans *trans;
-       int                 rc;
-
-       INIT_LIST_HEAD(&head);
+       int rc;
 
         rc = lstcon_rpc_trans_ndlist(ndlist, &head,
                                      LST_TRANS_STATQRY, NULL, NULL, &trans);
 
         rc = lstcon_rpc_trans_ndlist(ndlist, &head,
                                      LST_TRANS_STATQRY, NULL, NULL, &trans);