Lines Matching full: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) in gfs2_llseek() argument
60 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); in gfs2_llseek()
69 error = generic_file_llseek(file, offset, whence); in gfs2_llseek()
75 error = gfs2_seek_data(file, offset); in gfs2_llseek()
79 error = gfs2_seek_hole(file, offset); in gfs2_llseek()
88 error = generic_file_llseek(file, offset, whence); in gfs2_llseek()
99 * @file: The directory to read from
105 static int gfs2_readdir(struct file *file, struct dir_context *ctx) in gfs2_readdir() argument
107 struct inode *dir = file->f_mapping->host; in gfs2_readdir()
116 error = gfs2_dir_read(dir, ctx, &file->f_ra); in gfs2_readdir()
314 static int gfs2_getlabel(struct file *filp, char __user *label) in gfs2_getlabel()
325 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) in gfs2_ioctl()
338 static long gfs2_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) in gfs2_compat_ioctl()
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) in gfs2_size_hint()
447 /* Update file times before taking folio lock */ in gfs2_page_mkwrite()
581 * @file: The file to map
591 static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) in gfs2_mmap() argument
593 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); in gfs2_mmap()
595 if (!(file->f_flags & O_NOATIME) && in gfs2_mmap()
606 file_accessed(file); in gfs2_mmap()
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) in gfs2_open_common() argument
632 ret = generic_file_open(inode, file); in gfs2_open_common()
637 file->f_mode |= FMODE_CAN_ODIRECT; in gfs2_open_common()
646 gfs2_assert_warn(GFS2_SB(inode), !file->private_data); in gfs2_open_common()
647 file->private_data = fp; in gfs2_open_common()
648 if (file->f_mode & FMODE_WRITE) { in gfs2_open_common()
656 kfree(file->private_data); in gfs2_open_common()
657 file->private_data = NULL; in gfs2_open_common()
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) in gfs2_open() argument
690 error = gfs2_open_common(inode, file); in gfs2_open()
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) in gfs2_release() argument
710 kfree(file->private_data); in gfs2_release()
711 file->private_data = NULL; in gfs2_release()
713 if (file->f_mode & FMODE_WRITE) { in gfs2_release()
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, in gfs2_fsync() argument
745 struct address_space *mapping = file->f_mapping; in gfs2_fsync()
767 ret = file_write_and_wait(file); in gfs2_fsync()
774 ret = file_fdatawait_range(file, start, end); in gfs2_fsync()
814 struct file *file = iocb->ki_filp; in gfs2_file_direct_read() local
815 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); in gfs2_file_direct_read()
832 * processes and nodes can do direct I/O to a file at the same time. in gfs2_file_direct_read()
877 struct file *file = iocb->ki_filp; in gfs2_file_direct_write() local
878 struct inode *inode = file->f_mapping->host; in gfs2_file_direct_write()
1014 struct file *file = iocb->ki_filp; in gfs2_file_buffered_write() local
1015 struct inode *inode = file_inode(file); in gfs2_file_buffered_write()
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; in gfs2_file_write_iter() local
1103 struct inode *inode = file_inode(file); in gfs2_file_write_iter()
1108 gfs2_size_hint(file, iocb->ki_pos, iov_iter_count(from)); in gfs2_file_write_iter()
1122 ret = file_remove_privs(file); in gfs2_file_write_iter()
1127 struct address_space *mapping = file->f_mapping; in gfs2_file_write_iter()
1162 ret = file_update_time(file); in gfs2_file_write_iter()
1252 static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len) in __gfs2_fallocate() argument
1254 struct inode *inode = file_inode(file); in __gfs2_fallocate()
1279 gfs2_size_hint(file, offset, len); in __gfs2_fallocate()
1353 file_update_time(file); in __gfs2_fallocate()
1356 if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host)) in __gfs2_fallocate()
1357 return vfs_fsync_range(file, pos, pos + count - 1, in __gfs2_fallocate()
1358 (file->f_flags & __O_SYNC) ? 0 : 1); in __gfs2_fallocate()
1368 static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len) in gfs2_fallocate() argument
1370 struct inode *inode = file_inode(file); in gfs2_fallocate()
1401 ret = __gfs2_punch_hole(file, offset, len); in gfs2_fallocate()
1403 ret = __gfs2_fallocate(file, mode, offset, len); in gfs2_fallocate()
1418 struct file *out, loff_t *ppos, in gfs2_file_splice_write()
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) in gfs2_lock() argument
1442 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); in gfs2_lock()
1443 struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); in gfs2_lock()
1451 locks_lock_file_wait(file, fl); in gfs2_lock()
1458 ret = dlm_posix_cancel(ls->ls_dlm, ip->i_no_addr, file, fl); in gfs2_lock()
1460 ret = dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); in gfs2_lock()
1462 ret = dlm_posix_unlock(ls->ls_dlm, ip->i_no_addr, file, fl); in gfs2_lock()
1464 ret = dlm_posix_lock(ls->ls_dlm, ip->i_no_addr, file, cmd, fl); in gfs2_lock()
1470 static void __flock_holder_uninit(struct file *file, struct gfs2_holder *fl_gh) in __flock_holder_uninit() argument
1475 * Make sure gfs2_glock_put() won't sleep under the file->f_lock in __flock_holder_uninit()
1479 spin_lock(&file->f_lock); in __flock_holder_uninit()
1481 spin_unlock(&file->f_lock); in __flock_holder_uninit()
1485 static int do_flock(struct file *file, int cmd, struct file_lock *fl) in do_flock() argument
1487 struct gfs2_file *fp = file->private_data; in do_flock()
1489 struct gfs2_inode *ip = GFS2_I(file_inode(file)); in do_flock()
1510 locks_lock_file_wait(file, &request); in do_flock()
1518 spin_lock(&file->f_lock); in do_flock()
1520 spin_unlock(&file->f_lock); in do_flock()
1532 __flock_holder_uninit(file, fl_gh); in do_flock()
1536 error = locks_lock_file_wait(file, fl); in do_flock()
1545 static void do_unflock(struct file *file, struct file_lock *fl) in do_unflock() argument
1547 struct gfs2_file *fp = file->private_data; in do_unflock()
1551 locks_lock_file_wait(file, fl); in do_unflock()
1554 __flock_holder_uninit(file, fl_gh); in do_unflock()
1560 * gfs2_flock - acquire/release a flock lock on a file
1561 * @file: the file pointer
1568 static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) in gfs2_flock() argument
1574 do_unflock(file, fl); in gfs2_flock()
1577 return do_flock(file, cmd, fl); in gfs2_flock()