Lines Matching refs:ioctx_x

38 	struct iothread_ctx *ioctx_x = (struct iothread_ctx *)arg;  in io_thread()  local
42 while(ioctx_x->started) { in io_thread()
43 n = epoll_wait(ioctx_x->epfd, eventlist, MEVENT_MAX, -1); in io_thread()
65 iothread_start(struct iothread_ctx *ioctx_x) in iothread_start() argument
69 pthread_mutex_lock(&ioctx_x->mtx); in iothread_start()
71 if (ioctx_x->started) { in iothread_start()
72 pthread_mutex_unlock(&ioctx_x->mtx); in iothread_start()
76 if (pthread_create(&ioctx_x->tid, NULL, io_thread, ioctx_x) != 0) { in iothread_start()
77 pthread_mutex_unlock(&ioctx_x->mtx); in iothread_start()
82 ioctx_x->started = true; in iothread_start()
83 pthread_setname_np(ioctx_x->tid, ioctx_x->name); in iothread_start()
85 if (CPU_COUNT(&(ioctx_x->cpuset)) != 0) { in iothread_start()
86 ret = pthread_setaffinity_np(ioctx_x->tid, sizeof(cpuset_t), &(ioctx_x->cpuset)); in iothread_start()
92 pthread_mutex_unlock(&ioctx_x->mtx); in iothread_start()
93 pr_info("%s started\n", ioctx_x->name); in iothread_start()
99 iothread_add(struct iothread_ctx *ioctx_x, int fd, struct iothread_mevent *aevt) in iothread_add() argument
104 if (ioctx_x == NULL) { in iothread_add()
112 ret = epoll_ctl(ioctx_x->epfd, EPOLL_CTL_ADD, fd, &ee); in iothread_add()
120 ret = iothread_start(ioctx_x); in iothread_add()
129 iothread_del(struct iothread_ctx *ioctx_x, int fd) in iothread_del() argument
133 if (ioctx_x == NULL) { in iothread_del()
138 if (ioctx_x->epfd) { in iothread_del()
139 ret = epoll_ctl(ioctx_x->epfd, EPOLL_CTL_DEL, fd, NULL); in iothread_del()
152 struct iothread_ctx *ioctx_x; in iothread_deinit() local
156 ioctx_x = &ioctxes[i]; in iothread_deinit()
158 if (ioctx_x->tid > 0) { in iothread_deinit()
159 pthread_mutex_lock(&ioctx_x->mtx); in iothread_deinit()
160 ioctx_x->started = false; in iothread_deinit()
161 pthread_mutex_unlock(&ioctx_x->mtx); in iothread_deinit()
162 pthread_kill(ioctx_x->tid, SIGCONT); in iothread_deinit()
163 pthread_join(ioctx_x->tid, &jval); in iothread_deinit()
165 if (ioctx_x->epfd > 0) { in iothread_deinit()
166 close(ioctx_x->epfd); in iothread_deinit()
167 ioctx_x->epfd = -1; in iothread_deinit()
169 pthread_mutex_destroy(&ioctx_x->mtx); in iothread_deinit()
170 pr_info("%s stop \n", ioctx_x->name); in iothread_deinit()
194 struct iothread_ctx *ioctx_x; in iothread_create() local
213 ioctx_x = &ioctxes[i]; in iothread_create()
217 pthread_mutex_init(&(ioctx_x->mtx), &attr); in iothread_create()
220 ioctx_x->idx = i; in iothread_create()
221 ioctx_x->tid = 0; in iothread_create()
222 ioctx_x->started = false; in iothread_create()
223 ioctx_x->epfd = epoll_create1(0); in iothread_create()
225 CPU_ZERO(&(ioctx_x->cpuset)); in iothread_create()
227 memcpy(&(ioctx_x->cpuset), iothr_opt->cpusets + (i - base), sizeof(cpu_set_t)); in iothread_create()
230 if (snprintf(ioctx_x->name, PTHREAD_NAME_MAX_LEN, in iothread_create()
231 "iothr-%d-%s", ioctx_x->idx, iothr_opt->tag) >= PTHREAD_NAME_MAX_LEN) { in iothread_create()
235 if (ioctx_x->epfd < 0) { in iothread_create()