struct list_head wi_list;
/** working function */
cfs_wi_action_t wi_action;
- /** arg for working function */
- void *wi_data;
/** in running */
unsigned short wi_running:1;
/** scheduled */
};
static inline void
-cfs_wi_init(struct cfs_workitem *wi, void *data, cfs_wi_action_t action)
+cfs_wi_init(struct cfs_workitem *wi, cfs_wi_action_t action)
{
INIT_LIST_HEAD(&wi->wi_list);
wi->wi_running = 0;
wi->wi_scheduled = 0;
- wi->wi_data = data;
wi->wi_action = action;
}
static int
sfw_run_test(struct swi_workitem *wi)
{
- struct sfw_test_unit *tsu = wi->swi_workitem.wi_data;
+ struct sfw_test_unit *tsu = container_of(wi, struct sfw_test_unit, tsu_worker);
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct srpc_client_rpc *rpc = NULL;
atomic_inc(&tsi->tsi_nactive);
tsu->tsu_loop = tsi->tsi_loop;
wi = &tsu->tsu_worker;
- swi_init_workitem(wi, tsu, sfw_run_test,
+ swi_init_workitem(wi, sfw_run_test,
lst_sched_test[lnet_cpt_of_nid(tsu->tsu_dest.nid)]);
swi_schedule_workitem(wi);
}
struct srpc_buffer *buffer)
{
memset(rpc, 0, sizeof(*rpc));
- swi_init_workitem(&rpc->srpc_wi, rpc, srpc_handle_rpc,
+ swi_init_workitem(&rpc->srpc_wi, srpc_handle_rpc,
srpc_serv_is_framework(scd->scd_svc) ?
lst_sched_serial : lst_sched_test[scd->scd_cpt]);
* NB: don't use lst_sched_serial for adding buffer,
* see details in srpc_service_add_buffers()
*/
- swi_init_workitem(&scd->scd_buf_wi, scd,
+ swi_init_workitem(&scd->scd_buf_wi,
srpc_add_buffer, lst_sched_test[i]);
if (i && srpc_serv_is_framework(svc)) {
int
srpc_add_buffer(struct swi_workitem *wi)
{
- struct srpc_service_cd *scd = wi->swi_workitem.wi_data;
+ struct srpc_service_cd *scd = container_of(wi, struct srpc_service_cd, scd_buf_wi);
struct srpc_buffer *buf;
int rc = 0;
int
srpc_handle_rpc(struct swi_workitem *wi)
{
- struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data;
+ struct srpc_server_rpc *rpc = container_of(wi, struct srpc_server_rpc, srpc_wi);
struct srpc_service_cd *scd = rpc->srpc_scd;
struct srpc_service *sv = scd->scd_svc;
struct srpc_event *ev = &rpc->srpc_ev;
LASSERT(wi);
- rpc = wi->swi_workitem.wi_data;
+ rpc = container_of(wi, struct srpc_client_rpc, crpc_wi);
LASSERT(rpc);
LASSERT(wi == &rpc->crpc_wi);
}
static inline void
-swi_init_workitem(struct swi_workitem *swi, void *data,
+swi_init_workitem(struct swi_workitem *swi,
swi_action_t action, struct cfs_wi_sched *sched)
{
swi->swi_sched = sched;
swi->swi_action = action;
swi->swi_state = SWI_STATE_NEWBORN;
- cfs_wi_init(&swi->swi_workitem, data, swi_wi_action);
+ cfs_wi_init(&swi->swi_workitem, swi_wi_action);
}
static inline void
crpc_bulk.bk_iovs[nbulkiov]));
INIT_LIST_HEAD(&rpc->crpc_list);
- swi_init_workitem(&rpc->crpc_wi, rpc, srpc_send_rpc,
+ swi_init_workitem(&rpc->crpc_wi, srpc_send_rpc,
lst_sched_test[lnet_cpt_of_nid(peer.nid)]);
spin_lock_init(&rpc->crpc_lock);
atomic_set(&rpc->crpc_refcount, 1); /* 1 ref for caller */