From: shadow Date: Thu, 24 Apr 2008 06:48:33 +0000 (+0000) Subject: use generic LIST_HEAD macros instead of linux specific. X-Git-Tag: v1_7_0_51~20 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=83f755685e50da38cb916ae4fb83f62429b5d568 use generic LIST_HEAD macros instead of linux specific. b=14929 i=zam --- diff --git a/lnet/include/libcfs/list.h b/lnet/include/libcfs/list.h index 5c27071..799d853 100644 --- a/lnet/include/libcfs/list.h +++ b/lnet/include/libcfs/list.h @@ -43,19 +43,12 @@ typedef struct list_head list_t; #define CFS_LIST_HEAD_INIT(name) { &(name), &(name) } #define CFS_LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) + struct list_head name = CFS_LIST_HEAD_INIT(name) #define CFS_INIT_LIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) -#ifndef __APPLE__ -#define LIST_HEAD(n) CFS_LIST_HEAD(n) -#endif - -#define LIST_HEAD_INIT(n) CFS_LIST_HEAD_INIT(n) -#define INIT_LIST_HEAD(p) CFS_INIT_LIST_HEAD(p) - /* * Insert a new entry between two known consecutive entries. * diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 8581ea4..4fd9adb 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -993,7 +993,7 @@ lnet_startup_lndnis (void) int nicount = 0; char *nets = lnet_get_networks(); - INIT_LIST_HEAD(&nilist); + CFS_INIT_LIST_HEAD(&nilist); if (nets == NULL) goto failed; diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 7bb8799..7425877 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -381,7 +381,7 @@ lnet_str2tbs_sep (struct list_head *tbs, char *str) int i; lnet_text_buf_t *ltb; - INIT_LIST_HEAD(&pending); + CFS_INIT_LIST_HEAD(&pending); /* Split 'str' into separate commands */ for (;;) { @@ -471,7 +471,7 @@ lnet_str2tbs_expand (struct list_head *tbs, char *str) int nob; int scanned; - INIT_LIST_HEAD(&pending); + CFS_INIT_LIST_HEAD(&pending); sep = strchr(str, '['); if (sep == NULL) /* nothing to expand */ diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index aee3334..01b635a 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -307,7 +307,7 @@ lnet_add_route (__u32 net, unsigned int hops, lnet_nid_t gateway) return -ENOMEM; } - INIT_LIST_HEAD(&rnet->lrn_routes); + CFS_INIT_LIST_HEAD(&rnet->lrn_routes); rnet->lrn_net = net; rnet->lrn_hops = hops; diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 1ec2b9c..fce247c 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -369,7 +369,7 @@ int fld_client_init(struct lu_client_fld *fld, spin_lock_init(&fld->lcf_lock); fld->lcf_hash = &fld_hash[hash]; fld->lcf_flags = LUSTRE_FLD_INIT; - INIT_LIST_HEAD(&fld->lcf_targets); + CFS_INIT_LIST_HEAD(&fld->lcf_targets); #ifdef __KERNEL__ cache_size = FLD_CLIENT_CACHE_SIZE / diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 67f0066..c562e75 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -609,9 +609,9 @@ static inline int capable(int cap) #define DECLARE_WAIT_QUEUE_HEAD(HEAD) \ wait_queue_head_t HEAD = { \ - .sleepers = LIST_HEAD_INIT(HEAD.sleepers) \ + .sleepers = CFS_LIST_HEAD_INIT(HEAD.sleepers) \ } -#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->sleepers) +#define init_waitqueue_head(l) CFS_INIT_LIST_HEAD(&(l)->sleepers) #define wake_up(l) do { int a; a++; } while (0) #define TASK_INTERRUPTIBLE 0 #define TASK_UNINTERRUPTIBLE 1 @@ -682,7 +682,7 @@ static inline int timer_pending(struct timer_list *l) static inline int init_timer(struct timer_list *l) { - INIT_LIST_HEAD(&l->tl_list); + CFS_INIT_LIST_HEAD(&l->tl_list); return 0; } diff --git a/lustre/include/lustre_capa.h b/lustre/include/lustre_capa.h index 9e71a21..c7e6732 100644 --- a/lustre/include/lustre_capa.h +++ b/lustre/include/lustre_capa.h @@ -169,7 +169,7 @@ static inline struct obd_capa *alloc_capa(int site) if (ocapa) { atomic_set(&ocapa->c_refc, 0); spin_lock_init(&ocapa->c_lock); - INIT_LIST_HEAD(&ocapa->c_list); + CFS_INIT_LIST_HEAD(&ocapa->c_list); ocapa->c_site = site; } return ocapa; diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 98044fa..a6d5b55 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -1508,7 +1508,7 @@ void ldlm_reprocess_all_ns(struct ldlm_namespace *ns) void ldlm_reprocess_all(struct ldlm_resource *res) { - struct list_head rpc_list = LIST_HEAD_INIT(rpc_list); + CFS_LIST_HEAD(rpc_list); int rc; ENTRY; @@ -1686,7 +1686,7 @@ void ldlm_cancel_locks_for_export(struct obd_export *exp) struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode, __u32 *flags) { - struct list_head rpc_list = LIST_HEAD_INIT(rpc_list); + CFS_LIST_HEAD(rpc_list); struct ldlm_resource *res; struct ldlm_namespace *ns; int granted = 0; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 63d3172..cc7fc39 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1797,7 +1797,7 @@ void ldlm_revoke_export_locks(struct obd_export *exp) struct ldlm_lock *lock, *next; ENTRY; - INIT_LIST_HEAD(&rpc_list); + CFS_INIT_LIST_HEAD(&rpc_list); spin_lock(&exp->exp_ldlm_data.led_lock); list_for_each_entry_safe(lock, next, locklist, l_export_chain) { diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 4fdb76d..cb7284b 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -2020,7 +2020,7 @@ llu_fsswop_mount(const char *source, if (!sbi) RETURN(-ENOMEM); - INIT_LIST_HEAD(&sbi->ll_conn_chain); + CFS_INIT_LIST_HEAD(&sbi->ll_conn_chain); ll_generate_random_uuid(uuid); class_uuid_unparse(uuid, &sbi->ll_sb_uuid); diff --git a/lustre/lmv/lmv_object.c b/lustre/lmv/lmv_object.c index 922eea5..2c82ffe 100644 --- a/lustre/lmv/lmv_object.c +++ b/lustre/lmv/lmv_object.c @@ -49,7 +49,7 @@ extern cfs_mem_cache_t *obj_cache; extern atomic_t obj_cache_count; /* object list and its guard. */ -static LIST_HEAD(obj_list); +static CFS_LIST_HEAD(obj_list); static spinlock_t obj_list_lock = SPIN_LOCK_UNLOCKED; /* creates new obj on passed @fid and @mea. */ diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 7b71280..dd9ab38 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -730,7 +730,7 @@ static int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) lov->lov_tgt_size = 0; sema_init(&lov->lov_lock, 1); atomic_set(&lov->lov_refcount, 0); - INIT_LIST_HEAD(&lov->lov_qos.lq_oss_list); + CFS_INIT_LIST_HEAD(&lov->lov_qos.lq_oss_list); init_rwsem(&lov->lov_qos.lq_rw_sem); lov->lov_qos.lq_dirty = 1; lov->lov_qos.lq_dirty_rr = 1; diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 18ad5c3..ee5aaa9 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -92,7 +92,7 @@ int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id) } /********************** config llog list **********************/ -static struct list_head config_llog_list = LIST_HEAD_INIT(config_llog_list); +static CFS_LIST_HEAD(config_llog_list); static spinlock_t config_list_lock = SPIN_LOCK_UNLOCKED; /* Take a reference to a config log */ diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 6122cfe..1e680ba 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -536,7 +536,7 @@ int init_obdclass(void) printk(KERN_INFO " Build Version: "BUILD_VERSION"\n"); for (i = CAPA_SITE_CLIENT; i < CAPA_SITE_MAX; i++) - INIT_LIST_HEAD(&capa_list[i]); + CFS_INIT_LIST_HEAD(&capa_list[i]); #else CDEBUG(D_INFO, "Lustre: OBD class driver, info@clusterfs.com\n"); CDEBUG(D_INFO, " Lustre Version: "LUSTRE_VERSION_STRING"\n"); @@ -571,7 +571,7 @@ int init_obdclass(void) return err; spin_lock_init(&obd_dev_lock); - INIT_LIST_HEAD(&obd_types); + CFS_INIT_LIST_HEAD(&obd_types); err = cfs_psdev_register(&obd_psdev); if (err) { diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 1bbd7de..4e49f34 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -1384,8 +1384,8 @@ EXPORT_SYMBOL(obd_zombie_impexp_cull); void obd_zombie_impexp_init(void) { - INIT_LIST_HEAD(&obd_zombie_imports); - INIT_LIST_HEAD(&obd_zombie_exports); + CFS_INIT_LIST_HEAD(&obd_zombie_imports); + CFS_INIT_LIST_HEAD(&obd_zombie_exports); spin_lock_init(&obd_zombie_impexp_lock); } diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 649617a..5f3d6ff 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -45,7 +45,7 @@ static void (*kill_super_cb)(struct super_block *sb) = NULL; /*********** mount lookup *********/ DECLARE_MUTEX(lustre_mount_info_lock); -struct list_head server_mount_info_list = LIST_HEAD_INIT(server_mount_info_list); +static CFS_LIST_HEAD(server_mount_info_list); static struct lustre_mount_info *server_find_mount(const char *name) { diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index c9ce969..24d3ff9 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -549,7 +549,7 @@ static void filter_fmd_cleanup(struct obd_export *exp) static int filter_init_export(struct obd_export *exp) { spin_lock_init(&exp->exp_filter_data.fed_lock); - INIT_LIST_HEAD(&exp->exp_filter_data.fed_mod_list); + CFS_INIT_LIST_HEAD(&exp->exp_filter_data.fed_mod_list); spin_lock(&exp->exp_lock); exp->exp_connecting = 1; @@ -1618,7 +1618,7 @@ static int filter_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp, void *req_cookie, ldlm_mode_t mode, int flags, void *data) { - struct list_head rpc_list = LIST_HEAD_INIT(rpc_list); + struct list_head rpc_list = CFS_LIST_HEAD_INIT(rpc_list); struct ptlrpc_request *req = req_cookie; struct ldlm_lock *lock = *lockp, *l = NULL; struct ldlm_resource *res = lock->l_resource; @@ -1970,14 +1970,14 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg, filter->fo_fmd_max_num = FILTER_FMD_MAX_NUM_DEFAULT; filter->fo_fmd_max_age = FILTER_FMD_MAX_AGE_DEFAULT; - INIT_LIST_HEAD(&filter->fo_llog_list); + CFS_INIT_LIST_HEAD(&filter->fo_llog_list); spin_lock_init(&filter->fo_llog_list_lock); filter->fo_sptlrpc_lock = RW_LOCK_UNLOCKED; sptlrpc_rule_set_init(&filter->fo_sptlrpc_rset); filter->fo_fl_oss_capa = 0; - INIT_LIST_HEAD(&filter->fo_capa_keys); + CFS_INIT_LIST_HEAD(&filter->fo_capa_keys); filter->fo_capa_hash = init_capa_hash(); if (filter->fo_capa_hash == NULL) GOTO(err_ops, rc = -ENOMEM); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 4150ef5..fd6a232 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1177,7 +1177,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa, aa->aa_resends = 0; aa->aa_ppga = pga; aa->aa_cli = cli; - INIT_LIST_HEAD(&aa->aa_oaps); + CFS_INIT_LIST_HEAD(&aa->aa_oaps); *reqp = req; RETURN(0); @@ -1492,9 +1492,9 @@ int osc_brw_redo_request(struct ptlrpc_request *request, new_aa = (struct osc_brw_async_args *)&new_req->rq_async_args; - INIT_LIST_HEAD(&new_aa->aa_oaps); + CFS_INIT_LIST_HEAD(&new_aa->aa_oaps); list_splice(&aa->aa_oaps, &new_aa->aa_oaps); - INIT_LIST_HEAD(&aa->aa_oaps); + CFS_INIT_LIST_HEAD(&aa->aa_oaps); list_for_each_entry(oap, &new_aa->aa_oaps, oap_rpc_item) { if (oap->oap_request) { @@ -2153,9 +2153,9 @@ static struct ptlrpc_request *osc_build_req(struct client_obd *cli, CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args)); aa = (struct osc_brw_async_args *)&req->rq_async_args; - INIT_LIST_HEAD(&aa->aa_oaps); + CFS_INIT_LIST_HEAD(&aa->aa_oaps); list_splice(rpc_list, &aa->aa_oaps); - INIT_LIST_HEAD(rpc_list); + CFS_INIT_LIST_HEAD(rpc_list); out: if (IS_ERR(req)) { diff --git a/lustre/ptlrpc/connection.c b/lustre/ptlrpc/connection.c index df65cf0..f2a7346 100644 --- a/lustre/ptlrpc/connection.c +++ b/lustre/ptlrpc/connection.c @@ -103,8 +103,8 @@ struct ptlrpc_connection *ptlrpc_get_connection(lnet_process_id_t peer, atomic_set(&c->c_refcount, 1); c->c_peer = peer; c->c_self = self; - INIT_HLIST_NODE(&c->c_hash); - INIT_LIST_HEAD(&c->c_link); + INIT_HLIST_NODE(&c->c_hash); + CFS_INIT_LIST_HEAD(&c->c_link); if (uuid != NULL) obd_str2uuid(&c->c_remote_uuid, uuid->uuid); diff --git a/lustre/ptlrpc/sec_null.c b/lustre/ptlrpc/sec_null.c index 1e693da..6cb5c8c 100644 --- a/lustre/ptlrpc/sec_null.c +++ b/lustre/ptlrpc/sec_null.c @@ -381,7 +381,7 @@ void null_init_internal(void) null_sec.ps_dying = 0; spin_lock_init(&null_sec.ps_lock); atomic_set(&null_sec.ps_nctx, 1); /* for "null_cli_ctx" */ - INIT_LIST_HEAD(&null_sec.ps_gc_list); + CFS_INIT_LIST_HEAD(&null_sec.ps_gc_list); null_sec.ps_gc_interval = 0; null_sec.ps_gc_next = 0; @@ -394,8 +394,8 @@ void null_init_internal(void) PTLRPC_CTX_UPTODATE; null_cli_ctx.cc_vcred.vc_uid = 0; spin_lock_init(&null_cli_ctx.cc_lock); - INIT_LIST_HEAD(&null_cli_ctx.cc_req_list); - INIT_LIST_HEAD(&null_cli_ctx.cc_gc_chain); + CFS_INIT_LIST_HEAD(&null_cli_ctx.cc_req_list); + CFS_INIT_LIST_HEAD(&null_cli_ctx.cc_gc_chain); } int sptlrpc_null_init(void) diff --git a/lustre/ptlrpc/sec_plain.c b/lustre/ptlrpc/sec_plain.c index 53e5fe7..2b69ced 100644 --- a/lustre/ptlrpc/sec_plain.c +++ b/lustre/ptlrpc/sec_plain.c @@ -219,8 +219,8 @@ struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec) ctx->cc_flags = PTLRPC_CTX_CACHED | PTLRPC_CTX_UPTODATE; ctx->cc_vcred.vc_uid = 0; spin_lock_init(&ctx->cc_lock); - INIT_LIST_HEAD(&ctx->cc_req_list); - INIT_LIST_HEAD(&ctx->cc_gc_chain); + CFS_INIT_LIST_HEAD(&ctx->cc_req_list); + CFS_INIT_LIST_HEAD(&ctx->cc_gc_chain); plsec->pls_ctx = ctx; atomic_inc(&plsec->pls_base.ps_nctx); @@ -294,7 +294,7 @@ struct ptlrpc_sec *plain_create_sec(struct obd_import *imp, sec->ps_import = class_import_get(imp); sec->ps_flvr = *sf; sec->ps_lock = SPIN_LOCK_UNLOCKED; - INIT_LIST_HEAD(&sec->ps_gc_list); + CFS_INIT_LIST_HEAD(&sec->ps_gc_list); sec->ps_gc_interval = 0; sec->ps_gc_next = 0; diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 6c5de20..04d306a 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -94,7 +94,7 @@ int qunit_cache_init(void) spin_lock(&qunit_hash_lock); for (i = 0; i < NR_DQHASH; i++) - INIT_LIST_HEAD(qunit_hash + i); + CFS_INIT_LIST_HEAD(qunit_hash + i); spin_unlock(&qunit_hash_lock); RETURN(0); } @@ -290,8 +290,8 @@ static struct lustre_qunit *alloc_qunit(struct lustre_quota_ctxt *qctxt, if (qunit == NULL) RETURN(NULL); - INIT_LIST_HEAD(&qunit->lq_hash); - INIT_LIST_HEAD(&qunit->lq_waiters); + CFS_INIT_LIST_HEAD(&qunit->lq_hash); + CFS_INIT_LIST_HEAD(&qunit->lq_waiters); atomic_set(&qunit->lq_refcnt, 1); qunit->lq_ctxt = qctxt; memcpy(&qunit->lq_data, qdata, sizeof(*qdata)); @@ -606,7 +606,7 @@ schedule_dqacq(struct obd_device *obd, int rc = 0; ENTRY; - INIT_LIST_HEAD(&qw.qw_entry); + CFS_INIT_LIST_HEAD(&qw.qw_entry); init_waitqueue_head(&qw.qw_waitq); qw.qw_rc = 0; @@ -754,7 +754,7 @@ qctxt_wait_pending_dqacq(struct lustre_quota_ctxt *qctxt, unsigned int id, struct l_wait_info lwi = { 0 }; ENTRY; - INIT_LIST_HEAD(&qw.qw_entry); + CFS_INIT_LIST_HEAD(&qw.qw_entry); init_waitqueue_head(&qw.qw_waitq); qw.qw_rc = 0; @@ -877,7 +877,7 @@ static int qslave_recovery_main(void *arg) } LASSERT(dqopt->files[type] != NULL); - INIT_LIST_HEAD(&id_list); + CFS_INIT_LIST_HEAD(&id_list); #ifndef KERNEL_SUPPORTS_QUOTA_READ rc = fsfilt_qids(obd, dqopt->files[type], NULL, type, &id_list); #else diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 6d7849f..0cb9159 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -544,7 +544,7 @@ static struct osc_quota_info *alloc_qinfo(struct client_obd *cli, if(!oqi) RETURN(NULL); - INIT_LIST_HEAD(&oqi->oqi_hash); + CFS_INIT_LIST_HEAD(&oqi->oqi_hash); oqi->oqi_cli = cli; oqi->oqi_id = id; oqi->oqi_type = type; @@ -661,7 +661,7 @@ int osc_quota_init(void) RETURN(-ENOMEM); for (i = 0; i < NR_DQHASH; i++) - INIT_LIST_HEAD(qinfo_hash + i); + CFS_INIT_LIST_HEAD(qinfo_hash + i); RETURN(0); } diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index d47f5f9..68e339c 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -54,7 +54,7 @@ int lustre_dquot_init(void) return (-ENOMEM); for (i = 0; i < NR_DQHASH; i++) { - INIT_LIST_HEAD(lustre_dquot_hash + i); + CFS_INIT_LIST_HEAD(lustre_dquot_hash + i); } RETURN(0); } @@ -116,7 +116,7 @@ static struct lustre_dquot *alloc_dquot(struct lustre_quota_info *lqi, if (dquot == NULL) RETURN(NULL); - INIT_LIST_HEAD(&dquot->dq_hash); + CFS_INIT_LIST_HEAD(&dquot->dq_hash); init_mutex_locked(&dquot->dq_sem); dquot->dq_refcnt = 1; dquot->dq_info = lqi; @@ -1065,7 +1065,7 @@ static int qmaster_recovery_main(void *arg) up(&mds->mds_qonoff_sem); continue; } - INIT_LIST_HEAD(&id_list); + CFS_INIT_LIST_HEAD(&id_list); rc = fsfilt_qids(obd, qinfo->qi_files[type], NULL, type, &id_list); up(&mds->mds_qonoff_sem); diff --git a/lustre/tests/it_test.c b/lustre/tests/it_test.c index dae233b..b5697b8 100644 --- a/lustre/tests/it_test.c +++ b/lustre/tests/it_test.c @@ -28,7 +28,7 @@ static struct it_node { int hit, valid; } *it_array; static int it_count; -static struct list_head header = LIST_HEAD_INIT(header); +static CFS_LIST_HEAD(header); static unsigned long max_count = ULONG_MAX & ALIGN_MASK; static int have_wide_lock = 0;