• Home
  • Raw
  • Download

Lines Matching refs:fc

123 void fuse_set_initialized(struct fuse_conn *fc)  in fuse_set_initialized()  argument
127 fc->initialized = 1; in fuse_set_initialized()
130 static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) in fuse_block_alloc() argument
132 return !fc->initialized || (for_background && fc->blocked); in fuse_block_alloc()
135 static struct fuse_req *__fuse_get_req(struct fuse_conn *fc, unsigned npages, in __fuse_get_req() argument
140 atomic_inc(&fc->num_waiting); in __fuse_get_req()
142 if (fuse_block_alloc(fc, for_background)) { in __fuse_get_req()
144 if (wait_event_killable_exclusive(fc->blocked_waitq, in __fuse_get_req()
145 !fuse_block_alloc(fc, for_background))) in __fuse_get_req()
152 if (!fc->connected) in __fuse_get_req()
156 if (fc->conn_error) in __fuse_get_req()
163 wake_up(&fc->blocked_waitq); in __fuse_get_req()
175 atomic_dec(&fc->num_waiting); in __fuse_get_req()
179 struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages) in fuse_get_req() argument
181 return __fuse_get_req(fc, npages, false); in fuse_get_req()
185 struct fuse_req *fuse_get_req_for_background(struct fuse_conn *fc, in fuse_get_req_for_background() argument
188 return __fuse_get_req(fc, npages, true); in fuse_get_req_for_background()
197 static struct fuse_req *get_reserved_req(struct fuse_conn *fc, in get_reserved_req() argument
204 wait_event(fc->reserved_req_waitq, ff->reserved_req); in get_reserved_req()
205 spin_lock(&fc->lock); in get_reserved_req()
211 spin_unlock(&fc->lock); in get_reserved_req()
220 static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req) in put_reserved_req() argument
225 spin_lock(&fc->lock); in put_reserved_req()
229 wake_up_all(&fc->reserved_req_waitq); in put_reserved_req()
230 spin_unlock(&fc->lock); in put_reserved_req()
247 struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc, in fuse_get_req_nofail_nopages() argument
252 atomic_inc(&fc->num_waiting); in fuse_get_req_nofail_nopages()
253 wait_event(fc->blocked_waitq, fc->initialized); in fuse_get_req_nofail_nopages()
258 req = get_reserved_req(fc, file); in fuse_get_req_nofail_nopages()
266 void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req) in fuse_put_request() argument
274 spin_lock(&fc->lock); in fuse_put_request()
275 if (!fc->blocked) in fuse_put_request()
276 wake_up(&fc->blocked_waitq); in fuse_put_request()
277 spin_unlock(&fc->lock); in fuse_put_request()
282 atomic_dec(&fc->num_waiting); in fuse_put_request()
286 put_reserved_req(fc, req); in fuse_put_request()
318 void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, in fuse_queue_forget() argument
321 struct fuse_iqueue *fiq = &fc->iq; in fuse_queue_forget()
338 static void flush_bg_queue(struct fuse_conn *fc) in flush_bg_queue() argument
340 while (fc->active_background < fc->max_background && in flush_bg_queue()
341 !list_empty(&fc->bg_queue)) { in flush_bg_queue()
343 struct fuse_iqueue *fiq = &fc->iq; in flush_bg_queue()
345 req = list_entry(fc->bg_queue.next, struct fuse_req, list); in flush_bg_queue()
347 fc->active_background++; in flush_bg_queue()
363 static void request_end(struct fuse_conn *fc, struct fuse_req *req) in request_end() argument
365 struct fuse_iqueue *fiq = &fc->iq; in request_end()
376 spin_lock(&fc->lock); in request_end()
378 if (fc->num_background == fc->max_background) in request_end()
379 fc->blocked = 0; in request_end()
382 if (!fc->blocked && waitqueue_active(&fc->blocked_waitq)) in request_end()
383 wake_up(&fc->blocked_waitq); in request_end()
385 if (fc->num_background == fc->congestion_threshold && in request_end()
386 fc->connected && fc->bdi_initialized) { in request_end()
387 clear_bdi_congested(&fc->bdi, BLK_RW_SYNC); in request_end()
388 clear_bdi_congested(&fc->bdi, BLK_RW_ASYNC); in request_end()
390 fc->num_background--; in request_end()
391 fc->active_background--; in request_end()
392 flush_bg_queue(fc); in request_end()
393 spin_unlock(&fc->lock); in request_end()
397 req->end(fc, req); in request_end()
398 fuse_put_request(fc, req); in request_end()
416 static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) in request_wait_answer() argument
418 struct fuse_iqueue *fiq = &fc->iq; in request_wait_answer()
421 if (!fc->no_interrupt) { in request_wait_answer()
463 static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) in __fuse_request_send() argument
465 struct fuse_iqueue *fiq = &fc->iq; in __fuse_request_send()
480 request_wait_answer(fc, req); in __fuse_request_send()
486 void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) in fuse_request_send() argument
491 atomic_inc(&fc->num_waiting); in fuse_request_send()
493 __fuse_request_send(fc, req); in fuse_request_send()
497 static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args) in fuse_adjust_compat() argument
499 if (fc->minor < 4 && args->in.h.opcode == FUSE_STATFS) in fuse_adjust_compat()
502 if (fc->minor < 9) { in fuse_adjust_compat()
518 if (fc->minor < 12) { in fuse_adjust_compat()
530 ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args) in fuse_simple_request() argument
535 req = fuse_get_req(fc, 0); in fuse_simple_request()
540 fuse_adjust_compat(fc, args); in fuse_simple_request()
551 fuse_request_send(fc, req); in fuse_simple_request()
557 fuse_put_request(fc, req); in fuse_simple_request()
567 void fuse_request_send_background_locked(struct fuse_conn *fc, in fuse_request_send_background_locked() argument
573 atomic_inc(&fc->num_waiting); in fuse_request_send_background_locked()
576 fc->num_background++; in fuse_request_send_background_locked()
577 if (fc->num_background == fc->max_background) in fuse_request_send_background_locked()
578 fc->blocked = 1; in fuse_request_send_background_locked()
579 if (fc->num_background == fc->congestion_threshold && in fuse_request_send_background_locked()
580 fc->bdi_initialized) { in fuse_request_send_background_locked()
581 set_bdi_congested(&fc->bdi, BLK_RW_SYNC); in fuse_request_send_background_locked()
582 set_bdi_congested(&fc->bdi, BLK_RW_ASYNC); in fuse_request_send_background_locked()
584 list_add_tail(&req->list, &fc->bg_queue); in fuse_request_send_background_locked()
585 flush_bg_queue(fc); in fuse_request_send_background_locked()
588 void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req) in fuse_request_send_background() argument
591 spin_lock(&fc->lock); in fuse_request_send_background()
592 if (fc->connected) { in fuse_request_send_background()
593 fuse_request_send_background_locked(fc, req); in fuse_request_send_background()
594 spin_unlock(&fc->lock); in fuse_request_send_background()
596 spin_unlock(&fc->lock); in fuse_request_send_background()
598 req->end(fc, req); in fuse_request_send_background()
599 fuse_put_request(fc, req); in fuse_request_send_background()
604 static int fuse_request_send_notify_reply(struct fuse_conn *fc, in fuse_request_send_notify_reply() argument
608 struct fuse_iqueue *fiq = &fc->iq; in fuse_request_send_notify_reply()
625 struct fuse_conn *fc = get_fuse_conn(inode); in fuse_force_forget() local
631 req = fuse_get_req_nofail_nopages(fc, file); in fuse_force_forget()
638 __fuse_request_send(fc, req); in fuse_force_forget()
640 fuse_put_request(fc, req); in fuse_force_forget()
1198 static int fuse_read_forget(struct fuse_conn *fc, struct fuse_iqueue *fiq, in fuse_read_forget() argument
1203 if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL) in fuse_read_forget()
1222 struct fuse_conn *fc = fud->fc; in fuse_dev_do_read() local
1223 struct fuse_iqueue *fiq = &fc->iq; in fuse_dev_do_read()
1253 return fuse_read_forget(fc, fiq, cs, nbytes); in fuse_dev_do_read()
1272 request_end(fc, req); in fuse_dev_do_read()
1312 request_end(fc, req); in fuse_dev_do_read()
1398 static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size, in fuse_notify_poll() argument
1412 return fuse_notify_poll_wakeup(fc, &outarg); in fuse_notify_poll()
1419 static int fuse_notify_inval_inode(struct fuse_conn *fc, unsigned int size, in fuse_notify_inval_inode() argument
1433 down_read(&fc->killsb); in fuse_notify_inval_inode()
1435 if (fc->sb) { in fuse_notify_inval_inode()
1436 err = fuse_reverse_inval_inode(fc->sb, outarg.ino, in fuse_notify_inval_inode()
1439 up_read(&fc->killsb); in fuse_notify_inval_inode()
1447 static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, in fuse_notify_inval_entry() argument
1483 down_read(&fc->killsb); in fuse_notify_inval_entry()
1485 if (fc->sb) in fuse_notify_inval_entry()
1486 err = fuse_reverse_inval_entry(fc->sb, outarg.parent, 0, &name); in fuse_notify_inval_entry()
1487 up_read(&fc->killsb); in fuse_notify_inval_entry()
1497 static int fuse_notify_delete(struct fuse_conn *fc, unsigned int size, in fuse_notify_delete() argument
1533 down_read(&fc->killsb); in fuse_notify_delete()
1535 if (fc->sb) in fuse_notify_delete()
1536 err = fuse_reverse_inval_entry(fc->sb, outarg.parent, in fuse_notify_delete()
1538 up_read(&fc->killsb); in fuse_notify_delete()
1548 static int fuse_notify_store(struct fuse_conn *fc, unsigned int size, in fuse_notify_store() argument
1576 down_read(&fc->killsb); in fuse_notify_store()
1579 if (!fc->sb) in fuse_notify_store()
1582 inode = ilookup5(fc->sb, nodeid, fuse_inode_eq, &nodeid); in fuse_notify_store()
1628 up_read(&fc->killsb); in fuse_notify_store()
1634 static void fuse_retrieve_end(struct fuse_conn *fc, struct fuse_req *req) in fuse_retrieve_end() argument
1639 static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, in fuse_retrieve() argument
1664 req = fuse_get_req(fc, num_pages); in fuse_retrieve()
1701 err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique); in fuse_retrieve()
1703 fuse_retrieve_end(fc, req); in fuse_retrieve()
1708 static int fuse_notify_retrieve(struct fuse_conn *fc, unsigned int size, in fuse_notify_retrieve() argument
1725 down_read(&fc->killsb); in fuse_notify_retrieve()
1727 if (fc->sb) { in fuse_notify_retrieve()
1730 inode = ilookup5(fc->sb, nodeid, fuse_inode_eq, &nodeid); in fuse_notify_retrieve()
1732 err = fuse_retrieve(fc, inode, &outarg); in fuse_notify_retrieve()
1736 up_read(&fc->killsb); in fuse_notify_retrieve()
1745 static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, in fuse_notify() argument
1753 return fuse_notify_poll(fc, size, cs); in fuse_notify()
1756 return fuse_notify_inval_inode(fc, size, cs); in fuse_notify()
1759 return fuse_notify_inval_entry(fc, size, cs); in fuse_notify()
1762 return fuse_notify_store(fc, size, cs); in fuse_notify()
1765 return fuse_notify_retrieve(fc, size, cs); in fuse_notify()
1768 return fuse_notify_delete(fc, size, cs); in fuse_notify()
1822 struct fuse_conn *fc = fud->fc; in fuse_dev_do_write() local
1843 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), cs); in fuse_dev_do_write()
1869 fc->no_interrupt = 1; in fuse_dev_do_write()
1871 queue_interrupt(&fc->iq, req); in fuse_dev_do_write()
1905 request_end(fc, req); in fuse_dev_do_write()
2019 fiq = &fud->fc->iq; in fuse_dev_poll()
2037 static void end_requests(struct fuse_conn *fc, struct list_head *head) in end_requests() argument
2045 request_end(fc, req); in end_requests()
2049 static void end_polls(struct fuse_conn *fc) in end_polls() argument
2053 p = rb_first(&fc->polled_files); in end_polls()
2082 void fuse_abort_conn(struct fuse_conn *fc) in fuse_abort_conn() argument
2084 struct fuse_iqueue *fiq = &fc->iq; in fuse_abort_conn()
2086 spin_lock(&fc->lock); in fuse_abort_conn()
2087 if (fc->connected) { in fuse_abort_conn()
2093 fc->connected = 0; in fuse_abort_conn()
2094 fc->blocked = 0; in fuse_abort_conn()
2095 fuse_set_initialized(fc); in fuse_abort_conn()
2096 list_for_each_entry(fud, &fc->devices, entry) { in fuse_abort_conn()
2114 fc->max_background = UINT_MAX; in fuse_abort_conn()
2115 flush_bg_queue(fc); in fuse_abort_conn()
2127 end_polls(fc); in fuse_abort_conn()
2128 wake_up_all(&fc->blocked_waitq); in fuse_abort_conn()
2129 spin_unlock(&fc->lock); in fuse_abort_conn()
2135 request_end(fc, req); in fuse_abort_conn()
2137 end_requests(fc, &to_end2); in fuse_abort_conn()
2139 spin_unlock(&fc->lock); in fuse_abort_conn()
2149 struct fuse_conn *fc = fud->fc; in fuse_dev_release() local
2153 end_requests(fc, &fpq->processing); in fuse_dev_release()
2155 if (atomic_dec_and_test(&fc->dev_count)) { in fuse_dev_release()
2156 WARN_ON(fc->iq.fasync != NULL); in fuse_dev_release()
2157 fuse_abort_conn(fc); in fuse_dev_release()
2173 return fasync_helper(fd, file, on, &fud->fc->iq.fasync); in fuse_dev_fasync()
2176 static int fuse_device_clone(struct fuse_conn *fc, struct file *new) in fuse_device_clone() argument
2183 fud = fuse_dev_alloc(fc); in fuse_device_clone()
2188 atomic_inc(&fc->dev_count); in fuse_device_clone()
2219 err = fuse_device_clone(fud->fc, file); in fuse_dev_ioctl()