Lines Matching full:ff

65 	struct fuse_file *ff;  in fuse_file_alloc()  local
67 ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL_ACCOUNT); in fuse_file_alloc()
68 if (unlikely(!ff)) in fuse_file_alloc()
71 ff->fm = fm; in fuse_file_alloc()
72 ff->release_args = kzalloc(sizeof(*ff->release_args), in fuse_file_alloc()
74 if (!ff->release_args) { in fuse_file_alloc()
75 kfree(ff); in fuse_file_alloc()
79 INIT_LIST_HEAD(&ff->write_entry); in fuse_file_alloc()
80 mutex_init(&ff->readdir.lock); in fuse_file_alloc()
81 refcount_set(&ff->count, 1); in fuse_file_alloc()
82 RB_CLEAR_NODE(&ff->polled_node); in fuse_file_alloc()
83 init_waitqueue_head(&ff->poll_wait); in fuse_file_alloc()
85 ff->kh = atomic64_inc_return(&fm->fc->khctr); in fuse_file_alloc()
87 return ff; in fuse_file_alloc()
90 void fuse_file_free(struct fuse_file *ff) in fuse_file_free() argument
92 kfree(ff->release_args); in fuse_file_free()
93 mutex_destroy(&ff->readdir.lock); in fuse_file_free()
94 kfree(ff); in fuse_file_free()
97 static struct fuse_file *fuse_file_get(struct fuse_file *ff) in fuse_file_get() argument
99 refcount_inc(&ff->count); in fuse_file_get()
100 return ff; in fuse_file_get()
112 static void fuse_file_put(struct fuse_file *ff, bool sync, bool isdir) in fuse_file_put() argument
114 if (refcount_dec_and_test(&ff->count)) { in fuse_file_put()
115 struct fuse_args *args = &ff->release_args->args; in fuse_file_put()
117 if (isdir ? ff->fm->fc->no_opendir : ff->fm->fc->no_open) { in fuse_file_put()
119 fuse_release_end(ff->fm, args, 0); in fuse_file_put()
121 fuse_simple_request(ff->fm, args); in fuse_file_put()
122 fuse_release_end(ff->fm, args, 0); in fuse_file_put()
125 if (fuse_simple_background(ff->fm, args, in fuse_file_put()
127 fuse_release_end(ff->fm, args, -ENOTCONN); in fuse_file_put()
129 kfree(ff); in fuse_file_put()
137 struct fuse_file *ff; in fuse_do_open() local
140 ff = fuse_file_alloc(fm); in fuse_do_open()
141 if (!ff) in fuse_do_open()
144 ff->fh = 0; in fuse_do_open()
146 ff->open_flags = FOPEN_KEEP_CACHE | (isdir ? FOPEN_CACHE_DIR : 0); in fuse_do_open()
153 ff->fh = outarg.fh; in fuse_do_open()
154 ff->open_flags = outarg.open_flags; in fuse_do_open()
157 fuse_file_free(ff); in fuse_do_open()
168 ff->open_flags &= ~FOPEN_DIRECT_IO; in fuse_do_open()
170 ff->nodeid = nodeid; in fuse_do_open()
171 file->private_data = ff; in fuse_do_open()
181 struct fuse_file *ff = file->private_data; in fuse_link_write_file() local
187 if (list_empty(&ff->write_entry)) in fuse_link_write_file()
188 list_add(&ff->write_entry, &fi->write_files); in fuse_link_write_file()
194 struct fuse_file *ff = file->private_data; in fuse_finish_open() local
197 if (!(ff->open_flags & FOPEN_KEEP_CACHE)) in fuse_finish_open()
199 if (ff->open_flags & FOPEN_STREAM) in fuse_finish_open()
201 else if (ff->open_flags & FOPEN_NONSEEKABLE) in fuse_finish_open()
261 static void fuse_prepare_release(struct fuse_inode *fi, struct fuse_file *ff, in fuse_prepare_release() argument
264 struct fuse_conn *fc = ff->fm->fc; in fuse_prepare_release()
265 struct fuse_release_args *ra = ff->release_args; in fuse_prepare_release()
270 list_del(&ff->write_entry); in fuse_prepare_release()
274 if (!RB_EMPTY_NODE(&ff->polled_node)) in fuse_prepare_release()
275 rb_erase(&ff->polled_node, &fc->polled_files); in fuse_prepare_release()
278 wake_up_interruptible_all(&ff->poll_wait); in fuse_prepare_release()
280 ra->inarg.fh = ff->fh; in fuse_prepare_release()
286 ra->args.nodeid = ff->nodeid; in fuse_prepare_release()
294 struct fuse_file *ff = file->private_data; in fuse_release_common() local
295 struct fuse_release_args *ra = ff->release_args; in fuse_release_common()
298 fuse_prepare_release(fi, ff, file->f_flags, opcode); in fuse_release_common()
300 if (ff->flock) { in fuse_release_common()
302 ra->inarg.lock_owner = fuse_lock_owner_id(ff->fm->fc, in fuse_release_common()
317 fuse_file_put(ff, ff->fm->fc->destroy, isdir); in fuse_release_common()
339 void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, int flags) in fuse_sync_release() argument
341 WARN_ON(refcount_read(&ff->count) > 1); in fuse_sync_release()
342 fuse_prepare_release(fi, ff, flags, FUSE_RELEASE); in fuse_sync_release()
347 fuse_file_put(ff, true, false); in fuse_sync_release()
461 struct fuse_file *ff = file->private_data; in fuse_flush() local
486 inarg.fh = ff->fh; in fuse_flush()
516 struct fuse_file *ff = file->private_data; in fuse_fsync_common() local
521 inarg.fh = ff->fh; in fuse_fsync_common()
584 struct fuse_file *ff = file->private_data; in fuse_read_args_fill() local
587 ia->read.in.fh = ff->fh; in fuse_read_args_fill()
592 args->nodeid = ff->nodeid; in fuse_read_args_fill()
757 struct fuse_file *ff = file->private_data; in fuse_send_read() local
758 struct fuse_mount *fm = ff->fm; in fuse_send_read()
907 if (ia->ff) in fuse_readpages_end()
908 fuse_file_put(ia->ff, false, false); in fuse_readpages_end()
915 struct fuse_file *ff = file->private_data; in fuse_send_readpages() local
916 struct fuse_mount *fm = ff->fm; in fuse_send_readpages()
937 ia->ff = fuse_file_get(ff); in fuse_send_readpages()
1006 static void fuse_write_args_fill(struct fuse_io_args *ia, struct fuse_file *ff, in fuse_write_args_fill() argument
1011 ia->write.in.fh = ff->fh; in fuse_write_args_fill()
1015 args->nodeid = ff->nodeid; in fuse_write_args_fill()
1017 if (ff->fm->fc->minor < 9) in fuse_write_args_fill()
1045 struct fuse_file *ff = file->private_data; in fuse_send_write() local
1046 struct fuse_mount *fm = ff->fm; in fuse_send_write()
1050 fuse_write_args_fill(ia, ff, pos, count); in fuse_send_write()
1090 struct fuse_file *ff = file->private_data; in fuse_send_write_pages() local
1091 struct fuse_mount *fm = ff->fm; in fuse_send_write_pages()
1098 fuse_write_args_fill(ia, ff, pos, count); in fuse_send_write_pages()
1415 struct fuse_file *ff = file->private_data; in fuse_direct_io() local
1416 struct fuse_conn *fc = ff->fm->fc; in fuse_direct_io()
1555 struct fuse_file *ff = file->private_data; in fuse_file_read_iter() local
1564 if (!(ff->open_flags & FOPEN_DIRECT_IO)) in fuse_file_read_iter()
1573 struct fuse_file *ff = file->private_data; in fuse_file_write_iter() local
1582 if (!(ff->open_flags & FOPEN_DIRECT_IO)) in fuse_file_write_iter()
1596 if (wpa->ia.ff) in fuse_writepage_free()
1597 fuse_file_put(wpa->ia.ff, false, false); in fuse_writepage_free()
1755 next->ia.ff = fuse_file_get(wpa->ia.ff); in fuse_writepage_end()
1792 struct fuse_file *ff = NULL; in __fuse_write_file_get() local
1796 ff = list_entry(fi->write_files.next, struct fuse_file, in __fuse_write_file_get()
1798 fuse_file_get(ff); in __fuse_write_file_get()
1802 return ff; in __fuse_write_file_get()
1808 struct fuse_file *ff = __fuse_write_file_get(fc, fi); in fuse_write_file_get() local
1809 WARN_ON(!ff); in fuse_write_file_get()
1810 return ff; in fuse_write_file_get()
1817 struct fuse_file *ff; in fuse_write_inode() local
1820 ff = __fuse_write_file_get(fc, fi); in fuse_write_inode()
1821 err = fuse_flush_times(inode, ff); in fuse_write_inode()
1822 if (ff) in fuse_write_inode()
1823 fuse_file_put(ff, false, false); in fuse_write_inode()
1870 wpa->ia.ff = fuse_write_file_get(fc, fi); in fuse_writepage_locked()
1871 if (!wpa->ia.ff) in fuse_writepage_locked()
1874 fuse_write_args_fill(&wpa->ia, wpa->ia.ff, page_offset(page), 0); in fuse_writepage_locked()
1935 struct fuse_file *ff; member
1975 wpa->ia.ff = fuse_file_get(data->ff); in fuse_writepages_send()
2087 if (!data->ff) { in fuse_writepages_fill()
2089 data->ff = fuse_write_file_get(fc, fi); in fuse_writepages_fill()
2090 if (!data->ff) in fuse_writepages_fill()
2127 fuse_write_args_fill(&wpa->ia, data->ff, page_offset(page), 0); in fuse_writepages_fill()
2180 data.ff = NULL; in fuse_writepages()
2194 if (data.ff) in fuse_writepages()
2195 fuse_file_put(data.ff, false, false); in fuse_writepages()
2340 struct fuse_file *ff = file->private_data; in fuse_file_mmap() local
2346 if (ff->open_flags & FOPEN_DIRECT_IO) { in fuse_file_mmap()
2403 struct fuse_file *ff = file->private_data; in fuse_lk_fill() local
2406 inarg->fh = ff->fh; in fuse_lk_fill()
2503 struct fuse_file *ff = file->private_data; in fuse_file_flock() local
2506 ff->flock = true; in fuse_file_flock()
2547 struct fuse_file *ff = file->private_data; in fuse_lseek() local
2550 .fh = ff->fh, in fuse_lseek()
2561 args.nodeid = ff->nodeid; in fuse_lseek()
2756 struct fuse_file *ff = file->private_data; in fuse_do_ioctl() local
2757 struct fuse_mount *fm = ff->fm; in fuse_do_ioctl()
2759 .fh = ff->fh, in fuse_do_ioctl()
2852 ap.args.nodeid = ff->nodeid; in fuse_do_ioctl()
2987 struct fuse_file *ff; in fuse_find_polled_node() local
2990 ff = rb_entry(last, struct fuse_file, polled_node); in fuse_find_polled_node()
2992 if (kh < ff->kh) in fuse_find_polled_node()
2994 else if (kh > ff->kh) in fuse_find_polled_node()
3012 struct fuse_file *ff) in fuse_register_polled_file() argument
3015 if (RB_EMPTY_NODE(&ff->polled_node)) { in fuse_register_polled_file()
3018 link = fuse_find_polled_node(fc, ff->kh, &parent); in fuse_register_polled_file()
3020 rb_link_node(&ff->polled_node, parent, link); in fuse_register_polled_file()
3021 rb_insert_color(&ff->polled_node, &fc->polled_files); in fuse_register_polled_file()
3028 struct fuse_file *ff = file->private_data; in fuse_file_poll() local
3029 struct fuse_mount *fm = ff->fm; in fuse_file_poll()
3030 struct fuse_poll_in inarg = { .fh = ff->fh, .kh = ff->kh }; in fuse_file_poll()
3038 poll_wait(file, &ff->poll_wait, wait); in fuse_file_poll()
3045 if (waitqueue_active(&ff->poll_wait)) { in fuse_file_poll()
3047 fuse_register_polled_file(fm->fc, ff); in fuse_file_poll()
3051 args.nodeid = ff->nodeid; in fuse_file_poll()
3084 struct fuse_file *ff; in fuse_notify_poll_wakeup() local
3086 ff = rb_entry(*link, struct fuse_file, polled_node); in fuse_notify_poll_wakeup()
3087 wake_up_interruptible_sync(&ff->poll_wait); in fuse_notify_poll_wakeup()
3119 struct fuse_file *ff = file->private_data; in fuse_direct_IO() local
3149 io->async = ff->fm->fc->async_dio; in fuse_direct_IO()
3155 iov_iter_truncate(iter, fuse_round_up(ff->fm->fc, i_size - offset)); in fuse_direct_IO()
3222 struct fuse_file *ff = file->private_data; in fuse_file_fallocate() local
3225 struct fuse_mount *fm = ff->fm; in fuse_file_fallocate()
3228 .fh = ff->fh, in fuse_file_fallocate()
3274 args.nodeid = ff->nodeid; in fuse_file_fallocate()