Lines Matching refs:work

21 	struct ksmbd_work *work = kmem_cache_zalloc(work_cache, GFP_KERNEL);  in ksmbd_alloc_work_struct()  local
23 if (work) { in ksmbd_alloc_work_struct()
24 work->compound_fid = KSMBD_NO_FID; in ksmbd_alloc_work_struct()
25 work->compound_pfid = KSMBD_NO_FID; in ksmbd_alloc_work_struct()
26 INIT_LIST_HEAD(&work->request_entry); in ksmbd_alloc_work_struct()
27 INIT_LIST_HEAD(&work->async_request_entry); in ksmbd_alloc_work_struct()
28 INIT_LIST_HEAD(&work->fp_entry); in ksmbd_alloc_work_struct()
29 INIT_LIST_HEAD(&work->interim_entry); in ksmbd_alloc_work_struct()
30 INIT_LIST_HEAD(&work->aux_read_list); in ksmbd_alloc_work_struct()
31 work->iov_alloc_cnt = 4; in ksmbd_alloc_work_struct()
32 work->iov = kcalloc(work->iov_alloc_cnt, sizeof(struct kvec), in ksmbd_alloc_work_struct()
34 if (!work->iov) { in ksmbd_alloc_work_struct()
35 kmem_cache_free(work_cache, work); in ksmbd_alloc_work_struct()
36 work = NULL; in ksmbd_alloc_work_struct()
39 return work; in ksmbd_alloc_work_struct()
42 void ksmbd_free_work_struct(struct ksmbd_work *work) in ksmbd_free_work_struct() argument
46 WARN_ON(work->saved_cred != NULL); in ksmbd_free_work_struct()
48 kvfree(work->response_buf); in ksmbd_free_work_struct()
50 list_for_each_entry_safe(ar, tmp, &work->aux_read_list, entry) { in ksmbd_free_work_struct()
56 kfree(work->tr_buf); in ksmbd_free_work_struct()
57 kvfree(work->request_buf); in ksmbd_free_work_struct()
58 kfree(work->iov); in ksmbd_free_work_struct()
59 if (!list_empty(&work->interim_entry)) in ksmbd_free_work_struct()
60 list_del(&work->interim_entry); in ksmbd_free_work_struct()
62 if (work->async_id) in ksmbd_free_work_struct()
63 ksmbd_release_id(&work->conn->async_ida, work->async_id); in ksmbd_free_work_struct()
64 kmem_cache_free(work_cache, work); in ksmbd_free_work_struct()
96 bool ksmbd_queue_work(struct ksmbd_work *work) in ksmbd_queue_work() argument
98 return queue_work(ksmbd_wq, &work->work); in ksmbd_queue_work()
101 static inline void __ksmbd_iov_pin(struct ksmbd_work *work, void *ib, in __ksmbd_iov_pin() argument
104 work->iov[++work->iov_idx].iov_base = ib; in __ksmbd_iov_pin()
105 work->iov[work->iov_idx].iov_len = ib_len; in __ksmbd_iov_pin()
106 work->iov_cnt++; in __ksmbd_iov_pin()
109 static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len, in __ksmbd_iov_pin_rsp() argument
122 if (work->iov_alloc_cnt < work->iov_cnt + need_iov_cnt) { in __ksmbd_iov_pin_rsp()
125 work->iov_alloc_cnt += 4; in __ksmbd_iov_pin_rsp()
126 new = krealloc(work->iov, in __ksmbd_iov_pin_rsp()
127 sizeof(struct kvec) * work->iov_alloc_cnt, in __ksmbd_iov_pin_rsp()
131 work->iov_alloc_cnt -= 4; in __ksmbd_iov_pin_rsp()
134 work->iov = new; in __ksmbd_iov_pin_rsp()
138 if (!work->iov_idx) { in __ksmbd_iov_pin_rsp()
139 work->iov[work->iov_idx].iov_base = work->response_buf; in __ksmbd_iov_pin_rsp()
140 *(__be32 *)work->iov[0].iov_base = 0; in __ksmbd_iov_pin_rsp()
141 work->iov[work->iov_idx].iov_len = 4; in __ksmbd_iov_pin_rsp()
142 work->iov_cnt++; in __ksmbd_iov_pin_rsp()
145 __ksmbd_iov_pin(work, ib, len); in __ksmbd_iov_pin_rsp()
146 inc_rfc1001_len(work->iov[0].iov_base, len); in __ksmbd_iov_pin_rsp()
149 __ksmbd_iov_pin(work, aux_buf, aux_size); in __ksmbd_iov_pin_rsp()
150 inc_rfc1001_len(work->iov[0].iov_base, aux_size); in __ksmbd_iov_pin_rsp()
153 list_add(&ar->entry, &work->aux_read_list); in __ksmbd_iov_pin_rsp()
159 int ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len) in ksmbd_iov_pin_rsp() argument
161 return __ksmbd_iov_pin_rsp(work, ib, len, NULL, 0); in ksmbd_iov_pin_rsp()
164 int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len, in ksmbd_iov_pin_rsp_read() argument
167 return __ksmbd_iov_pin_rsp(work, ib, len, aux_buf, aux_size); in ksmbd_iov_pin_rsp_read()
170 int allocate_interim_rsp_buf(struct ksmbd_work *work) in allocate_interim_rsp_buf() argument
172 work->response_buf = kzalloc(MAX_CIFS_SMALL_BUFFER_SIZE, GFP_KERNEL); in allocate_interim_rsp_buf()
173 if (!work->response_buf) in allocate_interim_rsp_buf()
175 work->response_sz = MAX_CIFS_SMALL_BUFFER_SIZE; in allocate_interim_rsp_buf()