X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Fselftest%2Fselftest.h;h=4f883c9a3f965cacb8b0618c9ec08a7fd3238caf;hb=2c16e55f5676f528ba7f5652532c950b212060d0;hp=5dc9481586c2e21a113e57f8eed812a644b27d02;hpb=b4efa1b2cbfd45f85439e1bb0a4c4eb719540dcd;p=fs%2Flustre-release.git diff --git a/lnet/selftest/selftest.h b/lnet/selftest/selftest.h index 5dc9481..4f883c9 100644 --- a/lnet/selftest/selftest.h +++ b/lnet/selftest/selftest.h @@ -27,7 +27,7 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* @@ -105,7 +105,7 @@ struct sfw_test_instance; */ typedef int (*swi_action_t) (struct swi_workitem *); typedef struct swi_workitem { - struct list_head wi_list; /* chain on runq */ + cfs_list_t wi_list; /* chain on runq */ int wi_state; swi_action_t wi_action; void *wi_data; @@ -224,7 +224,7 @@ typedef struct { /* message buffer descriptor */ typedef struct { - struct list_head buf_list; /* chain on srpc_service::*_msgq */ + cfs_list_t buf_list; /* chain on srpc_service::*_msgq */ srpc_msg_t buf_msg; lnet_handle_md_t buf_mdh; lnet_nid_t buf_self; @@ -233,7 +233,7 @@ typedef struct { /* server-side state of a RPC */ typedef struct srpc_server_rpc { - struct list_head srpc_list; /* chain on srpc_service::*_rpcq */ + cfs_list_t srpc_list; /* chain on srpc_service::*_rpcq */ struct srpc_service *srpc_service; swi_workitem_t srpc_wi; srpc_event_t srpc_ev; /* bulk/reply event */ @@ -251,10 +251,10 @@ typedef struct srpc_server_rpc { /* client-side state of a RPC */ typedef struct srpc_client_rpc { - struct list_head crpc_list; /* chain on user's lists */ - spinlock_t crpc_lock; /* serialize */ + cfs_list_t crpc_list; /* chain on user's lists */ + cfs_spinlock_t crpc_lock; /* serialize */ int crpc_service; - atomic_t crpc_refcount; + cfs_atomic_t crpc_refcount; int crpc_timeout; /* # seconds to wait for reply */ stt_timer_t crpc_timer; swi_workitem_t crpc_wi; @@ -289,18 +289,18 @@ offsetof(srpc_client_rpc_t, crpc_bulk.bk_iovs[(rpc)->crpc_bulk.bk_niov]) do { \ CDEBUG(D_NET, "RPC[%p] -> %s (%d)++\n", \ (rpc), libcfs_id2str((rpc)->crpc_dest), \ - atomic_read(&(rpc)->crpc_refcount)); \ - LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \ - atomic_inc(&(rpc)->crpc_refcount); \ + cfs_atomic_read(&(rpc)->crpc_refcount)); \ + LASSERT(cfs_atomic_read(&(rpc)->crpc_refcount) > 0); \ + cfs_atomic_inc(&(rpc)->crpc_refcount); \ } while (0) #define srpc_client_rpc_decref(rpc) \ do { \ CDEBUG(D_NET, "RPC[%p] -> %s (%d)--\n", \ (rpc), libcfs_id2str((rpc)->crpc_dest), \ - atomic_read(&(rpc)->crpc_refcount)); \ - LASSERT(atomic_read(&(rpc)->crpc_refcount) > 0); \ - if (atomic_dec_and_test(&(rpc)->crpc_refcount)) \ + cfs_atomic_read(&(rpc)->crpc_refcount)); \ + LASSERT(cfs_atomic_read(&(rpc)->crpc_refcount) > 0); \ + if (cfs_atomic_dec_and_test(&(rpc)->crpc_refcount)) \ srpc_destroy_client_rpc(rpc); \ } while (0) @@ -314,49 +314,49 @@ typedef struct srpc_service { int sv_nprune; /* # posted RPC to be pruned */ int sv_concur; /* max # concurrent RPCs */ - spinlock_t sv_lock; + cfs_spinlock_t sv_lock; int sv_shuttingdown; srpc_event_t sv_ev; /* LNet event */ int sv_nposted_msg; /* # posted message buffers */ - struct list_head sv_free_rpcq; /* free RPC descriptors */ - struct list_head sv_active_rpcq; /* in-flight RPCs */ - struct list_head sv_posted_msgq; /* posted message buffers */ - struct list_head sv_blocked_msgq; /* blocked for RPC descriptor */ + cfs_list_t sv_free_rpcq; /* free RPC descriptors */ + cfs_list_t sv_active_rpcq; /* in-flight RPCs */ + cfs_list_t sv_posted_msgq; /* posted message buffers */ + cfs_list_t sv_blocked_msgq; /* blocked for RPC descriptor */ /* Service callbacks: * - sv_handler: process incoming RPC request * - sv_bulk_ready: notify bulk data */ - int (*sv_handler) (srpc_server_rpc_t *); - int (*sv_bulk_ready) (srpc_server_rpc_t *, int); + int (*sv_handler) (srpc_server_rpc_t *); + int (*sv_bulk_ready) (srpc_server_rpc_t *, int); } srpc_service_t; #define SFW_POST_BUFFERS 256 #define SFW_SERVICE_CONCURRENCY (SFW_POST_BUFFERS/2) typedef struct { - struct list_head sn_list; /* chain on fw_zombie_sessions */ + cfs_list_t sn_list; /* chain on fw_zombie_sessions */ lst_sid_t sn_id; /* unique identifier */ unsigned int sn_timeout; /* # seconds' inactivity to expire */ int sn_timer_active; stt_timer_t sn_timer; - struct list_head sn_batches; /* list of batches */ + cfs_list_t sn_batches; /* list of batches */ char sn_name[LST_NAME_SIZE]; - atomic_t sn_refcount; - atomic_t sn_brw_errors; - atomic_t sn_ping_errors; + cfs_atomic_t sn_refcount; + cfs_atomic_t sn_brw_errors; + cfs_atomic_t sn_ping_errors; } sfw_session_t; #define sfw_sid_equal(sid0, sid1) ((sid0).ses_nid == (sid1).ses_nid && \ (sid0).ses_stamp == (sid1).ses_stamp) typedef struct { - struct list_head bat_list; /* chain on sn_batches */ + cfs_list_t bat_list; /* chain on sn_batches */ lst_bid_t bat_id; /* batch id */ int bat_error; /* error code of batch */ sfw_session_t *bat_session; /* batch's session */ - atomic_t bat_nactive; /* # of active tests */ - struct list_head bat_tests; /* test instances */ + cfs_atomic_t bat_nactive; /* # of active tests */ + cfs_list_t bat_tests; /* test instances */ } sfw_batch_t; typedef struct { @@ -370,7 +370,7 @@ typedef struct { } sfw_test_client_ops_t; typedef struct sfw_test_instance { - struct list_head tsi_list; /* chain on batch */ + cfs_list_t tsi_list; /* chain on batch */ int tsi_service; /* test type */ sfw_batch_t *tsi_batch; /* batch */ sfw_test_client_ops_t *tsi_ops; /* test client operations */ @@ -382,12 +382,12 @@ typedef struct sfw_test_instance { int tsi_loop; /* loop count */ /* status of test instance */ - spinlock_t tsi_lock; /* serialize */ + cfs_spinlock_t tsi_lock; /* serialize */ int tsi_stopping:1; /* test is stopping */ - atomic_t tsi_nactive; /* # of active test unit */ - struct list_head tsi_units; /* test units */ - struct list_head tsi_free_rpcs; /* free rpcs */ - struct list_head tsi_active_rpcs; /* active rpcs */ + cfs_atomic_t tsi_nactive; /* # of active test unit */ + cfs_list_t tsi_units; /* test units */ + cfs_list_t tsi_free_rpcs; /* free rpcs */ + cfs_list_t tsi_active_rpcs; /* active rpcs */ union { test_bulk_req_t bulk; /* bulk parameter */ @@ -398,21 +398,21 @@ typedef struct sfw_test_instance { /* XXX: trailing (CFS_PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at * the end of pages are not used */ #define SFW_MAX_CONCUR LST_MAX_CONCUR -#define SFW_ID_PER_PAGE (CFS_PAGE_SIZE / sizeof(lnet_process_id_t)) +#define SFW_ID_PER_PAGE (CFS_PAGE_SIZE / sizeof(lnet_process_id_packed_t)) #define SFW_MAX_NDESTS (LNET_MAX_IOV * SFW_ID_PER_PAGE) #define sfw_id_pages(n) (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE) typedef struct sfw_test_unit { - struct list_head tsu_list; /* chain on lst_test_instance */ - lnet_process_id_t tsu_dest; /* id of dest node */ - int tsu_loop; /* loop count of the test */ - sfw_test_instance_t *tsu_instance; /* pointer to test instance */ - void *tsu_private; /* private data */ - swi_workitem_t tsu_worker; /* workitem of the test unit */ + cfs_list_t tsu_list; /* chain on lst_test_instance */ + lnet_process_id_t tsu_dest; /* id of dest node */ + int tsu_loop; /* loop count of the test */ + sfw_test_instance_t *tsu_instance; /* pointer to test instance */ + void *tsu_private; /* private data */ + swi_workitem_t tsu_worker; /* workitem of the test unit */ } sfw_test_unit_t; typedef struct { - struct list_head tsc_list; /* chain on fw_tests */ + cfs_list_t tsc_list; /* chain on fw_tests */ srpc_service_t *tsc_srv_service; /* test service */ sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */ } sfw_test_case_t; @@ -468,7 +468,7 @@ srpc_destroy_client_rpc (srpc_client_rpc_t *rpc) { LASSERT (rpc != NULL); LASSERT (!srpc_event_pending(rpc)); - LASSERT (atomic_read(&rpc->crpc_refcount) == 0); + LASSERT (cfs_atomic_read(&rpc->crpc_refcount) == 0); #ifndef __KERNEL__ LASSERT (rpc->crpc_bulk.bk_pages == NULL); #endif @@ -495,8 +495,8 @@ srpc_init_client_rpc (srpc_client_rpc_t *rpc, lnet_process_id_t peer, CFS_INIT_LIST_HEAD(&rpc->crpc_list); swi_init_workitem(&rpc->crpc_wi, rpc, srpc_send_rpc); - spin_lock_init(&rpc->crpc_lock); - atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */ + cfs_spin_lock_init(&rpc->crpc_lock); + cfs_atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */ rpc->crpc_dest = peer; rpc->crpc_priv = priv; @@ -566,11 +566,11 @@ do { \ while (!(cond)) { \ CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ fmt, ## __VA_ARGS__); \ - spin_unlock(&(lock)); \ + cfs_spin_unlock(&(lock)); \ \ selftest_wait_events(); \ \ - spin_lock(&(lock)); \ + cfs_spin_lock(&(lock)); \ } \ } while (0) @@ -579,9 +579,9 @@ srpc_wait_service_shutdown (srpc_service_t *sv) { int i = 2; - spin_lock(&sv->sv_lock); + cfs_spin_lock(&sv->sv_lock); LASSERT (sv->sv_shuttingdown); - spin_unlock(&sv->sv_lock); + cfs_spin_unlock(&sv->sv_lock); while (srpc_finish_service(sv) == 0) { i++;