Lines Matching defs:file

13  * Mark the backing file as being a cache file if it's not already in use.  The
15 * file or directory. The caller must hold the inode lock.
67 struct file *file)
70 struct inode *inode = file_inode(file);
226 * Remove a regular file from the cache.
286 * by a file struct.
412 * Delete a cache file.
418 struct dentry *dentry = object->file->f_path.dentry;
422 _enter(",OBJ%x{%pD}", object->debug_id, object->file);
424 /* Stop the dentry being negated if it's only pinned by a file struct. */
435 * Create a temporary file and leave it unattached and un-xattr'd until the
438 struct file *cachefiles_create_tmpfile(struct cachefiles_object *object)
444 struct file *file;
454 file = kernel_tmpfile_open(&nop_mnt_idmap, &parentpath,
458 ret = PTR_ERR_OR_ZERO(file);
468 trace_cachefiles_tmpfile(object, file_inode(file));
470 /* This is a newly created file with no other possible user */
471 if (!cachefiles_mark_inode_in_use(object, file_inode(file)))
482 trace_cachefiles_trunc(object, file_inode(file), 0, ni_size,
486 ret = vfs_truncate(&file->f_path, ni_size);
489 object, file_inode(file), ret,
496 if (unlikely(!file->f_op->read_iter) ||
497 unlikely(!file->f_op->write_iter)) {
498 fput(file);
504 return file;
507 cachefiles_do_unmark_inode_in_use(object, file_inode(file));
508 fput(file);
510 file = ERR_PTR(ret);
515 * Create a new file.
519 struct file *file;
527 file = cachefiles_create_tmpfile(object);
528 if (IS_ERR(file))
533 _debug("create -> %pD{ino=%lu}", file, file_inode(file)->i_ino);
534 object->file = file;
539 * Open an existing file, checking its attributes and replacing it if it is
546 struct file *file;
558 /* We need to open a file interface onto a data file now as we can't do
564 file = kernel_file_open(&path, O_RDWR | O_LARGEFILE | O_DIRECT,
566 if (IS_ERR(file)) {
568 PTR_ERR(file),
573 if (unlikely(!file->f_op->read_iter) ||
574 unlikely(!file->f_op->write_iter)) {
578 _debug("file -> %pd positive", dentry);
584 ret = cachefiles_check_auxdata(object, file);
590 object->file = file;
596 touch_atime(&file->f_path);
602 cachefiles_unmark_inode_in_use(object, file);
603 fput(file);
610 fput(file);
629 /* Look up path "cache/vol/fanout/file". */
646 pr_err("%pd is not a file\n", dentry);
659 _leave(" = t [%lu]", file_inode(object->file)->i_ino);
668 * Attempt to link a temporary file into its rightful place in the cache.
678 _enter(",%pD", object->file);
694 if (d_backing_inode(dentry) == file_inode(object->file)) {
720 ret = vfs_link(object->file->f_path.dentry, &nop_mnt_idmap,
727 trace_cachefiles_link(object, file_inode(object->file));
729 /* TODO: Do we want to switch the file pointer to the new dentry? */