Whamcloud - gitweb
LU-9679 lustre: use LIST_HEAD() for local lists. 55/36955/4
authorMr NeilBrown <neilb@suse.de>
Thu, 5 Dec 2019 06:09:19 +0000 (17:09 +1100)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Feb 2020 04:00:32 +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: I67bda77c04479e9b2b8c84f02bfb86d9c2ef5671
Reviewed-on: https://review.whamcloud.com/36955
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
28 files changed:
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/lfsck/lfsck_lib.c
lustre/lod/lod_lov.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_io.c
lustre/obdclass/genops.c
lustre/obdclass/lprocfs_status.c
lustre/obdclass/lprocfs_status_server.c
lustre/obdclass/lu_object.c
lustre/obdclass/lustre_peer.c
lustre/obdclass/obd_mount.c
lustre/ofd/ofd_fs.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-zfs/osd_handler.c
lustre/osp/osp_sync.c
lustre/osp/osp_trans.c
lustre/ptlrpc/client.c
lustre/ptlrpc/nrs_tbf.c
lustre/ptlrpc/pinger.c
lustre/ptlrpc/ptlrpc_module.c
lustre/ptlrpc/sec_config.c
lustre/ptlrpc/service.c
lustre/quota/qsd_writeback.c
lustre/target/tgt_lastrcvd.c
lustre/target/update_trans.c

index b76638b..7866d3f 100644 (file)
@@ -587,10 +587,9 @@ reprocess:
                         * LDLM_PROCESS_ENQUEUE from ldlm_reprocess_queue.
                         */
                        if ((mode == LCK_NL) && overlaps) {
-                               struct list_head rpc_list;
+                               LIST_HEAD(rpc_list);
                                int rc;
 
-                               INIT_LIST_HEAD(&rpc_list);
 restart:
                                ldlm_reprocess_queue(res, &res->lr_waiting,
                                                     &rpc_list,
index 5086c28..feacd50 100644 (file)
@@ -1688,9 +1688,8 @@ static void target_finish_recovery(struct lu_target *lut)
 static void abort_req_replay_queue(struct obd_device *obd)
 {
        struct ptlrpc_request *req, *n;
-       struct list_head abort_list;
+       LIST_HEAD(abort_list);
 
-       INIT_LIST_HEAD(&abort_list);
        spin_lock(&obd->obd_recovery_task_lock);
        list_splice_init(&obd->obd_req_replay_queue, &abort_list);
        spin_unlock(&obd->obd_recovery_task_lock);
@@ -1709,9 +1708,8 @@ static void abort_req_replay_queue(struct obd_device *obd)
 static void abort_lock_replay_queue(struct obd_device *obd)
 {
        struct ptlrpc_request *req, *n;
-       struct list_head abort_list;
+       LIST_HEAD(abort_list);
 
-       INIT_LIST_HEAD(&abort_list);
        spin_lock(&obd->obd_recovery_task_lock);
        list_splice_init(&obd->obd_lock_replay_queue, &abort_list);
        spin_unlock(&obd->obd_recovery_task_lock);
@@ -1738,9 +1736,8 @@ static void abort_lock_replay_queue(struct obd_device *obd)
 void target_cleanup_recovery(struct obd_device *obd)
 {
        struct ptlrpc_request *req, *n;
-       struct list_head clean_list;
+       LIST_HEAD(clean_list);
 
-       INIT_LIST_HEAD(&clean_list);
        spin_lock(&obd->obd_dev_lock);
        if (!obd->obd_recovering) {
                spin_unlock(&obd->obd_dev_lock);
index c918339..94445d3 100644 (file)
@@ -2340,7 +2340,7 @@ static void __ldlm_reprocess_all(struct ldlm_resource *res,
                                 enum ldlm_process_intention intention,
                                 struct ldlm_lock *hint)
 {
-       struct list_head rpc_list;
+       LIST_HEAD(rpc_list);
 #ifdef HAVE_SERVER_SUPPORT
        ldlm_reprocessing_policy reprocess;
        struct obd_device *obd;
@@ -2348,7 +2348,6 @@ static void __ldlm_reprocess_all(struct ldlm_resource *res,
 
        ENTRY;
 
-       INIT_LIST_HEAD(&rpc_list);
        /* Local lock trees don't get reprocessed. */
        if (ns_is_client(ldlm_res_to_ns(res))) {
                EXIT;
@@ -2377,7 +2376,6 @@ restart:
 #else
        ENTRY;
 
-       INIT_LIST_HEAD(&rpc_list);
        if (!ns_is_client(ldlm_res_to_ns(res))) {
                CERROR("This is client-side-only module, cannot handle "
                       "LDLM_NAMESPACE_SERVER resource type lock.\n");
index 9e98b10..5c7088a 100644 (file)
@@ -1907,7 +1907,7 @@ static int ldlm_handle_cp_callback(struct ptlrpc_request *req,
                                     struct ldlm_request *dlm_req,
                                     struct ldlm_lock *lock)
 {
-       struct list_head ast_list;
+       LIST_HEAD(ast_list);
        int lvb_len;
        int rc = 0;
 
@@ -1915,7 +1915,6 @@ static int ldlm_handle_cp_callback(struct ptlrpc_request *req,
 
        LDLM_DEBUG(lock, "client completion callback handler START");
 
-       INIT_LIST_HEAD(&ast_list);
        if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE)) {
                long to = cfs_time_seconds(1);
 
@@ -2679,11 +2678,10 @@ static int ldlm_revoke_lock_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd,
 
 void ldlm_revoke_export_locks(struct obd_export *exp)
 {
-       struct list_head rpc_list;
+       LIST_HEAD(rpc_list);
 
        ENTRY;
 
-       INIT_LIST_HEAD(&rpc_list);
        cfs_hash_for_each_nolock(exp->exp_lock_hash,
                                 ldlm_revoke_lock_cb, &rpc_list, 0);
        ldlm_run_ast_work(exp->exp_obd->obd_namespace, &rpc_list,
index f0be125..72be4f5 100644 (file)
@@ -63,9 +63,9 @@ static void lfsck_key_fini(const struct lu_context *ctx,
 LU_CONTEXT_KEY_DEFINE(lfsck, LCT_MD_THREAD | LCT_DT_THREAD);
 LU_KEY_INIT_GENERIC(lfsck);
 
-static struct list_head lfsck_instance_list;
-static struct list_head lfsck_ost_orphan_list;
-static struct list_head lfsck_mdt_orphan_list;
+static LIST_HEAD(lfsck_instance_list);
+static LIST_HEAD(lfsck_ost_orphan_list);
+static LIST_HEAD(lfsck_mdt_orphan_list);
 static DEFINE_SPINLOCK(lfsck_instance_lock);
 
 const char *lfsck_flags_names[] = {
@@ -3973,9 +3973,6 @@ static int __init lfsck_init(void)
 {
        int rc;
 
-       INIT_LIST_HEAD(&lfsck_instance_list);
-       INIT_LIST_HEAD(&lfsck_ost_orphan_list);
-       INIT_LIST_HEAD(&lfsck_mdt_orphan_list);
        lfsck_key_init_generic(&lfsck_thread_key, NULL);
        rc = lu_context_key_register(&lfsck_thread_key);
        if (!rc) {
index 48fa030..f601afe 100644 (file)
@@ -76,13 +76,11 @@ void lod_putref(struct lod_device *lod, struct lod_tgt_descs *ltd)
        ltd->ltd_refcount--;
        if (ltd->ltd_refcount == 0 && ltd->ltd_death_row) {
                struct lod_tgt_desc *tgt_desc, *tmp;
-               struct list_head kill;
+               LIST_HEAD(kill);
 
                CDEBUG(D_CONFIG, "destroying %d ltd desc\n",
                       ltd->ltd_death_row);
 
-               INIT_LIST_HEAD(&kill);
-
                ltd_foreach_tgt_safe(ltd, tgt_desc, tmp) {
                        LASSERT(tgt_desc);
                        if (!tgt_desc->ltd_reap)
index 2cc8151..369ea1e 100644 (file)
@@ -6077,7 +6077,7 @@ static int mdt_ctxt_add_dirty_flag(struct lu_env *env,
 
 static int mdt_export_cleanup(struct obd_export *exp)
 {
-       struct list_head         closing_list;
+       LIST_HEAD(closing_list);
        struct mdt_export_data  *med = &exp->exp_mdt_data;
        struct obd_device       *obd = exp->exp_obd;
        struct mdt_device       *mdt;
@@ -6087,7 +6087,6 @@ static int mdt_export_cleanup(struct obd_export *exp)
        int rc = 0;
        ENTRY;
 
-       INIT_LIST_HEAD(&closing_list);
        spin_lock(&med->med_open_lock);
        while (!list_empty(&med->med_open_head)) {
                struct list_head *tmp = med->med_open_head.next;
index 8bcb65f..840e4d7 100644 (file)
@@ -987,7 +987,7 @@ int mdt_do_glimpse(const struct lu_env *env, struct ldlm_namespace *ns,
        enum ldlm_mode mode;
        struct ldlm_lock *lock;
        struct ldlm_glimpse_work *gl_work;
-       struct list_head gl_list;
+       LIST_HEAD(gl_list);
        int rc;
 
        ENTRY;
@@ -1028,7 +1028,6 @@ int mdt_do_glimpse(const struct lu_env *env, struct ldlm_namespace *ns,
        gl_work->gl_lock = LDLM_LOCK_GET(lock);
        /* The glimpse callback is sent to one single IO lock. As a result,
         * the gl_work list is just composed of one element */
-       INIT_LIST_HEAD(&gl_list);
        list_add_tail(&gl_work->gl_list, &gl_list);
        /* There is actually no need for a glimpse descriptor when glimpsing
         * IO locks */
index f13069e..aca1fec 100644 (file)
@@ -1520,11 +1520,10 @@ static void class_disconnect_export_list(struct list_head *list,
 
 void class_disconnect_exports(struct obd_device *obd)
 {
-       struct list_head work_list;
+       LIST_HEAD(work_list);
        ENTRY;
 
        /* Move all of the exports from obd_exports to a work list, en masse. */
-       INIT_LIST_HEAD(&work_list);
        spin_lock(&obd->obd_dev_lock);
        list_splice_init(&obd->obd_exports, &work_list);
        list_splice_init(&obd->obd_delayed_exports, &work_list);
@@ -1547,12 +1546,11 @@ EXPORT_SYMBOL(class_disconnect_exports);
 void class_disconnect_stale_exports(struct obd_device *obd,
                                     int (*test_export)(struct obd_export *))
 {
-       struct list_head work_list;
+       LIST_HEAD(work_list);
        struct obd_export *exp, *n;
-        int evicted = 0;
-        ENTRY;
+       int evicted = 0;
+       ENTRY;
 
-       INIT_LIST_HEAD(&work_list);
        spin_lock(&obd->obd_dev_lock);
        list_for_each_entry_safe(exp, n, &obd->obd_exports,
                                 exp_obd_chain) {
index 391858e..ebace78 100644 (file)
@@ -2604,7 +2604,7 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
        int rc;
        char *kernbuf = NULL;
        char *errmsg;
-       struct list_head tmp;
+       LIST_HEAD(tmp);
        int len = count;
        ENTRY;
 
@@ -2639,7 +2639,6 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
                RETURN(count);
        }
 
-       INIT_LIST_HEAD(&tmp);
        if (cfs_parse_nidlist(kernbuf, count, &tmp) <= 0) {
                errmsg = "can't parse";
                GOTO(failed, rc = -EINVAL);
index 029fb38..d4e59e0 100644 (file)
@@ -479,9 +479,8 @@ lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
        struct seq_file *m = file->private_data;
        struct obd_device *obd = m->private;
        struct nid_stat *client_stat;
-       struct list_head free_list;
+       LIST_HEAD(free_list);
 
-       INIT_LIST_HEAD(&free_list);
        cfs_hash_cond_del(obd->obd_nid_stats_hash,
                          lprocfs_nid_stats_clear_write_cb, &free_list);
 
index 805de4c..9f97180 100644 (file)
@@ -376,10 +376,10 @@ next:
 static void lu_object_free(const struct lu_env *env, struct lu_object *o)
 {
        wait_queue_head_t *wq;
-       struct lu_site          *site;
-       struct lu_object        *scan;
-       struct list_head        *layers;
-       struct list_head         splice;
+       struct lu_site *site;
+       struct lu_object *scan;
+       struct list_head *layers;
+       LIST_HEAD(splice);
 
        site = o->lo_dev->ld_site;
        layers = &o->lo_header->loh_layers;
@@ -398,7 +398,6 @@ static void lu_object_free(const struct lu_env *env, struct lu_object *o)
          * necessary, because lu_object_header is freed together with the
          * top-level slice.
          */
-       INIT_LIST_HEAD(&splice);
        list_splice_init(layers, &splice);
        while (!list_empty(&splice)) {
                /*
@@ -427,7 +426,7 @@ int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s,
         struct lu_object_header *h;
         struct lu_object_header *temp;
         struct lu_site_bkt_data *bkt;
-       struct list_head         dispose;
+       LIST_HEAD(dispose);
        int                      did_sth;
        unsigned int             start = 0;
         int                      count;
@@ -437,7 +436,6 @@ int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s,
        if (OBD_FAIL_CHECK(OBD_FAIL_OBD_NO_LRU))
                RETURN(0);
 
-       INIT_LIST_HEAD(&dispose);
         /*
          * Under LRU list lock, scan LRU list and move unreferenced objects to
          * the dispose list, removing them from LRU and hash table.
index 535d78e..d8dc95a 100644 (file)
@@ -131,9 +131,7 @@ int class_add_uuid(const char *uuid, __u64 nid)
 int class_del_uuid(const char *uuid)
 {
        struct uuid_nid_data *data;
-       struct list_head deathrow;
-
-       INIT_LIST_HEAD(&deathrow);
+       LIST_HEAD(deathrow);
 
        spin_lock(&g_uuid_lock);
        if (uuid != NULL) {
index b9c14d2..1d37c9d 100644 (file)
@@ -1265,7 +1265,7 @@ try_again:
  */
 static int lmd_parse_nidlist(char *buf, char **endh)
 {
-       struct list_head nidlist;
+       LIST_HEAD(nidlist);
        char *endp = buf;
        char tmp;
        int rc = 0;
@@ -1283,7 +1283,6 @@ static int lmd_parse_nidlist(char *buf, char **endh)
        tmp = *endp;
        *endp = '\0';
 
-       INIT_LIST_HEAD(&nidlist);
        if (cfs_parse_nidlist(buf, strlen(buf), &nidlist) <= 0)
                rc = 1;
        cfs_free_nidlist(&nidlist);
index f20617b..7fbce7b 100644 (file)
@@ -310,11 +310,10 @@ static void ofd_fld_fini(const struct lu_env *env, struct ofd_device *ofd)
  */
 void ofd_seqs_free(const struct lu_env *env, struct ofd_device *ofd)
 {
-       struct ofd_seq          *oseq;
-       struct ofd_seq          *tmp;
-       struct list_head         dispose;
+       struct ofd_seq *oseq;
+       struct ofd_seq *tmp;
+       LIST_HEAD(dispose);
 
-       INIT_LIST_HEAD(&dispose);
        write_lock(&ofd->ofd_seq_list_lock);
        list_for_each_entry_safe(oseq, tmp, &ofd->ofd_seq_list, os_list)
                list_move(&oseq->os_list, &dispose);
index d5ca71a..13e710c 100644 (file)
@@ -3919,14 +3919,12 @@ static int osd_process_scheduled_agent_removals(const struct lu_env *env,
        struct osd_thread_info *info = osd_oti_get(env);
        struct osd_obj_orphan *oor, *tmp;
        struct osd_inode_id id;
-       struct list_head list;
+       LIST_HEAD(list);
        struct inode *inode;
        struct lu_fid fid;
        handle_t *jh;
        __u32 ino;
 
-       INIT_LIST_HEAD(&list);
-
        spin_lock(&osd->od_osfs_lock);
        list_for_each_entry_safe(oor, tmp, &osd->od_orphan_list, oor_list) {
                if (oor->oor_env == env)
index c4bfd4f..10ef06c 100644 (file)
@@ -280,13 +280,12 @@ static int osd_trans_stop(const struct lu_env *env, struct dt_device *dt,
        struct osd_device       *osd = osd_dt_dev(th->th_dev);
        bool                     sync = (th->th_sync != 0);
        struct osd_thandle      *oh;
-       struct list_head         unlinked;
+       LIST_HEAD(unlinked);
        uint64_t                 txg;
        int                      rc;
        ENTRY;
 
        oh = container_of0(th, struct osd_thandle, ot_super);
-       INIT_LIST_HEAD(&unlinked);
        list_splice_init(&oh->ot_unlinked_list, &unlinked);
 
        osd_oti_get(env)->oti_ins_cache_depth--;
index f55672e..cbe6481 100644 (file)
@@ -1016,7 +1016,8 @@ static void osp_sync_process_committed(const struct lu_env *env,
        struct llog_ctxt        *ctxt;
        struct llog_handle      *llh;
        int                     *arr;
-       struct list_head         list, *le;
+       LIST_HEAD(list);
+       struct list_head         *le;
        struct llog_logid        lgid;
        int                      rc, i, count = 0, done = 0;
 
@@ -1047,7 +1048,6 @@ static void osp_sync_process_committed(const struct lu_env *env,
        llh = ctxt->loc_handle;
        LASSERT(llh);
 
-       INIT_LIST_HEAD(&list);
        spin_lock(&d->opd_sync_lock);
        list_splice(&d->opd_sync_committed_there, &list);
        INIT_LIST_HEAD(&d->opd_sync_committed_there);
index 0ad2099..f366951 100644 (file)
@@ -1376,8 +1376,6 @@ void osp_invalidate_request(struct osp_device *osp)
                return;
        }
 
-       INIT_LIST_HEAD(&list);
-
        spin_lock(&ou->ou_lock);
        /* invalidate all of request in the sending list */
        list_for_each_entry_safe(our, tmp, &ou->ou_list, our_list) {
index aede53e..617c31c 100644 (file)
@@ -1794,14 +1794,13 @@ static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set)
 int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
 {
        struct list_head *tmp, *next;
-       struct list_head  comp_reqs;
+       LIST_HEAD(comp_reqs);
        int force_timer_recalc = 0;
 
        ENTRY;
        if (atomic_read(&set->set_remaining) == 0)
                RETURN(1);
 
-       INIT_LIST_HEAD(&comp_reqs);
        list_for_each_safe(tmp, next, &set->set_requests) {
                struct ptlrpc_request *req =
                        list_entry(tmp, struct ptlrpc_request,
index 9486172..15874da 100644 (file)
@@ -688,9 +688,8 @@ nrs_tbf_jobid_cli_put(struct nrs_tbf_head *head,
        struct cfs_hash         *hs = head->th_cli_hash;
        struct nrs_tbf_bucket   *bkt;
        int                      hw;
-       struct list_head        zombies;
+       LIST_HEAD(zombies);
 
-       INIT_LIST_HEAD(&zombies);
        cfs_hash_bd_get(hs, &cli->tc_jobid, &bd);
        bkt = cfs_hash_bd_extra_get(hs, &bd);
        if (!cfs_hash_bd_dec_and_lock(hs, &bd, &cli->tc_ref))
@@ -1697,9 +1696,8 @@ nrs_tbf_cli_put(struct nrs_tbf_head *head, struct nrs_tbf_client *cli)
        struct cfs_hash         *hs = head->th_cli_hash;
        struct nrs_tbf_bucket   *bkt;
        int                      hw;
-       struct list_head         zombies;
+       LIST_HEAD(zombies);
 
-       INIT_LIST_HEAD(&zombies);
        cfs_hash_bd_get(hs, &cli->tc_key, &bd);
        bkt = cfs_hash_bd_extra_get(hs, &bd);
        if (!cfs_hash_bd_dec_and_lock(hs, &bd, &cli->tc_ref))
index b479dc6..5b1133e 100644 (file)
@@ -552,7 +552,7 @@ void ptlrpc_pinger_wake_up(void)
 static int pet_refcount;
 static int pet_state;
 static wait_queue_head_t pet_waitq;
-static struct list_head pet_list;
+static LIST_HEAD(pet_list);
 static DEFINE_SPINLOCK(pet_lock);
 
 int ping_evictor_wake(struct obd_export *exp)
@@ -668,7 +668,6 @@ void ping_evictor_start(void)
        if (++pet_refcount > 1)
                return;
 
-       INIT_LIST_HEAD(&pet_list);
        init_waitqueue_head(&pet_waitq);
 
        task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
index cd73db8..2b46ba2 100644 (file)
@@ -50,7 +50,6 @@ static __init int ptlrpc_init(void)
 #if RS_DEBUG
        spin_lock_init(&ptlrpc_rs_debug_lock);
 #endif
-       INIT_LIST_HEAD(&ptlrpc_all_services);
        mutex_init(&ptlrpc_all_services_mutex);
        mutex_init(&pinger_mutex);
        mutex_init(&ptlrpcd_mutex);
index e7e08ed..920a1d2 100644 (file)
@@ -502,7 +502,7 @@ struct sptlrpc_conf {
 };
 
 static struct mutex sptlrpc_conf_lock;
-static struct list_head sptlrpc_confs;
+static LIST_HEAD(sptlrpc_confs);
 
 static void sptlrpc_conf_free_rsets(struct sptlrpc_conf *conf)
 {
@@ -968,7 +968,6 @@ int sptlrpc_conf_target_get_rules(struct obd_device *obd,
 
 int  sptlrpc_conf_init(void)
 {
-       INIT_LIST_HEAD(&sptlrpc_confs);
        mutex_init(&sptlrpc_conf_lock);
        return 0;
 }
index fefcb29..ef341fd 100644 (file)
@@ -65,7 +65,7 @@ static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req);
 static void ptlrpc_at_remove_timed(struct ptlrpc_request *req);
 
 /** Holds a list of all PTLRPC services */
-struct list_head ptlrpc_all_services;
+LIST_HEAD(ptlrpc_all_services);
 /** Used to protect the \e ptlrpc_all_services list */
 struct mutex ptlrpc_all_services_mutex;
 
@@ -1526,7 +1526,7 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt)
 {
        struct ptlrpc_at_array *array = &svcpt->scp_at_array;
        struct ptlrpc_request *rq, *n;
-       struct list_head work_list;
+       LIST_HEAD(work_list);
        __u32 index, count;
        time64_t deadline;
        time64_t now = ktime_get_real_seconds();
@@ -1560,7 +1560,6 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt)
         * We're close to a timeout, and we don't know how much longer the
         * server will take. Send early replies to everyone expiring soon.
         */
-       INIT_LIST_HEAD(&work_list);
        deadline = -1;
        div_u64_rem(array->paa_deadline, array->paa_size, &index);
        count = array->paa_count;
@@ -2948,7 +2947,7 @@ static int ptlrpc_hr_main(void *arg)
 {
        struct ptlrpc_hr_thread *hrt = (struct ptlrpc_hr_thread *)arg;
        struct ptlrpc_hr_partition *hrp = hrt->hrt_partition;
-       struct list_head replies;
+       LIST_HEAD(replies);
        struct lu_env *env;
        int rc;
 
@@ -2956,7 +2955,6 @@ static int ptlrpc_hr_main(void *arg)
        if (env == NULL)
                RETURN(-ENOMEM);
 
-       INIT_LIST_HEAD(&replies);
        unshare_fs_struct();
 
        rc = cfs_cpt_bind(ptlrpc_hr.hr_cpt_table, hrp->hrp_cpt);
@@ -3077,14 +3075,13 @@ static int ptlrpc_start_hr_threads(void)
 static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt)
 {
        struct ptlrpc_thread *thread;
-       struct list_head zombie;
+       LIST_HEAD(zombie);
 
        ENTRY;
 
        CDEBUG(D_INFO, "Stopping threads for service %s\n",
               svcpt->scp_service->srv_name);
 
-       INIT_LIST_HEAD(&zombie);
        spin_lock(&svcpt->scp_lock);
        /* let the thread know that we would like it to stop asap */
        list_for_each_entry(thread, &svcpt->scp_threads, t_link)
index 9a40013..c88dfac 100644 (file)
@@ -433,7 +433,7 @@ static int qsd_upd_thread(void *arg)
 {
        struct qsd_instance     *qsd = (struct qsd_instance *)arg;
        struct ptlrpc_thread    *thread = &qsd->qsd_upd_thread;
-       struct list_head         queue;
+       LIST_HEAD(queue);
        struct qsd_upd_rec      *upd, *n;
        struct lu_env           *env;
        int                      qtype, rc = 0;
@@ -456,7 +456,6 @@ static int qsd_upd_thread(void *arg)
        thread_set_flags(thread, SVC_RUNNING);
        wake_up(&thread->t_ctl_waitq);
 
-       INIT_LIST_HEAD(&queue);
        while (1) {
                wait_event_idle_timeout(
                        thread->t_ctl_waitq,
index c11cef4..b3a7e71 100644 (file)
@@ -797,7 +797,7 @@ void tgt_boot_epoch_update(struct lu_target *tgt)
        struct lu_env            env;
        struct ptlrpc_request   *req;
        __u32                    start_epoch;
-       struct list_head         client_list;
+       LIST_HEAD(client_list);
        int                      rc;
 
        if (tgt->lut_obd->obd_stopping)
@@ -816,7 +816,6 @@ void tgt_boot_epoch_update(struct lu_target *tgt)
        tgt->lut_lsd.lsd_start_epoch = start_epoch;
        spin_unlock(&tgt->lut_translock);
 
-       INIT_LIST_HEAD(&client_list);
        /**
         * The recovery is not yet finished and final queue can still be updated
         * with resend requests. Move final list to separate one for processing
index 872b86e..4d9a4c0 100644 (file)
@@ -1553,7 +1553,7 @@ static int distribute_txn_commit_thread(void *_arg)
        struct lu_target        *lut = tdtd->tdtd_lut;
        struct ptlrpc_thread    *thread = &lut->lut_tdtd_commit_thread;
        struct lu_env            env;
-       struct list_head         list;
+       LIST_HEAD(list);
        int                      rc;
        struct top_multiple_thandle *tmt;
        struct top_multiple_thandle *tmp;
@@ -1569,7 +1569,6 @@ static int distribute_txn_commit_thread(void *_arg)
        thread->t_flags = SVC_RUNNING;
        spin_unlock(&tdtd->tdtd_batchid_lock);
        wake_up(&thread->t_ctl_waitq);
-       INIT_LIST_HEAD(&list);
 
        CDEBUG(D_HA, "%s: start commit thread committed batchid %llu\n",
               tdtd->tdtd_lut->lut_obd->obd_name,