• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/fs/fuse/

Lines Matching refs:fc

87 struct fuse_req *fuse_get_req(struct fuse_conn *fc)
94 atomic_inc(&fc->num_waiting);
96 intr = wait_event_interruptible(fc->blocked_waitq, !fc->blocked);
103 if (!fc->connected)
116 atomic_dec(&fc->num_waiting);
125 static struct fuse_req *get_reserved_req(struct fuse_conn *fc,
132 wait_event(fc->blocked_waitq, ff->reserved_req);
133 spin_lock(&fc->lock);
140 spin_unlock(&fc->lock);
149 static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req)
154 spin_lock(&fc->lock);
158 wake_up(&fc->blocked_waitq);
159 spin_unlock(&fc->lock);
176 struct fuse_req *fuse_get_req_nofail(struct fuse_conn *fc, struct file *file)
180 atomic_inc(&fc->num_waiting);
181 wait_event(fc->blocked_waitq, !fc->blocked);
184 req = get_reserved_req(fc, file);
191 void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
195 atomic_dec(&fc->num_waiting);
198 put_reserved_req(fc, req);
212 * Called with fc->lock, unlocks it
214 static void request_end(struct fuse_conn *fc, struct fuse_req *req)
215 __releases(fc->lock)
223 if (fc->num_background == FUSE_MAX_BACKGROUND) {
224 fc->blocked = 0;
225 wake_up_all(&fc->blocked_waitq);
227 fc->num_background--;
229 spin_unlock(&fc->lock);
236 end(fc, req);
238 fuse_put_request(fc, req);
241 static void wait_answer_interruptible(struct fuse_conn *fc,
247 spin_unlock(&fc->lock);
249 spin_lock(&fc->lock);
252 static void queue_interrupt(struct fuse_conn *fc, struct fuse_req *req)
254 list_add_tail(&req->intr_entry, &fc->interrupts);
255 wake_up(&fc->waitq);
256 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
259 /* Called with fc->lock held. Releases, and then reacquires it. */
260 static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
262 if (!fc->no_interrupt) {
264 wait_answer_interruptible(fc, req);
273 queue_interrupt(fc, req);
277 spin_unlock(&fc->lock);
279 spin_lock(&fc->lock);
285 wait_answer_interruptible(fc, req);
304 spin_unlock(&fc->lock);
306 spin_lock(&fc->lock);
312 spin_unlock(&fc->lock);
314 spin_lock(&fc->lock);
329 static u64 fuse_get_unique(struct fuse_conn *fc)
331 fc->reqctr++;
333 if (fc->reqctr == 0)
334 fc->reqctr = 1;
336 return fc->reqctr;
339 static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
341 req->in.h.unique = fuse_get_unique(fc);
344 list_add_tail(&req->list, &fc->pending);
348 atomic_inc(&fc->num_waiting);
350 wake_up(&fc->waitq);
351 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
354 void request_send(struct fuse_conn *fc, struct fuse_req *req)
357 spin_lock(&fc->lock);
358 if (!fc->connected)
360 else if (fc->conn_error)
363 queue_request(fc, req);
368 request_wait_answer(fc, req);
370 spin_unlock(&fc->lock);
373 static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
375 spin_lock(&fc->lock);
376 if (fc->connected) {
378 fc->num_background++;
379 if (fc->num_background == FUSE_MAX_BACKGROUND)
380 fc->blocked = 1;
382 queue_request(fc, req);
383 spin_unlock(&fc->lock);
386 request_end(fc, req);
390 void request_send_noreply(struct fuse_conn *fc, struct fuse_req *req)
393 request_send_nowait(fc, req);
396 void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
399 request_send_nowait(fc, req);
407 static int lock_request(struct fuse_conn *fc, struct fuse_req *req)
411 spin_lock(&fc->lock);
416 spin_unlock(&fc->lock);
426 static void unlock_request(struct fuse_conn *fc, struct fuse_req *req)
429 spin_lock(&fc->lock);
433 spin_unlock(&fc->lock);
438 struct fuse_conn *fc;
451 static void fuse_copy_init(struct fuse_copy_state *cs, struct fuse_conn *fc,
456 cs->fc = fc;
486 unlock_request(cs->fc, cs->req);
509 return lock_request(cs->fc, cs->req);
610 static int request_pending(struct fuse_conn *fc)
612 return !list_empty(&fc->pending) || !list_empty(&fc->interrupts);
616 static void request_wait(struct fuse_conn *fc)
620 add_wait_queue_exclusive(&fc->waitq, &wait);
621 while (fc->connected && !request_pending(fc)) {
626 spin_unlock(&fc->lock);
628 spin_lock(&fc->lock);
631 remove_wait_queue(&fc->waitq, &wait);
640 * Called with fc->lock held, releases it
642 static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_req *req,
644 __releases(fc->lock)
653 req->intr_unique = fuse_get_unique(fc);
661 spin_unlock(&fc->lock);
665 fuse_copy_init(&cs, fc, 1, NULL, iov, nr_segs);
692 struct fuse_conn *fc = fuse_get_conn(file);
693 if (!fc)
697 spin_lock(&fc->lock);
699 if ((file->f_flags & O_NONBLOCK) && fc->connected &&
700 !request_pending(fc))
703 request_wait(fc);
705 if (!fc->connected)
708 if (!request_pending(fc))
711 if (!list_empty(&fc->interrupts)) {
712 req = list_entry(fc->interrupts.next, struct fuse_req,
714 return fuse_read_interrupt(fc, req, iov, nr_segs);
717 req = list_entry(fc->pending.next, struct fuse_req, list);
719 list_move(&req->list, &fc->io);
729 request_end(fc, req);
732 spin_unlock(&fc->lock);
733 fuse_copy_init(&cs, fc, 1, req, iov, nr_segs);
739 spin_lock(&fc->lock);
746 request_end(fc, req);
750 request_end(fc, req);
753 list_move_tail(&req->list, &fc->processing);
755 queue_interrupt(fc, req);
756 spin_unlock(&fc->lock);
761 spin_unlock(&fc->lock);
766 static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique)
770 list_for_each(entry, &fc->processing) {
817 struct fuse_conn *fc = fuse_get_conn(iocb->ki_filp);
818 if (!fc)
821 fuse_copy_init(&cs, fc, 0, NULL, iov, nr_segs);
833 spin_lock(&fc->lock);
835 if (!fc->connected)
838 req = request_find(fc, oh.unique);
843 spin_unlock(&fc->lock);
845 spin_lock(&fc->lock);
846 request_end(fc, req);
856 fc->no_interrupt = 1;
858 queue_interrupt(fc, req);
860 spin_unlock(&fc->lock);
866 list_move(&req->list, &fc->io);
870 spin_unlock(&fc->lock);
875 spin_lock(&fc->lock);
882 request_end(fc, req);
887 spin_unlock(&fc->lock);
896 struct fuse_conn *fc = fuse_get_conn(file);
897 if (!fc)
900 poll_wait(file, &fc->waitq, wait);
902 spin_lock(&fc->lock);
903 if (!fc->connected)
905 else if (request_pending(fc))
907 spin_unlock(&fc->lock);
915 * This function releases and reacquires fc->lock
917 static void end_requests(struct fuse_conn *fc, struct list_head *head)
923 request_end(fc, req);
924 spin_lock(&fc->lock);
939 static void end_io_requests(struct fuse_conn *fc)
941 while (!list_empty(&fc->io)) {
943 list_entry(fc->io.next, struct fuse_req, list);
955 spin_unlock(&fc->lock);
957 end(fc, req);
958 spin_lock(&fc->lock);
982 void fuse_abort_conn(struct fuse_conn *fc)
984 spin_lock(&fc->lock);
985 if (fc->connected) {
986 fc->connected = 0;
987 fc->blocked = 0;
988 end_io_requests(fc);
989 end_requests(fc, &fc->pending);
990 end_requests(fc, &fc->processing);
991 wake_up_all(&fc->waitq);
992 wake_up_all(&fc->blocked_waitq);
993 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
995 spin_unlock(&fc->lock);
1000 struct fuse_conn *fc = fuse_get_conn(file);
1001 if (fc) {
1002 spin_lock(&fc->lock);
1003 fc->connected = 0;
1004 end_requests(fc, &fc->pending);
1005 end_requests(fc, &fc->processing);
1006 spin_unlock(&fc->lock);
1007 fasync_helper(-1, file, 0, &fc->fasync);
1008 fuse_conn_put(fc);
1016 struct fuse_conn *fc = fuse_get_conn(file);
1017 if (!fc)
1021 return fasync_helper(fd, file, on, &fc->fasync);