Lines Matching full:fiq

195 u64 fuse_get_unique(struct fuse_iqueue *fiq)  in fuse_get_unique()  argument
197 fiq->reqctr += FUSE_REQ_ID_STEP; in fuse_get_unique()
198 return fiq->reqctr; in fuse_get_unique()
208 * A new request is available, wake fiq->waitq
210 static void fuse_dev_wake_and_unlock(struct fuse_iqueue *fiq) in fuse_dev_wake_and_unlock() argument
211 __releases(fiq->lock) in fuse_dev_wake_and_unlock()
213 wake_up(&fiq->waitq); in fuse_dev_wake_and_unlock()
214 kill_fasync(&fiq->fasync, SIGIO, POLL_IN); in fuse_dev_wake_and_unlock()
215 spin_unlock(&fiq->lock); in fuse_dev_wake_and_unlock()
225 static void queue_request_and_unlock(struct fuse_iqueue *fiq, in queue_request_and_unlock() argument
227 __releases(fiq->lock) in queue_request_and_unlock()
232 list_add_tail(&req->list, &fiq->pending); in queue_request_and_unlock()
233 fiq->ops->wake_pending_and_unlock(fiq); in queue_request_and_unlock()
239 struct fuse_iqueue *fiq = &fc->iq; in fuse_queue_forget() local
244 spin_lock(&fiq->lock); in fuse_queue_forget()
245 if (fiq->connected) { in fuse_queue_forget()
246 fiq->forget_list_tail->next = forget; in fuse_queue_forget()
247 fiq->forget_list_tail = forget; in fuse_queue_forget()
248 fiq->ops->wake_forget_and_unlock(fiq); in fuse_queue_forget()
251 spin_unlock(&fiq->lock); in fuse_queue_forget()
257 struct fuse_iqueue *fiq = &fc->iq; in flush_bg_queue() local
266 spin_lock(&fiq->lock); in flush_bg_queue()
267 req->in.h.unique = fuse_get_unique(fiq); in flush_bg_queue()
268 queue_request_and_unlock(fiq, req); in flush_bg_queue()
284 struct fuse_iqueue *fiq = &fc->iq; in fuse_request_end() local
295 spin_lock(&fiq->lock); in fuse_request_end()
297 spin_unlock(&fiq->lock); in fuse_request_end()
336 struct fuse_iqueue *fiq = &req->fm->fc->iq; in queue_interrupt() local
338 spin_lock(&fiq->lock); in queue_interrupt()
341 spin_unlock(&fiq->lock); in queue_interrupt()
346 list_add_tail(&req->intr_entry, &fiq->interrupts); in queue_interrupt()
354 spin_unlock(&fiq->lock); in queue_interrupt()
357 fiq->ops->wake_interrupt_and_unlock(fiq); in queue_interrupt()
359 spin_unlock(&fiq->lock); in queue_interrupt()
367 struct fuse_iqueue *fiq = &fc->iq; in request_wait_answer() local
391 spin_lock(&fiq->lock); in request_wait_answer()
395 spin_unlock(&fiq->lock); in request_wait_answer()
400 spin_unlock(&fiq->lock); in request_wait_answer()
412 struct fuse_iqueue *fiq = &req->fm->fc->iq; in __fuse_request_send() local
415 spin_lock(&fiq->lock); in __fuse_request_send()
416 if (!fiq->connected) { in __fuse_request_send()
417 spin_unlock(&fiq->lock); in __fuse_request_send()
420 req->in.h.unique = fuse_get_unique(fiq); in __fuse_request_send()
424 queue_request_and_unlock(fiq, req); in __fuse_request_send()
581 struct fuse_iqueue *fiq = &fm->fc->iq; in fuse_simple_notify_reply() local
593 spin_lock(&fiq->lock); in fuse_simple_notify_reply()
594 if (fiq->connected) { in fuse_simple_notify_reply()
595 queue_request_and_unlock(fiq, req); in fuse_simple_notify_reply()
598 spin_unlock(&fiq->lock); in fuse_simple_notify_reply()
1027 static int forget_pending(struct fuse_iqueue *fiq) in forget_pending() argument
1029 return fiq->forget_list_head.next != NULL; in forget_pending()
1032 static int request_pending(struct fuse_iqueue *fiq) in request_pending() argument
1034 return !list_empty(&fiq->pending) || !list_empty(&fiq->interrupts) || in request_pending()
1035 forget_pending(fiq); in request_pending()
1044 * Called with fiq->lock held, releases it
1046 static int fuse_read_interrupt(struct fuse_iqueue *fiq, in fuse_read_interrupt() argument
1049 __releases(fiq->lock) in fuse_read_interrupt()
1064 spin_unlock(&fiq->lock); in fuse_read_interrupt()
1076 struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq, in fuse_dequeue_forget() argument
1080 struct fuse_forget_link *head = fiq->forget_list_head.next; in fuse_dequeue_forget()
1087 fiq->forget_list_head.next = *newhead; in fuse_dequeue_forget()
1089 if (fiq->forget_list_head.next == NULL) in fuse_dequeue_forget()
1090 fiq->forget_list_tail = &fiq->forget_list_head; in fuse_dequeue_forget()
1099 static int fuse_read_single_forget(struct fuse_iqueue *fiq, in fuse_read_single_forget() argument
1102 __releases(fiq->lock) in fuse_read_single_forget()
1105 struct fuse_forget_link *forget = fuse_dequeue_forget(fiq, 1, NULL); in fuse_read_single_forget()
1112 .unique = fuse_get_unique(fiq), in fuse_read_single_forget()
1116 spin_unlock(&fiq->lock); in fuse_read_single_forget()
1132 static int fuse_read_batch_forget(struct fuse_iqueue *fiq, in fuse_read_batch_forget() argument
1134 __releases(fiq->lock) in fuse_read_batch_forget()
1143 .unique = fuse_get_unique(fiq), in fuse_read_batch_forget()
1148 spin_unlock(&fiq->lock); in fuse_read_batch_forget()
1153 head = fuse_dequeue_forget(fiq, max_forgets, &count); in fuse_read_batch_forget()
1154 spin_unlock(&fiq->lock); in fuse_read_batch_forget()
1181 static int fuse_read_forget(struct fuse_conn *fc, struct fuse_iqueue *fiq, in fuse_read_forget() argument
1184 __releases(fiq->lock) in fuse_read_forget()
1186 if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL) in fuse_read_forget()
1187 return fuse_read_single_forget(fiq, cs, nbytes); in fuse_read_forget()
1189 return fuse_read_batch_forget(fiq, cs, nbytes); in fuse_read_forget()
1206 struct fuse_iqueue *fiq = &fc->iq; in fuse_dev_do_read() local
1233 spin_lock(&fiq->lock); in fuse_dev_do_read()
1234 if (!fiq->connected || request_pending(fiq)) in fuse_dev_do_read()
1236 spin_unlock(&fiq->lock); in fuse_dev_do_read()
1240 err = wait_event_interruptible_exclusive(fiq->waitq, in fuse_dev_do_read()
1241 !fiq->connected || request_pending(fiq)); in fuse_dev_do_read()
1246 if (!fiq->connected) { in fuse_dev_do_read()
1251 if (!list_empty(&fiq->interrupts)) { in fuse_dev_do_read()
1252 req = list_entry(fiq->interrupts.next, struct fuse_req, in fuse_dev_do_read()
1254 return fuse_read_interrupt(fiq, cs, nbytes, req); in fuse_dev_do_read()
1257 if (forget_pending(fiq)) { in fuse_dev_do_read()
1258 if (list_empty(&fiq->pending) || fiq->forget_batch-- > 0) in fuse_dev_do_read()
1259 return fuse_read_forget(fc, fiq, cs, nbytes); in fuse_dev_do_read()
1261 if (fiq->forget_batch <= -8) in fuse_dev_do_read()
1262 fiq->forget_batch = 16; in fuse_dev_do_read()
1265 req = list_entry(fiq->pending.next, struct fuse_req, list); in fuse_dev_do_read()
1268 spin_unlock(&fiq->lock); in fuse_dev_do_read()
1335 spin_unlock(&fiq->lock); in fuse_dev_do_read()
2057 struct fuse_iqueue *fiq; in fuse_dev_poll() local
2063 fiq = &fud->fc->iq; in fuse_dev_poll()
2064 poll_wait(file, &fiq->waitq, wait); in fuse_dev_poll()
2066 spin_lock(&fiq->lock); in fuse_dev_poll()
2067 if (!fiq->connected) in fuse_dev_poll()
2069 else if (request_pending(fiq)) in fuse_dev_poll()
2071 spin_unlock(&fiq->lock); in fuse_dev_poll()
2124 struct fuse_iqueue *fiq = &fc->iq; in fuse_abort_conn() local
2166 spin_lock(&fiq->lock); in fuse_abort_conn()
2167 fiq->connected = 0; in fuse_abort_conn()
2168 list_for_each_entry(req, &fiq->pending, list) in fuse_abort_conn()
2170 list_splice_tail_init(&fiq->pending, &to_end); in fuse_abort_conn()
2171 while (forget_pending(fiq)) in fuse_abort_conn()
2172 kfree(fuse_dequeue_forget(fiq, 1, NULL)); in fuse_abort_conn()
2173 wake_up_all(&fiq->waitq); in fuse_abort_conn()
2174 spin_unlock(&fiq->lock); in fuse_abort_conn()
2175 kill_fasync(&fiq->fasync, SIGIO, POLL_IN); in fuse_abort_conn()