Lines Matching defs:file

47  * gfs2_llseek - seek to a location in a file
48 * @file: the file
52 * SEEK_END requires the glock for the file because it references the
53 * file's size.
58 static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence)
60 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
69 error = generic_file_llseek(file, offset, whence);
75 error = gfs2_seek_data(file, offset);
79 error = gfs2_seek_hole(file, offset);
88 error = generic_file_llseek(file, offset, whence);
99 * @file: The directory to read from
105 static int gfs2_readdir(struct file *file, struct dir_context *ctx)
107 struct inode *dir = file->f_mapping->host;
116 error = gfs2_dir_read(dir, ctx, &file->f_ra);
314 static int gfs2_getlabel(struct file *filp, char __user *label)
325 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
338 static long gfs2_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
357 * @filep: The struct file
358 * @offset: The file offset of the write
367 static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size)
447 /* Update file times before taking folio lock */
581 * @file: The file to map
591 static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
593 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
595 if (!(file->f_flags & O_NOATIME) &&
606 file_accessed(file);
616 * @file: The file being opened
620 * files, however. For other file types, it does not matter whether
626 int gfs2_open_common(struct inode *inode, struct file *file)
632 ret = generic_file_open(inode, file);
637 file->f_mode |= FMODE_CAN_ODIRECT;
646 gfs2_assert_warn(GFS2_SB(inode), !file->private_data);
647 file->private_data = fp;
648 if (file->f_mode & FMODE_WRITE) {
656 kfree(file->private_data);
657 file->private_data = NULL;
662 * gfs2_open - open a file
664 * @file: the struct file for this opening
668 * files to ensure that we have the file size uptodate for the large
669 * file check which is in the common code. That is only an issue for
675 static int gfs2_open(struct inode *inode, struct file *file)
690 error = gfs2_open_common(inode, file);
699 * gfs2_release - called to close a struct file
700 * @inode: the inode the struct file belongs to
701 * @file: the struct file being closed
706 static int gfs2_release(struct inode *inode, struct file *file)
710 kfree(file->private_data);
711 file->private_data = NULL;
713 if (file->f_mode & FMODE_WRITE) {
722 * gfs2_fsync - sync the dirty data for a file (across the cluster)
723 * @file: the file that points to the dentry
724 * @start: the start position in the file to sync
725 * @end: the end position in the file to sync
742 static int gfs2_fsync(struct file *file, loff_t start, loff_t end,
745 struct address_space *mapping = file->f_mapping;
767 ret = file_write_and_wait(file);
774 ret = file_fdatawait_range(file, start, end);
814 struct file *file = iocb->ki_filp;
815 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
832 * processes and nodes can do direct I/O to a file at the same time.
877 struct file *file = iocb->ki_filp;
878 struct inode *inode = file->f_mapping->host;
1014 struct file *file = iocb->ki_filp;
1015 struct inode *inode = file_inode(file);
1089 * gfs2_file_write_iter - Perform a write to a file
1096 * own file locking, this will make O_APPEND work as expected.
1102 struct file *file = iocb->ki_filp;
1103 struct inode *inode = file_inode(file);
1108 gfs2_size_hint(file, iocb->ki_pos, iov_iter_count(from));
1122 ret = file_remove_privs(file);
1127 struct address_space *mapping = file->f_mapping;
1162 ret = file_update_time(file);
1252 static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
1254 struct inode *inode = file_inode(file);
1279 gfs2_size_hint(file, offset, len);
1353 file_update_time(file);
1356 if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host))
1357 return vfs_fsync_range(file, pos, pos + count - 1,
1358 (file->f_flags & __O_SYNC) ? 0 : 1);
1368 static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
1370 struct inode *inode = file_inode(file);
1401 ret = __gfs2_punch_hole(file, offset, len);
1403 ret = __gfs2_fallocate(file, mode, offset, len);
1418 struct file *out, loff_t *ppos,
1432 * gfs2_lock - acquire/release a posix lock on a file
1433 * @file: the file pointer
1440 static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
1442 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
1443 struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host);
1450 locks_lock_file_wait(file, fl);
1454 return dlm_posix_cancel(ls->ls_dlm, ip->i_no_addr, file, fl);
1456 return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl);
1458 return dlm_posix_unlock(ls->ls_dlm, ip->i_no_addr, file, fl);
1460 return dlm_posix_lock(ls->ls_dlm, ip->i_no_addr, file, cmd, fl);
1463 static void __flock_holder_uninit(struct file *file, struct gfs2_holder *fl_gh)
1468 * Make sure gfs2_glock_put() won't sleep under the file->f_lock
1472 spin_lock(&file->f_lock);
1474 spin_unlock(&file->f_lock);
1478 static int do_flock(struct file *file, int cmd, struct file_lock *fl)
1480 struct gfs2_file *fp = file->private_data;
1482 struct gfs2_inode *ip = GFS2_I(file_inode(file));
1503 locks_lock_file_wait(file, &request);
1511 spin_lock(&file->f_lock);
1513 spin_unlock(&file->f_lock);
1525 __flock_holder_uninit(file, fl_gh);
1529 error = locks_lock_file_wait(file, fl);
1538 static void do_unflock(struct file *file, struct file_lock *fl)
1540 struct gfs2_file *fp = file->private_data;
1544 locks_lock_file_wait(file, fl);
1547 __flock_holder_uninit(file, fl_gh);
1553 * gfs2_flock - acquire/release a flock lock on a file
1554 * @file: the file pointer
1561 static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
1567 do_unflock(file, fl);
1570 return do_flock(file, cmd, fl);