Whamcloud - gitweb
use generic LIST_HEAD macros instead of linux specific.
authorshadow <shadow>
Thu, 24 Apr 2008 06:48:33 +0000 (06:48 +0000)
committershadow <shadow>
Thu, 24 Apr 2008 06:48:33 +0000 (06:48 +0000)
b=14929
i=zam

25 files changed:
lnet/include/libcfs/list.h
lnet/lnet/api-ni.c
lnet/lnet/config.c
lnet/lnet/router.c
lustre/fld/fld_request.c
lustre/include/liblustre.h
lustre/include/lustre_capa.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/liblustre/super.c
lustre/lmv/lmv_object.c
lustre/lov/lov_obd.c
lustre/mgc/mgc_request.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdclass/obd_mount.c
lustre/obdfilter/filter.c
lustre/osc/osc_request.c
lustre/ptlrpc/connection.c
lustre/ptlrpc/sec_null.c
lustre/ptlrpc/sec_plain.c
lustre/quota/quota_context.c
lustre/quota/quota_interface.c
lustre/quota/quota_master.c
lustre/tests/it_test.c

index 5c27071..799d853 100644 (file)
@@ -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.
  *
index 8581ea4..4fd9adb 100644 (file)
@@ -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;
index 7bb8799..7425877 100644 (file)
@@ -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 */
index aee3334..01b635a 100644 (file)
@@ -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;
 
index 1ec2b9c..fce247c 100644 (file)
@@ -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 /
index 67f0066..c562e75 100644 (file)
@@ -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;
 }
 
index 9e71a21..c7e6732 100644 (file)
@@ -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;
index 98044fa..a6d5b55 100644 (file)
@@ -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;
index 63d3172..cc7fc39 100644 (file)
@@ -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) {
index 4fdb76d..cb7284b 100644 (file)
@@ -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);
 
index 922eea5..2c82ffe 100644 (file)
@@ -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. */
index 7b71280..dd9ab38 100644 (file)
@@ -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;
index 18ad5c3..ee5aaa9 100644 (file)
@@ -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 */
index 6122cfe..1e680ba 100644 (file)
@@ -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) {
index 1bbd7de..4e49f34 100644 (file)
@@ -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);
 }
 
index 649617a..5f3d6ff 100644 (file)
@@ -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)
 {
index c9ce969..24d3ff9 100644 (file)
@@ -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);
index 4150ef5..fd6a232 100644 (file)
@@ -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)) {
index df65cf0..f2a7346 100644 (file)
@@ -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);
 
index 1e693da..6cb5c8c 100644 (file)
@@ -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)
index 53e5fe7..2b69ced 100644 (file)
@@ -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;
 
index 6c5de20..04d306a 100644 (file)
@@ -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
index 6d7849f..0cb9159 100644 (file)
@@ -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);
 }
index d47f5f9..68e339c 100644 (file)
@@ -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);
index dae233b..b5697b8 100644 (file)
@@ -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;