Lines Matching full:ff

56 	struct fuse_file *ff;  in fuse_file_alloc()  local
58 ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL_ACCOUNT); in fuse_file_alloc()
59 if (unlikely(!ff)) in fuse_file_alloc()
62 ff->fm = fm; in fuse_file_alloc()
64 ff->args = kzalloc(sizeof(*ff->args), GFP_KERNEL_ACCOUNT); in fuse_file_alloc()
65 if (!ff->args) { in fuse_file_alloc()
66 kfree(ff); in fuse_file_alloc()
71 INIT_LIST_HEAD(&ff->write_entry); in fuse_file_alloc()
72 refcount_set(&ff->count, 1); in fuse_file_alloc()
73 RB_CLEAR_NODE(&ff->polled_node); in fuse_file_alloc()
74 init_waitqueue_head(&ff->poll_wait); in fuse_file_alloc()
76 ff->kh = atomic64_inc_return(&fm->fc->khctr); in fuse_file_alloc()
78 return ff; in fuse_file_alloc()
81 void fuse_file_free(struct fuse_file *ff) in fuse_file_free() argument
83 kfree(ff->args); in fuse_file_free()
84 kfree(ff); in fuse_file_free()
87 static struct fuse_file *fuse_file_get(struct fuse_file *ff) in fuse_file_get() argument
89 refcount_inc(&ff->count); in fuse_file_get()
90 return ff; in fuse_file_get()
102 static void fuse_file_put(struct fuse_file *ff, bool sync) in fuse_file_put() argument
104 if (refcount_dec_and_test(&ff->count)) { in fuse_file_put()
105 struct fuse_release_args *ra = &ff->args->release_args; in fuse_file_put()
109 fuse_file_io_release(ff, ra->inode); in fuse_file_put()
114 fuse_simple_request(ff->fm, args); in fuse_file_put()
115 fuse_release_end(ff->fm, args, 0); in fuse_file_put()
118 if (fuse_simple_background(ff->fm, args, in fuse_file_put()
120 fuse_release_end(ff->fm, args, -ENOTCONN); in fuse_file_put()
122 kfree(ff); in fuse_file_put()
130 struct fuse_file *ff; in fuse_file_open() local
134 ff = fuse_file_alloc(fm, open); 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()
143 struct fuse_open_out *outargp = &ff->args->open_outarg; in fuse_file_open()
148 ff->fh = outargp->fh; in fuse_file_open()
149 ff->open_flags = outargp->open_flags; in fuse_file_open()
151 fuse_file_free(ff); in fuse_file_open()
155 kfree(ff->args); in fuse_file_open()
156 ff->args = NULL; in fuse_file_open()
165 ff->open_flags &= ~FOPEN_DIRECT_IO; in fuse_file_open()
167 ff->nodeid = nodeid; in fuse_file_open()
169 return ff; in fuse_file_open()
175 struct fuse_file *ff = fuse_file_open(fm, nodeid, file->f_flags, isdir); in fuse_do_open() local
177 if (!IS_ERR(ff)) in fuse_do_open()
178 file->private_data = ff; in fuse_do_open()
180 return PTR_ERR_OR_ZERO(ff); in fuse_do_open()
188 struct fuse_file *ff = file->private_data; in fuse_link_write_file() local
194 if (list_empty(&ff->write_entry)) in fuse_link_write_file()
195 list_add(&ff->write_entry, &fi->write_files); in fuse_link_write_file()
201 struct fuse_file *ff = file->private_data; in fuse_finish_open() local
209 if (ff->open_flags & FOPEN_STREAM) in fuse_finish_open()
211 else if (ff->open_flags & FOPEN_NONSEEKABLE) in fuse_finish_open()
238 struct fuse_file *ff; in fuse_open() local
266 ff = file->private_data; in fuse_open()
269 fuse_sync_release(fi, ff, file->f_flags); in fuse_open()
279 else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) in fuse_open()
291 static void fuse_prepare_release(struct fuse_inode *fi, struct fuse_file *ff, in fuse_prepare_release() argument
294 struct fuse_conn *fc = ff->fm->fc; in fuse_prepare_release()
295 struct fuse_release_args *ra = &ff->args->release_args; in fuse_prepare_release()
297 if (fuse_file_passthrough(ff)) in fuse_prepare_release()
298 fuse_passthrough_release(ff, fuse_inode_backing(fi)); in fuse_prepare_release()
303 list_del(&ff->write_entry); in fuse_prepare_release()
307 if (!RB_EMPTY_NODE(&ff->polled_node)) in fuse_prepare_release()
308 rb_erase(&ff->polled_node, &fc->polled_files); in fuse_prepare_release()
311 wake_up_interruptible_all(&ff->poll_wait); in fuse_prepare_release()
316 /* ff->args was used for open outarg */ in fuse_prepare_release()
317 memset(ff->args, 0, sizeof(*ff->args)); in fuse_prepare_release()
318 ra->inarg.fh = ff->fh; in fuse_prepare_release()
324 ra->args.nodeid = ff->nodeid; in fuse_prepare_release()
336 void fuse_file_release(struct inode *inode, struct fuse_file *ff, in fuse_file_release() argument
340 struct fuse_release_args *ra = &ff->args->release_args; in fuse_file_release()
343 fuse_prepare_release(fi, ff, open_flags, opcode, false); in fuse_file_release()
345 if (ra && ff->flock) { in fuse_file_release()
347 ra->inarg.lock_owner = fuse_lock_owner_id(ff->fm->fc, id); in fuse_file_release()
359 fuse_file_put(ff, ff->fm->fc->destroy); in fuse_file_release()
385 void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff, in fuse_sync_release() argument
388 WARN_ON(refcount_read(&ff->count) > 1); in fuse_sync_release()
389 fuse_prepare_release(fi, ff, flags, FUSE_RELEASE, true); in fuse_sync_release()
390 fuse_file_put(ff, true); in fuse_sync_release()
505 struct fuse_file *ff = file->private_data; in fuse_flush() local
513 if (ff->open_flags & FOPEN_NOFLUSH && !fm->fc->writeback_cache) in fuse_flush()
533 inarg.fh = ff->fh; in fuse_flush()
563 struct fuse_file *ff = file->private_data; in fuse_fsync_common() local
568 inarg.fh = ff->fh; in fuse_fsync_common()
631 struct fuse_file *ff = file->private_data; in fuse_read_args_fill() local
634 ia->read.in.fh = ff->fh; in fuse_read_args_fill()
639 args->nodeid = ff->nodeid; in fuse_read_args_fill()
805 struct fuse_file *ff = file->private_data; in fuse_send_read() local
806 struct fuse_mount *fm = ff->fm; in fuse_send_read()
943 if (ia->ff) in fuse_readpages_end()
944 fuse_file_put(ia->ff, false); in fuse_readpages_end()
951 struct fuse_file *ff = file->private_data; in fuse_send_readpages() local
952 struct fuse_mount *fm = ff->fm; in fuse_send_readpages()
973 ia->ff = fuse_file_get(ff); in fuse_send_readpages()
1050 static void fuse_write_args_fill(struct fuse_io_args *ia, struct fuse_file *ff, in fuse_write_args_fill() argument
1055 ia->write.in.fh = ff->fh; in fuse_write_args_fill()
1059 args->nodeid = ff->nodeid; in fuse_write_args_fill()
1061 if (ff->fm->fc->minor < 9) in fuse_write_args_fill()
1089 struct fuse_file *ff = file->private_data; in fuse_send_write() local
1090 struct fuse_mount *fm = ff->fm; in fuse_send_write()
1094 fuse_write_args_fill(ia, ff, pos, count); in fuse_send_write()
1136 struct fuse_file *ff = file->private_data; in fuse_send_write_pages() local
1137 struct fuse_mount *fm = ff->fm; in fuse_send_write_pages()
1145 fuse_write_args_fill(ia, ff, pos, count); in fuse_send_write_pages()
1331 struct fuse_file *ff = file->private_data; in fuse_dio_wr_exclusive_lock() local
1336 if (!(ff->open_flags & FOPEN_PARALLEL_DIRECT_WRITES)) in fuse_dio_wr_exclusive_lock()
1537 struct fuse_file *ff = file->private_data; in fuse_direct_io() local
1538 struct fuse_conn *fc = ff->fm->fc; in fuse_direct_io()
1548 bool fopen_direct_io = ff->open_flags & FOPEN_DIRECT_IO; in fuse_direct_io()
1691 struct fuse_file *ff = file->private_data; in fuse_file_read_iter() local
1701 if (ff->open_flags & FOPEN_DIRECT_IO) in fuse_file_read_iter()
1703 else if (fuse_file_passthrough(ff)) in fuse_file_read_iter()
1712 struct fuse_file *ff = file->private_data; in fuse_file_write_iter() local
1722 if (ff->open_flags & FOPEN_DIRECT_IO) in fuse_file_write_iter()
1724 else if (fuse_file_passthrough(ff)) in fuse_file_write_iter()
1734 struct fuse_file *ff = in->private_data; in fuse_splice_read() local
1737 if (fuse_file_passthrough(ff) && !(ff->open_flags & FOPEN_DIRECT_IO)) in fuse_splice_read()
1746 struct fuse_file *ff = out->private_data; in fuse_splice_write() local
1749 if (fuse_file_passthrough(ff) && !(ff->open_flags & FOPEN_DIRECT_IO)) in fuse_splice_write()
1766 fuse_file_put(wpa->ia.ff, false); in fuse_writepage_free()
1974 struct fuse_file *ff; in __fuse_write_file_get() local
1977 ff = list_first_entry_or_null(&fi->write_files, struct fuse_file, in __fuse_write_file_get()
1979 if (ff) in __fuse_write_file_get()
1980 fuse_file_get(ff); in __fuse_write_file_get()
1983 return ff; in __fuse_write_file_get()
1988 struct fuse_file *ff = __fuse_write_file_get(fi); in fuse_write_file_get() local
1989 WARN_ON(!ff); in fuse_write_file_get()
1990 return ff; in fuse_write_file_get()
1996 struct fuse_file *ff; in fuse_write_inode() local
2010 ff = __fuse_write_file_get(fi); in fuse_write_inode()
2011 err = fuse_flush_times(inode, ff); in fuse_write_inode()
2012 if (ff) in fuse_write_inode()
2013 fuse_file_put(ff, false); in fuse_write_inode()
2068 struct fuse_file *ff) in fuse_writepage_args_setup() argument
2080 fuse_write_args_fill(&wpa->ia, ff, folio_pos(folio), 0); in fuse_writepage_args_setup()
2083 wpa->ia.ff = ff; in fuse_writepage_args_setup()
2100 struct fuse_file *ff; in fuse_writepage_locked() local
2108 ff = fuse_write_file_get(fi); in fuse_writepage_locked()
2109 if (!ff) in fuse_writepage_locked()
2112 wpa = fuse_writepage_args_setup(folio, ff); in fuse_writepage_locked()
2134 fuse_file_put(ff, false); in fuse_writepage_locked()
2144 struct fuse_file *ff; member
2291 if (!data->ff) { in fuse_writepages_fill()
2293 data->ff = fuse_write_file_get(fi); in fuse_writepages_fill()
2294 if (!data->ff) in fuse_writepages_fill()
2323 wpa = fuse_writepage_args_setup(folio, data->ff); in fuse_writepages_fill()
2328 fuse_file_get(wpa->ia.ff); in fuse_writepages_fill()
2375 data.ff = NULL; in fuse_writepages()
2389 if (data.ff) in fuse_writepages()
2390 fuse_file_put(data.ff, false); in fuse_writepages()
2544 struct fuse_file *ff = file->private_data; in fuse_file_mmap() local
2545 struct fuse_conn *fc = ff->fm->fc; in fuse_file_mmap()
2558 if (fuse_file_passthrough(ff)) in fuse_file_mmap()
2567 if (ff->open_flags & FOPEN_DIRECT_IO) { in fuse_file_mmap()
2589 rc = fuse_file_cached_io_open(inode, ff); in fuse_file_mmap()
2641 struct fuse_file *ff = file->private_data; in fuse_lk_fill() local
2644 inarg->fh = ff->fh; in fuse_lk_fill()
2737 struct fuse_file *ff = file->private_data; in fuse_file_flock() local
2740 ff->flock = true; in fuse_file_flock()
2781 struct fuse_file *ff = file->private_data; in fuse_lseek() local
2784 .fh = ff->fh, in fuse_lseek()
2795 args.nodeid = ff->nodeid; in fuse_lseek()
2864 struct fuse_file *ff; in fuse_find_polled_node() local
2867 ff = rb_entry(last, struct fuse_file, polled_node); in fuse_find_polled_node()
2869 if (kh < ff->kh) in fuse_find_polled_node()
2871 else if (kh > ff->kh) in fuse_find_polled_node()
2889 struct fuse_file *ff) in fuse_register_polled_file() argument
2892 if (RB_EMPTY_NODE(&ff->polled_node)) { in fuse_register_polled_file()
2895 link = fuse_find_polled_node(fc, ff->kh, &parent); in fuse_register_polled_file()
2897 rb_link_node(&ff->polled_node, parent, link); in fuse_register_polled_file()
2898 rb_insert_color(&ff->polled_node, &fc->polled_files); in fuse_register_polled_file()
2905 struct fuse_file *ff = file->private_data; in fuse_file_poll() local
2906 struct fuse_mount *fm = ff->fm; in fuse_file_poll()
2907 struct fuse_poll_in inarg = { .fh = ff->fh, .kh = ff->kh }; in fuse_file_poll()
2915 poll_wait(file, &ff->poll_wait, wait); in fuse_file_poll()
2922 if (waitqueue_active(&ff->poll_wait)) { in fuse_file_poll()
2924 fuse_register_polled_file(fm->fc, ff); in fuse_file_poll()
2928 args.nodeid = ff->nodeid; in fuse_file_poll()
2961 struct fuse_file *ff; in fuse_notify_poll_wakeup() local
2963 ff = rb_entry(*link, struct fuse_file, polled_node); in fuse_notify_poll_wakeup()
2964 wake_up_interruptible_sync(&ff->poll_wait); in fuse_notify_poll_wakeup()
2996 struct fuse_file *ff = file->private_data; in fuse_direct_IO() local
3026 io->async = ff->fm->fc->async_dio; in fuse_direct_IO()
3032 iov_iter_truncate(iter, fuse_round_up(ff->fm->fc, i_size - offset)); in fuse_direct_IO()
3099 struct fuse_file *ff = file->private_data; in fuse_file_fallocate() local
3102 struct fuse_mount *fm = ff->fm; in fuse_file_fallocate()
3105 .fh = ff->fh, in fuse_file_fallocate()
3153 args.nodeid = ff->nodeid; in fuse_file_fallocate()