Lines Matching refs:ff

59 	struct fuse_file *ff;  in fuse_file_alloc()  local
61 ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL_ACCOUNT); in fuse_file_alloc()
62 if (unlikely(!ff)) in fuse_file_alloc()
65 ff->fm = fm; in fuse_file_alloc()
66 ff->release_args = kzalloc(sizeof(*ff->release_args), in fuse_file_alloc()
68 if (!ff->release_args) { in fuse_file_alloc()
69 kfree(ff); in fuse_file_alloc()
73 INIT_LIST_HEAD(&ff->write_entry); in fuse_file_alloc()
74 mutex_init(&ff->readdir.lock); in fuse_file_alloc()
75 refcount_set(&ff->count, 1); in fuse_file_alloc()
76 RB_CLEAR_NODE(&ff->polled_node); in fuse_file_alloc()
77 init_waitqueue_head(&ff->poll_wait); in fuse_file_alloc()
79 ff->kh = atomic64_inc_return(&fm->fc->khctr); in fuse_file_alloc()
81 return ff; in fuse_file_alloc()
84 void fuse_file_free(struct fuse_file *ff) in fuse_file_free() argument
86 kfree(ff->release_args); in fuse_file_free()
87 mutex_destroy(&ff->readdir.lock); in fuse_file_free()
88 kfree(ff); in fuse_file_free()
91 static struct fuse_file *fuse_file_get(struct fuse_file *ff) in fuse_file_get() argument
93 refcount_inc(&ff->count); in fuse_file_get()
94 return ff; in fuse_file_get()
106 static void fuse_file_put(struct fuse_file *ff, bool sync, bool isdir) in fuse_file_put() argument
108 if (refcount_dec_and_test(&ff->count)) { in fuse_file_put()
109 struct fuse_args *args = &ff->release_args->args; in fuse_file_put()
111 if (isdir ? ff->fm->fc->no_opendir : ff->fm->fc->no_open) { in fuse_file_put()
113 fuse_release_end(ff->fm, args, 0); in fuse_file_put()
115 fuse_simple_request(ff->fm, args); in fuse_file_put()
116 fuse_release_end(ff->fm, args, 0); in fuse_file_put()
119 if (fuse_simple_background(ff->fm, args, in fuse_file_put()
121 fuse_release_end(ff->fm, args, -ENOTCONN); in fuse_file_put()
123 kfree(ff); in fuse_file_put()
131 struct fuse_file *ff; in fuse_file_open() local
134 ff = fuse_file_alloc(fm); in fuse_file_open()
135 if (!ff) in fuse_file_open()
138 ff->fh = 0; in fuse_file_open()
140 ff->open_flags = FOPEN_KEEP_CACHE | (isdir ? FOPEN_CACHE_DIR : 0); in fuse_file_open()
147 ff->fh = outarg.fh; in fuse_file_open()
148 ff->open_flags = outarg.open_flags; in fuse_file_open()
151 fuse_file_free(ff); in fuse_file_open()
162 ff->open_flags &= ~FOPEN_DIRECT_IO; in fuse_file_open()
164 ff->nodeid = nodeid; in fuse_file_open()
166 return ff; in fuse_file_open()
172 struct fuse_file *ff = fuse_file_open(fm, nodeid, file->f_flags, isdir); in fuse_do_open() local
174 if (!IS_ERR(ff)) in fuse_do_open()
175 file->private_data = ff; in fuse_do_open()
177 return PTR_ERR_OR_ZERO(ff); in fuse_do_open()
185 struct fuse_file *ff = file->private_data; in fuse_link_write_file() local
191 if (list_empty(&ff->write_entry)) in fuse_link_write_file()
192 list_add(&ff->write_entry, &fi->write_files); in fuse_link_write_file()
198 struct fuse_file *ff = file->private_data; in fuse_finish_open() local
201 if (ff->open_flags & FOPEN_STREAM) in fuse_finish_open()
203 else if (ff->open_flags & FOPEN_NONSEEKABLE) in fuse_finish_open()
216 } else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) { in fuse_finish_open()
270 static void fuse_prepare_release(struct fuse_inode *fi, struct fuse_file *ff, in fuse_prepare_release() argument
273 struct fuse_conn *fc = ff->fm->fc; in fuse_prepare_release()
274 struct fuse_release_args *ra = ff->release_args; in fuse_prepare_release()
279 list_del(&ff->write_entry); in fuse_prepare_release()
283 if (!RB_EMPTY_NODE(&ff->polled_node)) in fuse_prepare_release()
284 rb_erase(&ff->polled_node, &fc->polled_files); in fuse_prepare_release()
287 wake_up_interruptible_all(&ff->poll_wait); in fuse_prepare_release()
289 ra->inarg.fh = ff->fh; in fuse_prepare_release()
295 ra->args.nodeid = ff->nodeid; in fuse_prepare_release()
300 void fuse_file_release(struct inode *inode, struct fuse_file *ff, in fuse_file_release() argument
304 struct fuse_release_args *ra = ff->release_args; in fuse_file_release()
307 fuse_prepare_release(fi, ff, open_flags, opcode); in fuse_file_release()
309 if (ff->flock) { in fuse_file_release()
311 ra->inarg.lock_owner = fuse_lock_owner_id(ff->fm->fc, id); in fuse_file_release()
325 fuse_file_put(ff, ff->fm->fc->destroy, isdir); in fuse_file_release()
347 void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, in fuse_sync_release() argument
350 WARN_ON(refcount_read(&ff->count) > 1); in fuse_sync_release()
351 fuse_prepare_release(fi, ff, flags, FUSE_RELEASE); in fuse_sync_release()
356 fuse_file_put(ff, true, false); in fuse_sync_release()
471 struct fuse_file *ff = file->private_data; in fuse_flush() local
479 if (ff->open_flags & FOPEN_NOFLUSH && !fm->fc->writeback_cache) in fuse_flush()
499 inarg.fh = ff->fh; in fuse_flush()
529 struct fuse_file *ff = file->private_data; in fuse_fsync_common() local
534 inarg.fh = ff->fh; in fuse_fsync_common()
597 struct fuse_file *ff = file->private_data; in fuse_read_args_fill() local
600 ia->read.in.fh = ff->fh; in fuse_read_args_fill()
605 args->nodeid = ff->nodeid; in fuse_read_args_fill()
770 struct fuse_file *ff = file->private_data; in fuse_send_read() local
771 struct fuse_mount *fm = ff->fm; in fuse_send_read()
911 if (ia->ff) in fuse_readpages_end()
912 fuse_file_put(ia->ff, false, false); in fuse_readpages_end()
919 struct fuse_file *ff = file->private_data; in fuse_send_readpages() local
920 struct fuse_mount *fm = ff->fm; in fuse_send_readpages()
941 ia->ff = fuse_file_get(ff); in fuse_send_readpages()
1010 static void fuse_write_args_fill(struct fuse_io_args *ia, struct fuse_file *ff, in fuse_write_args_fill() argument
1015 ia->write.in.fh = ff->fh; in fuse_write_args_fill()
1019 args->nodeid = ff->nodeid; in fuse_write_args_fill()
1021 if (ff->fm->fc->minor < 9) in fuse_write_args_fill()
1049 struct fuse_file *ff = file->private_data; in fuse_send_write() local
1050 struct fuse_mount *fm = ff->fm; in fuse_send_write()
1054 fuse_write_args_fill(ia, ff, pos, count); in fuse_send_write()
1096 struct fuse_file *ff = file->private_data; in fuse_send_write_pages() local
1097 struct fuse_mount *fm = ff->fm; in fuse_send_write_pages()
1105 fuse_write_args_fill(ia, ff, pos, count); in fuse_send_write_pages()
1433 struct fuse_file *ff = file->private_data; in fuse_direct_io() local
1434 struct fuse_conn *fc = ff->fm->fc; in fuse_direct_io()
1570 struct fuse_file *ff = file->private_data; in fuse_file_read_iter() local
1579 if (!(ff->open_flags & FOPEN_DIRECT_IO)) in fuse_file_read_iter()
1588 struct fuse_file *ff = file->private_data; in fuse_file_write_iter() local
1597 if (!(ff->open_flags & FOPEN_DIRECT_IO)) in fuse_file_write_iter()
1614 if (wpa->ia.ff) in fuse_writepage_free()
1615 fuse_file_put(wpa->ia.ff, false, false); in fuse_writepage_free()
1782 next->ia.ff = fuse_file_get(wpa->ia.ff); in fuse_writepage_end()
1818 struct fuse_file *ff; in __fuse_write_file_get() local
1821 ff = list_first_entry_or_null(&fi->write_files, struct fuse_file, in __fuse_write_file_get()
1823 if (ff) in __fuse_write_file_get()
1824 fuse_file_get(ff); in __fuse_write_file_get()
1827 return ff; in __fuse_write_file_get()
1832 struct fuse_file *ff = __fuse_write_file_get(fi); in fuse_write_file_get() local
1833 WARN_ON(!ff); in fuse_write_file_get()
1834 return ff; in fuse_write_file_get()
1840 struct fuse_file *ff; in fuse_write_inode() local
1854 ff = __fuse_write_file_get(fi); in fuse_write_inode()
1855 err = fuse_flush_times(inode, ff); in fuse_write_inode()
1856 if (ff) in fuse_write_inode()
1857 fuse_file_put(ff, false, false); in fuse_write_inode()
1918 wpa->ia.ff = fuse_write_file_get(fi); in fuse_writepage_locked()
1919 if (!wpa->ia.ff) in fuse_writepage_locked()
1923 fuse_write_args_fill(&wpa->ia, wpa->ia.ff, page_offset(page), 0); in fuse_writepage_locked()
1984 struct fuse_file *ff; member
2024 wpa->ia.ff = fuse_file_get(data->ff); in fuse_writepages_send()
2136 if (!data->ff) { in fuse_writepages_fill()
2138 data->ff = fuse_write_file_get(fi); in fuse_writepages_fill()
2139 if (!data->ff) in fuse_writepages_fill()
2178 fuse_write_args_fill(&wpa->ia, data->ff, page_offset(page), 0); in fuse_writepages_fill()
2231 data.ff = NULL; in fuse_writepages()
2245 if (data.ff) in fuse_writepages()
2246 fuse_file_put(data.ff, false, false); in fuse_writepages()
2400 struct fuse_file *ff = file->private_data; in fuse_file_mmap() local
2406 if (ff->open_flags & FOPEN_DIRECT_IO) { in fuse_file_mmap()
2463 struct fuse_file *ff = file->private_data; in fuse_lk_fill() local
2466 inarg->fh = ff->fh; in fuse_lk_fill()
2563 struct fuse_file *ff = file->private_data; in fuse_file_flock() local
2566 ff->flock = true; in fuse_file_flock()
2607 struct fuse_file *ff = file->private_data; in fuse_lseek() local
2610 .fh = ff->fh, in fuse_lseek()
2621 args.nodeid = ff->nodeid; in fuse_lseek()
2690 struct fuse_file *ff; in fuse_find_polled_node() local
2693 ff = rb_entry(last, struct fuse_file, polled_node); in fuse_find_polled_node()
2695 if (kh < ff->kh) in fuse_find_polled_node()
2697 else if (kh > ff->kh) in fuse_find_polled_node()
2715 struct fuse_file *ff) in fuse_register_polled_file() argument
2718 if (RB_EMPTY_NODE(&ff->polled_node)) { in fuse_register_polled_file()
2721 link = fuse_find_polled_node(fc, ff->kh, &parent); in fuse_register_polled_file()
2723 rb_link_node(&ff->polled_node, parent, link); in fuse_register_polled_file()
2724 rb_insert_color(&ff->polled_node, &fc->polled_files); in fuse_register_polled_file()
2731 struct fuse_file *ff = file->private_data; in fuse_file_poll() local
2732 struct fuse_mount *fm = ff->fm; in fuse_file_poll()
2733 struct fuse_poll_in inarg = { .fh = ff->fh, .kh = ff->kh }; in fuse_file_poll()
2741 poll_wait(file, &ff->poll_wait, wait); in fuse_file_poll()
2748 if (waitqueue_active(&ff->poll_wait)) { in fuse_file_poll()
2750 fuse_register_polled_file(fm->fc, ff); in fuse_file_poll()
2754 args.nodeid = ff->nodeid; in fuse_file_poll()
2787 struct fuse_file *ff; in fuse_notify_poll_wakeup() local
2789 ff = rb_entry(*link, struct fuse_file, polled_node); in fuse_notify_poll_wakeup()
2790 wake_up_interruptible_sync(&ff->poll_wait); in fuse_notify_poll_wakeup()
2822 struct fuse_file *ff = file->private_data; in fuse_direct_IO() local
2852 io->async = ff->fm->fc->async_dio; in fuse_direct_IO()
2858 iov_iter_truncate(iter, fuse_round_up(ff->fm->fc, i_size - offset)); in fuse_direct_IO()
2924 struct fuse_file *ff = file->private_data; in fuse_file_fallocate() local
2927 struct fuse_mount *fm = ff->fm; in fuse_file_fallocate()
2930 .fh = ff->fh, in fuse_file_fallocate()
2978 args.nodeid = ff->nodeid; in fuse_file_fallocate()