#include <linux/fs.h>
#include <linux/f2fs_fs.h>
#include <linux/stat.h>
#include <linux/buffer_head.h>
#include <linux/writeback.h>
#include <linux/blkdev.h>
#include <linux/falloc.h>
#include <linux/types.h>
#include <linux/compat.h>
#include <linux/uaccess.h>
#include <linux/mount.h>
#include <linux/pagevec.h>
#include <linux/uio.h>
#include <linux/uuid.h>
#include <linux/file.h>
#include <linux/nls.h>
#include <linux/sched/signal.h>
#include <linux/fileattr.h>
#include <linux/fadvise.h>
#include <linux/iomap.h>
#include "f2fs.h"
#include "node.h"
#include "segment.h"
#include "xattr.h"
#include "acl.h"
#include "gc.h"
#include "iostat.h"
#include <trace/events/f2fs.h>
#include <uapi/linux/f2fs.h>
static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf)
{ … }
static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
{ … }
static const struct vm_operations_struct f2fs_file_vm_ops = …;
static int get_parent_ino(struct inode *inode, nid_t *pino)
{ … }
static inline enum cp_reason_type need_do_checkpoint(struct inode *inode)
{ … }
static bool need_inode_page_update(struct f2fs_sb_info *sbi, nid_t ino)
{ … }
static void try_to_fix_pino(struct inode *inode)
{ … }
static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
int datasync, bool atomic)
{ … }
int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
{ … }
static bool __found_offset(struct address_space *mapping,
struct dnode_of_data *dn, pgoff_t index, int whence)
{ … }
static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
{ … }
static loff_t f2fs_llseek(struct file *file, loff_t offset, int whence)
{ … }
static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
{ … }
static int finish_preallocate_blocks(struct inode *inode)
{ … }
static int f2fs_file_open(struct inode *inode, struct file *filp)
{ … }
void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count)
{ … }
static int truncate_partial_data_page(struct inode *inode, u64 from,
bool cache_only)
{ … }
int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock)
{ … }
int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock)
{ … }
int f2fs_truncate(struct inode *inode)
{ … }
static bool f2fs_force_buffered_io(struct inode *inode, int rw)
{ … }
int f2fs_getattr(struct mnt_idmap *idmap, const struct path *path,
struct kstat *stat, u32 request_mask, unsigned int query_flags)
{ … }
#ifdef CONFIG_F2FS_FS_POSIX_ACL
static void __setattr_copy(struct mnt_idmap *idmap,
struct inode *inode, const struct iattr *attr)
{ … }
#else
#define __setattr_copy …
#endif
int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
struct iattr *attr)
{ … }
const struct inode_operations f2fs_file_inode_operations = …;
static int fill_zero(struct inode *inode, pgoff_t index,
loff_t start, loff_t len)
{ … }
int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
{ … }
static int f2fs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
{ … }
static int __read_out_blkaddrs(struct inode *inode, block_t *blkaddr,
int *do_replace, pgoff_t off, pgoff_t len)
{ … }
static int __roll_back_blkaddrs(struct inode *inode, block_t *blkaddr,
int *do_replace, pgoff_t off, int len)
{ … }
static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
block_t *blkaddr, int *do_replace,
pgoff_t src, pgoff_t dst, pgoff_t len, bool full)
{ … }
static int __exchange_data_block(struct inode *src_inode,
struct inode *dst_inode, pgoff_t src, pgoff_t dst,
pgoff_t len, bool full)
{ … }
static int f2fs_do_collapse(struct inode *inode, loff_t offset, loff_t len)
{ … }
static int f2fs_collapse_range(struct inode *inode, loff_t offset, loff_t len)
{ … }
static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start,
pgoff_t end)
{ … }
static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len,
int mode)
{ … }
static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len)
{ … }
static int f2fs_expand_inode_data(struct inode *inode, loff_t offset,
loff_t len, int mode)
{ … }
static long f2fs_fallocate(struct file *file, int mode,
loff_t offset, loff_t len)
{ … }
static int f2fs_release_file(struct inode *inode, struct file *filp)
{ … }
static int f2fs_file_flush(struct file *file, fl_owner_t id)
{ … }
static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
{ … }
static const struct { … } f2fs_fsflags_map[] = …;
#define F2FS_GETTABLE_FS_FL …
#define F2FS_SETTABLE_FS_FL …
static inline u32 f2fs_iflags_to_fsflags(u32 iflags)
{ … }
static inline u32 f2fs_fsflags_to_iflags(u32 fsflags)
{ … }
static int f2fs_ioc_getversion(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)
{ … }
static int f2fs_ioc_commit_atomic_write(struct file *filp)
{ … }
static int f2fs_ioc_abort_atomic_write(struct file *filp)
{ … }
int f2fs_do_shutdown(struct f2fs_sb_info *sbi, unsigned int flag,
bool readonly)
{ … }
static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_fitrim(struct file *filp, unsigned long arg)
{ … }
static bool uuid_is_nonzero(__u8 u[16])
{ … }
static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_get_encryption_policy_ex(struct file *filp,
unsigned long arg)
{ … }
static int f2fs_ioc_add_encryption_key(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_remove_encryption_key(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_remove_encryption_key_all_users(struct file *filp,
unsigned long arg)
{ … }
static int f2fs_ioc_get_encryption_key_status(struct file *filp,
unsigned long arg)
{ … }
static int f2fs_ioc_get_encryption_nonce(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_gc(struct file *filp, unsigned long arg)
{ … }
static int __f2fs_ioc_gc_range(struct file *filp, struct f2fs_gc_range *range)
{ … }
static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_write_checkpoint(struct file *filp)
{ … }
static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
struct file *filp,
struct f2fs_defragment *range)
{ … }
static int f2fs_ioc_defragment(struct file *filp, unsigned long arg)
{ … }
static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out, size_t len)
{ … }
static int __f2fs_ioc_move_range(struct file *filp,
struct f2fs_move_range *range)
{ … }
static int f2fs_ioc_move_range(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_flush_device(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_get_features(struct file *filp, unsigned long arg)
{ … }
#ifdef CONFIG_QUOTA
int f2fs_transfer_project_quota(struct inode *inode, kprojid_t kprojid)
{ … }
static int f2fs_ioc_setproject(struct inode *inode, __u32 projid)
{ … }
#else
int f2fs_transfer_project_quota(struct inode *inode, kprojid_t kprojid)
{
return 0;
}
static int f2fs_ioc_setproject(struct inode *inode, __u32 projid)
{
if (projid != F2FS_DEF_PROJID)
return -EOPNOTSUPP;
return 0;
}
#endif
int f2fs_fileattr_get(struct dentry *dentry, struct fileattr *fa)
{ … }
int f2fs_fileattr_set(struct mnt_idmap *idmap,
struct dentry *dentry, struct fileattr *fa)
{ … }
int f2fs_pin_file_control(struct inode *inode, bool inc)
{ … }
static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_get_pin_file(struct file *filp, unsigned long arg)
{ … }
int f2fs_precache_extents(struct inode *inode)
{ … }
static int f2fs_ioc_precache_extents(struct file *filp)
{ … }
static int f2fs_ioc_resize_fs(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_enable_verity(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_read_verity_metadata(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_getfslabel(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_setfslabel(struct file *filp, unsigned long arg)
{ … }
static int f2fs_get_compress_blocks(struct inode *inode, __u64 *blocks)
{ … }
static int f2fs_ioc_get_compress_blocks(struct file *filp, unsigned long arg)
{ … }
static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count)
{ … }
static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
{ … }
static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,
unsigned int *reserved_blocks)
{ … }
static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)
{ … }
static int f2fs_secure_erase(struct block_device *bdev, struct inode *inode,
pgoff_t off, block_t block, block_t len, u32 flags)
{ … }
static int f2fs_sec_trim_file(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg)
{ … }
static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
{ … }
static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
{ … }
static int f2fs_ioc_decompress_file(struct file *filp)
{ … }
static int f2fs_ioc_compress_file(struct file *filp)
{ … }
static long __f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ … }
long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ … }
static bool f2fs_should_use_dio(struct inode *inode, struct kiocb *iocb,
struct iov_iter *iter)
{ … }
static int f2fs_dio_read_end_io(struct kiocb *iocb, ssize_t size, int error,
unsigned int flags)
{ … }
static const struct iomap_dio_ops f2fs_iomap_dio_read_ops = …;
static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
{ … }
static void f2fs_trace_rw_file_path(struct file *file, loff_t pos, size_t count,
int rw)
{ … }
static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{ … }
static ssize_t f2fs_file_splice_read(struct file *in, loff_t *ppos,
struct pipe_inode_info *pipe,
size_t len, unsigned int flags)
{ … }
static ssize_t f2fs_write_checks(struct kiocb *iocb, struct iov_iter *from)
{ … }
static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter,
bool dio)
{ … }
static ssize_t f2fs_buffered_write_iter(struct kiocb *iocb,
struct iov_iter *from)
{ … }
static int f2fs_dio_write_end_io(struct kiocb *iocb, ssize_t size, int error,
unsigned int flags)
{ … }
static void f2fs_dio_write_submit_io(const struct iomap_iter *iter,
struct bio *bio, loff_t file_offset)
{ … }
static const struct iomap_dio_ops f2fs_iomap_dio_write_ops = …;
static void f2fs_flush_buffered_write(struct address_space *mapping,
loff_t start_pos, loff_t end_pos)
{ … }
static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,
bool *may_need_sync)
{ … }
static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
{ … }
static int f2fs_file_fadvise(struct file *filp, loff_t offset, loff_t len,
int advice)
{ … }
#ifdef CONFIG_COMPAT
struct compat_f2fs_gc_range { … };
#define F2FS_IOC32_GARBAGE_COLLECT_RANGE …
static int f2fs_compat_ioc_gc_range(struct file *file, unsigned long arg)
{ … }
struct compat_f2fs_move_range { … };
#define F2FS_IOC32_MOVE_RANGE …
static int f2fs_compat_ioc_move_range(struct file *file, unsigned long arg)
{ … }
long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#endif
const struct file_operations f2fs_file_operations = …;