Lines Matching refs:filp
526 static int f2fs_file_open(struct inode *inode, struct file *filp) in f2fs_file_open() argument
528 int err = fscrypt_file_open(inode, filp); in f2fs_file_open()
536 err = fsverity_file_open(inode, filp); in f2fs_file_open()
540 filp->f_mode |= FMODE_NOWAIT; in f2fs_file_open()
542 return dquot_file_open(inode, filp); in f2fs_file_open()
1783 static int f2fs_release_file(struct inode *inode, struct file *filp) in f2fs_release_file() argument
1789 if (!(filp->f_mode & FMODE_WRITE) || in f2fs_release_file()
1958 static int f2fs_ioc_getflags(struct file *filp, unsigned long arg) in f2fs_ioc_getflags() argument
1960 struct inode *inode = file_inode(filp); in f2fs_ioc_getflags()
1978 static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) in f2fs_ioc_setflags() argument
1980 struct inode *inode = file_inode(filp); in f2fs_ioc_setflags()
2000 ret = mnt_want_write_file(filp); in f2fs_ioc_setflags()
2015 mnt_drop_write_file(filp); in f2fs_ioc_setflags()
2019 static int f2fs_ioc_getversion(struct file *filp, unsigned long arg) in f2fs_ioc_getversion() argument
2021 struct inode *inode = file_inode(filp); in f2fs_ioc_getversion()
2026 static int f2fs_ioc_start_atomic_write(struct file *filp) in f2fs_ioc_start_atomic_write() argument
2028 struct inode *inode = file_inode(filp); in f2fs_ioc_start_atomic_write()
2039 if (filp->f_flags & O_DIRECT) in f2fs_ioc_start_atomic_write()
2042 ret = mnt_want_write_file(filp); in f2fs_ioc_start_atomic_write()
2094 mnt_drop_write_file(filp); in f2fs_ioc_start_atomic_write()
2098 static int f2fs_ioc_commit_atomic_write(struct file *filp) in f2fs_ioc_commit_atomic_write() argument
2100 struct inode *inode = file_inode(filp); in f2fs_ioc_commit_atomic_write()
2106 ret = mnt_want_write_file(filp); in f2fs_ioc_commit_atomic_write()
2124 ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true); in f2fs_ioc_commit_atomic_write()
2128 ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 1, false); in f2fs_ioc_commit_atomic_write()
2136 mnt_drop_write_file(filp); in f2fs_ioc_commit_atomic_write()
2140 static int f2fs_ioc_start_volatile_write(struct file *filp) in f2fs_ioc_start_volatile_write() argument
2142 struct inode *inode = file_inode(filp); in f2fs_ioc_start_volatile_write()
2151 ret = mnt_want_write_file(filp); in f2fs_ioc_start_volatile_write()
2171 mnt_drop_write_file(filp); in f2fs_ioc_start_volatile_write()
2175 static int f2fs_ioc_release_volatile_write(struct file *filp) in f2fs_ioc_release_volatile_write() argument
2177 struct inode *inode = file_inode(filp); in f2fs_ioc_release_volatile_write()
2183 ret = mnt_want_write_file(filp); in f2fs_ioc_release_volatile_write()
2200 mnt_drop_write_file(filp); in f2fs_ioc_release_volatile_write()
2204 static int f2fs_ioc_abort_volatile_write(struct file *filp) in f2fs_ioc_abort_volatile_write() argument
2206 struct inode *inode = file_inode(filp); in f2fs_ioc_abort_volatile_write()
2212 ret = mnt_want_write_file(filp); in f2fs_ioc_abort_volatile_write()
2223 ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true); in f2fs_ioc_abort_volatile_write()
2230 mnt_drop_write_file(filp); in f2fs_ioc_abort_volatile_write()
2235 static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) in f2fs_ioc_shutdown() argument
2237 struct inode *inode = file_inode(filp); in f2fs_ioc_shutdown()
2250 ret = mnt_want_write_file(filp); in f2fs_ioc_shutdown()
2310 mnt_drop_write_file(filp); in f2fs_ioc_shutdown()
2317 static int f2fs_ioc_fitrim(struct file *filp, unsigned long arg) in f2fs_ioc_fitrim() argument
2319 struct inode *inode = file_inode(filp); in f2fs_ioc_fitrim()
2335 ret = mnt_want_write_file(filp); in f2fs_ioc_fitrim()
2342 mnt_drop_write_file(filp); in f2fs_ioc_fitrim()
2363 static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg) in f2fs_ioc_set_encryption_policy() argument
2365 struct inode *inode = file_inode(filp); in f2fs_ioc_set_encryption_policy()
2372 return fscrypt_ioctl_set_policy(filp, (const void __user *)arg); in f2fs_ioc_set_encryption_policy()
2375 static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg) in f2fs_ioc_get_encryption_policy() argument
2377 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_get_encryption_policy()
2379 return fscrypt_ioctl_get_policy(filp, (void __user *)arg); in f2fs_ioc_get_encryption_policy()
2382 static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg) in f2fs_ioc_get_encryption_pwsalt() argument
2384 struct inode *inode = file_inode(filp); in f2fs_ioc_get_encryption_pwsalt()
2391 err = mnt_want_write_file(filp); in f2fs_ioc_get_encryption_pwsalt()
2415 mnt_drop_write_file(filp); in f2fs_ioc_get_encryption_pwsalt()
2419 static int f2fs_ioc_get_encryption_policy_ex(struct file *filp, in f2fs_ioc_get_encryption_policy_ex() argument
2422 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_get_encryption_policy_ex()
2425 return fscrypt_ioctl_get_policy_ex(filp, (void __user *)arg); in f2fs_ioc_get_encryption_policy_ex()
2428 static int f2fs_ioc_add_encryption_key(struct file *filp, unsigned long arg) in f2fs_ioc_add_encryption_key() argument
2430 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_add_encryption_key()
2433 return fscrypt_ioctl_add_key(filp, (void __user *)arg); in f2fs_ioc_add_encryption_key()
2436 static int f2fs_ioc_remove_encryption_key(struct file *filp, unsigned long arg) in f2fs_ioc_remove_encryption_key() argument
2438 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_remove_encryption_key()
2441 return fscrypt_ioctl_remove_key(filp, (void __user *)arg); in f2fs_ioc_remove_encryption_key()
2444 static int f2fs_ioc_remove_encryption_key_all_users(struct file *filp, in f2fs_ioc_remove_encryption_key_all_users() argument
2447 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_remove_encryption_key_all_users()
2450 return fscrypt_ioctl_remove_key_all_users(filp, (void __user *)arg); in f2fs_ioc_remove_encryption_key_all_users()
2453 static int f2fs_ioc_get_encryption_key_status(struct file *filp, in f2fs_ioc_get_encryption_key_status() argument
2456 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_get_encryption_key_status()
2459 return fscrypt_ioctl_get_key_status(filp, (void __user *)arg); in f2fs_ioc_get_encryption_key_status()
2462 static int f2fs_ioc_get_encryption_nonce(struct file *filp, unsigned long arg) in f2fs_ioc_get_encryption_nonce() argument
2464 if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_get_encryption_nonce()
2467 return fscrypt_ioctl_get_nonce(filp, (void __user *)arg); in f2fs_ioc_get_encryption_nonce()
2470 static int f2fs_ioc_gc(struct file *filp, unsigned long arg) in f2fs_ioc_gc() argument
2472 struct inode *inode = file_inode(filp); in f2fs_ioc_gc()
2486 ret = mnt_want_write_file(filp); in f2fs_ioc_gc()
2501 mnt_drop_write_file(filp); in f2fs_ioc_gc()
2505 static int __f2fs_ioc_gc_range(struct file *filp, struct f2fs_gc_range *range) in __f2fs_ioc_gc_range() argument
2507 struct f2fs_sb_info *sbi = F2FS_I_SB(file_inode(filp)); in __f2fs_ioc_gc_range()
2521 ret = mnt_want_write_file(filp); in __f2fs_ioc_gc_range()
2546 mnt_drop_write_file(filp); in __f2fs_ioc_gc_range()
2550 static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg) in f2fs_ioc_gc_range() argument
2557 return __f2fs_ioc_gc_range(filp, &range); in f2fs_ioc_gc_range()
2560 static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg) in f2fs_ioc_write_checkpoint() argument
2562 struct inode *inode = file_inode(filp); in f2fs_ioc_write_checkpoint()
2577 ret = mnt_want_write_file(filp); in f2fs_ioc_write_checkpoint()
2583 mnt_drop_write_file(filp); in f2fs_ioc_write_checkpoint()
2588 struct file *filp, in f2fs_defragment_range() argument
2591 struct inode *inode = file_inode(filp); in f2fs_defragment_range()
2739 static int f2fs_ioc_defragment(struct file *filp, unsigned long arg) in f2fs_ioc_defragment() argument
2741 struct inode *inode = file_inode(filp); in f2fs_ioc_defragment()
2767 err = mnt_want_write_file(filp); in f2fs_ioc_defragment()
2771 err = f2fs_defragment_range(sbi, filp, &range); in f2fs_ioc_defragment()
2772 mnt_drop_write_file(filp); in f2fs_ioc_defragment()
2905 static int __f2fs_ioc_move_range(struct file *filp, in __f2fs_ioc_move_range() argument
2911 if (!(filp->f_mode & FMODE_READ) || in __f2fs_ioc_move_range()
2912 !(filp->f_mode & FMODE_WRITE)) in __f2fs_ioc_move_range()
2924 err = mnt_want_write_file(filp); in __f2fs_ioc_move_range()
2928 err = f2fs_move_file_range(filp, range->pos_in, dst.file, in __f2fs_ioc_move_range()
2931 mnt_drop_write_file(filp); in __f2fs_ioc_move_range()
2937 static int f2fs_ioc_move_range(struct file *filp, unsigned long arg) in f2fs_ioc_move_range() argument
2944 return __f2fs_ioc_move_range(filp, &range); in f2fs_ioc_move_range()
2947 static int f2fs_ioc_flush_device(struct file *filp, unsigned long arg) in f2fs_ioc_flush_device() argument
2949 struct inode *inode = file_inode(filp); in f2fs_ioc_flush_device()
2977 ret = mnt_want_write_file(filp); in f2fs_ioc_flush_device()
3006 mnt_drop_write_file(filp); in f2fs_ioc_flush_device()
3010 static int f2fs_ioc_get_features(struct file *filp, unsigned long arg) in f2fs_ioc_get_features() argument
3012 struct inode *inode = file_inode(filp); in f2fs_ioc_get_features()
3040 static int f2fs_ioc_setproject(struct file *filp, __u32 projid) in f2fs_ioc_setproject() argument
3042 struct inode *inode = file_inode(filp); in f2fs_ioc_setproject()
3103 static int f2fs_ioc_setproject(struct file *filp, __u32 projid) in f2fs_ioc_setproject() argument
3175 static int f2fs_ioc_fsgetxattr(struct file *filp, unsigned long arg) in f2fs_ioc_fsgetxattr() argument
3177 struct inode *inode = file_inode(filp); in f2fs_ioc_fsgetxattr()
3187 static int f2fs_ioc_fssetxattr(struct file *filp, unsigned long arg) in f2fs_ioc_fssetxattr() argument
3189 struct inode *inode = file_inode(filp); in f2fs_ioc_fssetxattr()
3208 err = mnt_want_write_file(filp); in f2fs_ioc_fssetxattr()
3224 err = f2fs_ioc_setproject(filp, fa.fsx_projid); in f2fs_ioc_fssetxattr()
3227 mnt_drop_write_file(filp); in f2fs_ioc_fssetxattr()
3251 static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg) in f2fs_ioc_set_pin_file() argument
3253 struct inode *inode = file_inode(filp); in f2fs_ioc_set_pin_file()
3266 ret = mnt_want_write_file(filp); in f2fs_ioc_set_pin_file()
3303 mnt_drop_write_file(filp); in f2fs_ioc_set_pin_file()
3307 static int f2fs_ioc_get_pin_file(struct file *filp, unsigned long arg) in f2fs_ioc_get_pin_file() argument
3309 struct inode *inode = file_inode(filp); in f2fs_ioc_get_pin_file()
3351 static int f2fs_ioc_precache_extents(struct file *filp, unsigned long arg) in f2fs_ioc_precache_extents() argument
3353 return f2fs_precache_extents(file_inode(filp)); in f2fs_ioc_precache_extents()
3356 static int f2fs_ioc_resize_fs(struct file *filp, unsigned long arg) in f2fs_ioc_resize_fs() argument
3358 struct f2fs_sb_info *sbi = F2FS_I_SB(file_inode(filp)); in f2fs_ioc_resize_fs()
3371 return f2fs_resize_fs(filp, block_count); in f2fs_ioc_resize_fs()
3374 static int f2fs_ioc_enable_verity(struct file *filp, unsigned long arg) in f2fs_ioc_enable_verity() argument
3376 struct inode *inode = file_inode(filp); in f2fs_ioc_enable_verity()
3387 return fsverity_ioctl_enable(filp, (const void __user *)arg); in f2fs_ioc_enable_verity()
3390 static int f2fs_ioc_measure_verity(struct file *filp, unsigned long arg) in f2fs_ioc_measure_verity() argument
3392 if (!f2fs_sb_has_verity(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_measure_verity()
3395 return fsverity_ioctl_measure(filp, (void __user *)arg); in f2fs_ioc_measure_verity()
3398 static int f2fs_ioc_read_verity_metadata(struct file *filp, unsigned long arg) in f2fs_ioc_read_verity_metadata() argument
3400 if (!f2fs_sb_has_verity(F2FS_I_SB(file_inode(filp)))) in f2fs_ioc_read_verity_metadata()
3403 return fsverity_ioctl_read_metadata(filp, (const void __user *)arg); in f2fs_ioc_read_verity_metadata()
3406 static int f2fs_ioc_getfslabel(struct file *filp, unsigned long arg) in f2fs_ioc_getfslabel() argument
3408 struct inode *inode = file_inode(filp); in f2fs_ioc_getfslabel()
3432 static int f2fs_ioc_setfslabel(struct file *filp, unsigned long arg) in f2fs_ioc_setfslabel() argument
3434 struct inode *inode = file_inode(filp); in f2fs_ioc_setfslabel()
3446 err = mnt_want_write_file(filp); in f2fs_ioc_setfslabel()
3462 mnt_drop_write_file(filp); in f2fs_ioc_setfslabel()
3468 static int f2fs_get_compress_blocks(struct file *filp, unsigned long arg) in f2fs_get_compress_blocks() argument
3470 struct inode *inode = file_inode(filp); in f2fs_get_compress_blocks()
3537 static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) in f2fs_release_compress_blocks() argument
3539 struct inode *inode = file_inode(filp); in f2fs_release_compress_blocks()
3555 ret = mnt_want_write_file(filp); in f2fs_release_compress_blocks()
3564 if ((filp->f_mode & FMODE_WRITE && writecount != 1) || in f2fs_release_compress_blocks()
3565 (!(filp->f_mode & FMODE_WRITE) && writecount)) { in f2fs_release_compress_blocks()
3627 mnt_drop_write_file(filp); in f2fs_release_compress_blocks()
3706 static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) in f2fs_reserve_compress_blocks() argument
3708 struct inode *inode = file_inode(filp); in f2fs_reserve_compress_blocks()
3723 ret = mnt_want_write_file(filp); in f2fs_reserve_compress_blocks()
3786 mnt_drop_write_file(filp); in f2fs_reserve_compress_blocks()
3831 static int f2fs_sec_trim_file(struct file *filp, unsigned long arg) in f2fs_sec_trim_file() argument
3833 struct inode *inode = file_inode(filp); in f2fs_sec_trim_file()
3844 if (!(filp->f_mode & FMODE_WRITE)) in f2fs_sec_trim_file()
3861 file_start_write(filp); in f2fs_sec_trim_file()
3986 file_end_write(filp); in f2fs_sec_trim_file()
3991 static int f2fs_ioc_get_compress_option(struct file *filp, unsigned long arg) in f2fs_ioc_get_compress_option() argument
3993 struct inode *inode = file_inode(filp); in f2fs_ioc_get_compress_option()
4018 static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) in f2fs_ioc_set_compress_option() argument
4020 struct inode *inode = file_inode(filp); in f2fs_ioc_set_compress_option()
4028 if (!(filp->f_mode & FMODE_WRITE)) in f2fs_ioc_set_compress_option()
4041 file_start_write(filp); in f2fs_ioc_set_compress_option()
4064 file_end_write(filp); in f2fs_ioc_set_compress_option()
4102 static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) in f2fs_ioc_decompress_file() argument
4104 struct inode *inode = file_inode(filp); in f2fs_ioc_decompress_file()
4116 if (!(filp->f_mode & FMODE_WRITE)) in f2fs_ioc_decompress_file()
4124 file_start_write(filp); in f2fs_ioc_decompress_file()
4170 file_end_write(filp); in f2fs_ioc_decompress_file()
4175 static int f2fs_ioc_compress_file(struct file *filp, unsigned long arg) in f2fs_ioc_compress_file() argument
4177 struct inode *inode = file_inode(filp); in f2fs_ioc_compress_file()
4188 if (!(filp->f_mode & FMODE_WRITE)) in f2fs_ioc_compress_file()
4196 file_start_write(filp); in f2fs_ioc_compress_file()
4243 file_end_write(filp); in f2fs_ioc_compress_file()
4248 static long __f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) in __f2fs_ioctl() argument
4252 return f2fs_ioc_getflags(filp, arg); in __f2fs_ioctl()
4254 return f2fs_ioc_setflags(filp, arg); in __f2fs_ioctl()
4256 return f2fs_ioc_getversion(filp, arg); in __f2fs_ioctl()
4258 return f2fs_ioc_start_atomic_write(filp); in __f2fs_ioctl()
4260 return f2fs_ioc_commit_atomic_write(filp); in __f2fs_ioctl()
4262 return f2fs_ioc_start_volatile_write(filp); in __f2fs_ioctl()
4264 return f2fs_ioc_release_volatile_write(filp); in __f2fs_ioctl()
4266 return f2fs_ioc_abort_volatile_write(filp); in __f2fs_ioctl()
4268 return f2fs_ioc_shutdown(filp, arg); in __f2fs_ioctl()
4270 return f2fs_ioc_fitrim(filp, arg); in __f2fs_ioctl()
4272 return f2fs_ioc_set_encryption_policy(filp, arg); in __f2fs_ioctl()
4274 return f2fs_ioc_get_encryption_policy(filp, arg); in __f2fs_ioctl()
4276 return f2fs_ioc_get_encryption_pwsalt(filp, arg); in __f2fs_ioctl()
4278 return f2fs_ioc_get_encryption_policy_ex(filp, arg); in __f2fs_ioctl()
4280 return f2fs_ioc_add_encryption_key(filp, arg); in __f2fs_ioctl()
4282 return f2fs_ioc_remove_encryption_key(filp, arg); in __f2fs_ioctl()
4284 return f2fs_ioc_remove_encryption_key_all_users(filp, arg); in __f2fs_ioctl()
4286 return f2fs_ioc_get_encryption_key_status(filp, arg); in __f2fs_ioctl()
4288 return f2fs_ioc_get_encryption_nonce(filp, arg); in __f2fs_ioctl()
4290 return f2fs_ioc_gc(filp, arg); in __f2fs_ioctl()
4292 return f2fs_ioc_gc_range(filp, arg); in __f2fs_ioctl()
4294 return f2fs_ioc_write_checkpoint(filp, arg); in __f2fs_ioctl()
4296 return f2fs_ioc_defragment(filp, arg); in __f2fs_ioctl()
4298 return f2fs_ioc_move_range(filp, arg); in __f2fs_ioctl()
4300 return f2fs_ioc_flush_device(filp, arg); in __f2fs_ioctl()
4302 return f2fs_ioc_get_features(filp, arg); in __f2fs_ioctl()
4304 return f2fs_ioc_fsgetxattr(filp, arg); in __f2fs_ioctl()
4306 return f2fs_ioc_fssetxattr(filp, arg); in __f2fs_ioctl()
4308 return f2fs_ioc_get_pin_file(filp, arg); in __f2fs_ioctl()
4310 return f2fs_ioc_set_pin_file(filp, arg); in __f2fs_ioctl()
4312 return f2fs_ioc_precache_extents(filp, arg); in __f2fs_ioctl()
4314 return f2fs_ioc_resize_fs(filp, arg); in __f2fs_ioctl()
4316 return f2fs_ioc_enable_verity(filp, arg); in __f2fs_ioctl()
4318 return f2fs_ioc_measure_verity(filp, arg); in __f2fs_ioctl()
4320 return f2fs_ioc_read_verity_metadata(filp, arg); in __f2fs_ioctl()
4322 return f2fs_ioc_getfslabel(filp, arg); in __f2fs_ioctl()
4324 return f2fs_ioc_setfslabel(filp, arg); in __f2fs_ioctl()
4326 return f2fs_get_compress_blocks(filp, arg); in __f2fs_ioctl()
4328 return f2fs_release_compress_blocks(filp, arg); in __f2fs_ioctl()
4330 return f2fs_reserve_compress_blocks(filp, arg); in __f2fs_ioctl()
4332 return f2fs_sec_trim_file(filp, arg); in __f2fs_ioctl()
4334 return f2fs_ioc_get_compress_option(filp, arg); in __f2fs_ioctl()
4336 return f2fs_ioc_set_compress_option(filp, arg); in __f2fs_ioctl()
4338 return f2fs_ioc_decompress_file(filp, arg); in __f2fs_ioctl()
4340 return f2fs_ioc_compress_file(filp, arg); in __f2fs_ioctl()
4346 long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) in f2fs_ioctl() argument
4348 if (unlikely(f2fs_cp_error(F2FS_I_SB(file_inode(filp))))) in f2fs_ioctl()
4350 if (!f2fs_is_checkpoint_ready(F2FS_I_SB(file_inode(filp)))) in f2fs_ioctl()
4353 return __f2fs_ioctl(filp, cmd, arg); in f2fs_ioctl()