Lines Matching refs:ff

56 	struct fuse_file *ff;
58 ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL_ACCOUNT);
59 if (unlikely(!ff))
62 ff->fm = fm;
64 ff->args = kzalloc(sizeof(*ff->args), GFP_KERNEL_ACCOUNT);
65 if (!ff->args) {
66 kfree(ff);
71 INIT_LIST_HEAD(&ff->write_entry);
72 refcount_set(&ff->count, 1);
73 RB_CLEAR_NODE(&ff->polled_node);
74 init_waitqueue_head(&ff->poll_wait);
76 ff->kh = atomic64_inc_return(&fm->fc->khctr);
78 return ff;
81 void fuse_file_free(struct fuse_file *ff)
83 kfree(ff->args);
84 kfree(ff);
87 static struct fuse_file *fuse_file_get(struct fuse_file *ff)
89 refcount_inc(&ff->count);
90 return ff;
102 static void fuse_file_put(struct fuse_file *ff, bool sync)
104 if (refcount_dec_and_test(&ff->count)) {
105 struct fuse_release_args *ra = &ff->args->release_args;
109 fuse_file_io_release(ff, ra->inode);
114 fuse_simple_request(ff->fm, args);
115 fuse_release_end(ff->fm, args, 0);
118 if (fuse_simple_background(ff->fm, args,
120 fuse_release_end(ff->fm, args, -ENOTCONN);
122 kfree(ff);
130 struct fuse_file *ff;
134 ff = fuse_file_alloc(fm, open);
135 if (!ff)
138 ff->fh = 0;
140 ff->open_flags = FOPEN_KEEP_CACHE | (isdir ? FOPEN_CACHE_DIR : 0);
143 struct fuse_open_out *outargp = &ff->args->open_outarg;
148 ff->fh = outargp->fh;
149 ff->open_flags = outargp->open_flags;
151 fuse_file_free(ff);
155 kfree(ff->args);
156 ff->args = NULL;
165 ff->open_flags &= ~FOPEN_DIRECT_IO;
167 ff->nodeid = nodeid;
169 return ff;
175 struct fuse_file *ff = fuse_file_open(fm, nodeid, file->f_flags, isdir);
177 if (!IS_ERR(ff))
178 file->private_data = ff;
180 return PTR_ERR_OR_ZERO(ff);
188 struct fuse_file *ff = file->private_data;
194 if (list_empty(&ff->write_entry))
195 list_add(&ff->write_entry, &fi->write_files);
201 struct fuse_file *ff = file->private_data;
209 if (ff->open_flags & FOPEN_STREAM)
211 else if (ff->open_flags & FOPEN_NONSEEKABLE)
238 struct fuse_file *ff;
266 ff = file->private_data;
269 fuse_sync_release(fi, ff, file->f_flags);
279 else if (!(ff->open_flags & FOPEN_KEEP_CACHE))
291 static void fuse_prepare_release(struct fuse_inode *fi, struct fuse_file *ff,
294 struct fuse_conn *fc = ff->fm->fc;
295 struct fuse_release_args *ra = &ff->args->release_args;
297 if (fuse_file_passthrough(ff))
298 fuse_passthrough_release(ff, fuse_inode_backing(fi));
303 list_del(&ff->write_entry);
307 if (!RB_EMPTY_NODE(&ff->polled_node))
308 rb_erase(&ff->polled_node, &fc->polled_files);
311 wake_up_interruptible_all(&ff->poll_wait);
316 /* ff->args was used for open outarg */
317 memset(ff->args, 0, sizeof(*ff->args));
318 ra->inarg.fh = ff->fh;
324 ra->args.nodeid = ff->nodeid;
336 void fuse_file_release(struct inode *inode, struct fuse_file *ff,
340 struct fuse_release_args *ra = &ff->args->release_args;
343 fuse_prepare_release(fi, ff, open_flags, opcode, false);
345 if (ra && ff->flock) {
347 ra->inarg.lock_owner = fuse_lock_owner_id(ff->fm->fc, id);
359 fuse_file_put(ff, ff->fm->fc->destroy);
385 void fuse_sync_release(struct fuse_inode *fi, struct fuse_file *ff,
388 WARN_ON(refcount_read(&ff->count) > 1);
389 fuse_prepare_release(fi, ff, flags, FUSE_RELEASE, true);
390 fuse_file_put(ff, true);
505 struct fuse_file *ff = file->private_data;
513 if (ff->open_flags & FOPEN_NOFLUSH && !fm->fc->writeback_cache)
533 inarg.fh = ff->fh;
563 struct fuse_file *ff = file->private_data;
568 inarg.fh = ff->fh;
631 struct fuse_file *ff = file->private_data;
634 ia->read.in.fh = ff->fh;
639 args->nodeid = ff->nodeid;
805 struct fuse_file *ff = file->private_data;
806 struct fuse_mount *fm = ff->fm;
947 if (ia->ff)
948 fuse_file_put(ia->ff, false);
955 struct fuse_file *ff = file->private_data;
956 struct fuse_mount *fm = ff->fm;
977 ia->ff = fuse_file_get(ff);
1054 static void fuse_write_args_fill(struct fuse_io_args *ia, struct fuse_file *ff,
1059 ia->write.in.fh = ff->fh;
1063 args->nodeid = ff->nodeid;
1065 if (ff->fm->fc->minor < 9)
1093 struct fuse_file *ff = file->private_data;
1094 struct fuse_mount *fm = ff->fm;
1098 fuse_write_args_fill(ia, ff, pos, count);
1140 struct fuse_file *ff = file->private_data;
1141 struct fuse_mount *fm = ff->fm;
1149 fuse_write_args_fill(ia, ff, pos, count);
1335 struct fuse_file *ff = file->private_data;
1340 if (!(ff->open_flags & FOPEN_PARALLEL_DIRECT_WRITES))
1540 struct fuse_file *ff = file->private_data;
1541 struct fuse_conn *fc = ff->fm->fc;
1551 bool fopen_direct_io = ff->open_flags & FOPEN_DIRECT_IO;
1694 struct fuse_file *ff = file->private_data;
1704 if (ff->open_flags & FOPEN_DIRECT_IO)
1706 else if (fuse_file_passthrough(ff))
1715 struct fuse_file *ff = file->private_data;
1725 if (ff->open_flags & FOPEN_DIRECT_IO)
1727 else if (fuse_file_passthrough(ff))
1737 struct fuse_file *ff = in->private_data;
1740 if (fuse_file_passthrough(ff) && !(ff->open_flags & FOPEN_DIRECT_IO))
1749 struct fuse_file *ff = out->private_data;
1752 if (fuse_file_passthrough(ff) && !(ff->open_flags & FOPEN_DIRECT_IO))
1769 if (wpa->ia.ff)
1770 fuse_file_put(wpa->ia.ff, false);
1937 next->ia.ff = fuse_file_get(wpa->ia.ff);
1973 struct fuse_file *ff;
1976 ff = list_first_entry_or_null(&fi->write_files, struct fuse_file,
1978 if (ff)
1979 fuse_file_get(ff);
1982 return ff;
1987 struct fuse_file *ff = __fuse_write_file_get(fi);
1988 WARN_ON(!ff);
1989 return ff;
1995 struct fuse_file *ff;
2009 ff = __fuse_write_file_get(fi);
2010 err = fuse_flush_times(inode, ff);
2011 if (ff)
2012 fuse_file_put(ff, false);
2073 wpa->ia.ff = fuse_write_file_get(fi);
2074 if (!wpa->ia.ff)
2078 fuse_write_args_fill(&wpa->ia, wpa->ia.ff, folio_pos(folio), 0);
2116 struct fuse_file *ff;
2156 wpa->ia.ff = fuse_file_get(data->ff);
2268 if (!data->ff) {
2270 data->ff = fuse_write_file_get(fi);
2271 if (!data->ff)
2310 fuse_write_args_fill(&wpa->ia, data->ff, folio_pos(folio), 0);
2367 data.ff = NULL;
2381 if (data.ff)
2382 fuse_file_put(data.ff, false);
2535 struct fuse_file *ff = file->private_data;
2536 struct fuse_conn *fc = ff->fm->fc;
2549 if (fuse_file_passthrough(ff))
2558 if (ff->open_flags & FOPEN_DIRECT_IO) {
2580 rc = fuse_file_cached_io_open(inode, ff);
2632 struct fuse_file *ff = file->private_data;
2635 inarg->fh = ff->fh;
2728 struct fuse_file *ff = file->private_data;
2731 ff->flock = true;
2772 struct fuse_file *ff = file->private_data;
2775 .fh = ff->fh,
2786 args.nodeid = ff->nodeid;
2855 struct fuse_file *ff;
2858 ff = rb_entry(last, struct fuse_file, polled_node);
2860 if (kh < ff->kh)
2862 else if (kh > ff->kh)
2880 struct fuse_file *ff)
2883 if (RB_EMPTY_NODE(&ff->polled_node)) {
2886 link = fuse_find_polled_node(fc, ff->kh, &parent);
2888 rb_link_node(&ff->polled_node, parent, link);
2889 rb_insert_color(&ff->polled_node, &fc->polled_files);
2896 struct fuse_file *ff = file->private_data;
2897 struct fuse_mount *fm = ff->fm;
2898 struct fuse_poll_in inarg = { .fh = ff->fh, .kh = ff->kh };
2906 poll_wait(file, &ff->poll_wait, wait);
2913 if (waitqueue_active(&ff->poll_wait)) {
2915 fuse_register_polled_file(fm->fc, ff);
2919 args.nodeid = ff->nodeid;
2952 struct fuse_file *ff;
2954 ff = rb_entry(*link, struct fuse_file, polled_node);
2955 wake_up_interruptible_sync(&ff->poll_wait);
2987 struct fuse_file *ff = file->private_data;
3017 io->async = ff->fm->fc->async_dio;
3023 iov_iter_truncate(iter, fuse_round_up(ff->fm->fc, i_size - offset));
3090 struct fuse_file *ff = file->private_data;
3093 struct fuse_mount *fm = ff->fm;
3096 .fh = ff->fh,
3144 args.nodeid = ff->nodeid;