On Mon, Nov 23, 2020 at 12:17:51PM +0900, Daeho Jeong wrote:
> From: Daeho Jeong <[email protected]>
>
> Added two ioctl to decompress/compress explicitly the compression
> enabled file in "compress_mode=user-based" mount option.
>
> Using these two ioctls, the users can make a control of compression
> and decompression of their files.
>
> Signed-off-by: Daeho Jeong <[email protected]>
> ---
> fs/f2fs/file.c | 181 +++++++++++++++++++++++++++++++++++++-
> include/uapi/linux/f2fs.h | 2 +
> 2 files changed, 182 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index be8db06aca27..e8f142470e87 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4026,6 +4026,180 @@ static int f2fs_ioc_set_compress_option(struct file
> *filp, unsigned long arg)
> return ret;
> }
>
> +static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
> +{
> + DEFINE_READAHEAD(ractl, NULL, inode->i_mapping, page_idx);
> + struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> + struct address_space *mapping = inode->i_mapping;
> + struct page *page;
> + pgoff_t redirty_idx = page_idx;
> + int i, page_len = 0, ret = 0;
> +
> + page_cache_ra_unbounded(&ractl, len, 0);
Using page_cache_ra_unbounded() here looks wrong. See the comment above
page_cache_ra_unbounded().
> static long __f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long
> arg)
> {
> switch (cmd) {
> @@ -4113,6 +4287,10 @@ static long __f2fs_ioctl(struct file *filp, unsigned
> int cmd, unsigned long arg)
> return f2fs_ioc_get_compress_option(filp, arg);
> case F2FS_IOC_SET_COMPRESS_OPTION:
> return f2fs_ioc_set_compress_option(filp, arg);
> + case F2FS_IOC_DECOMPRESS_FILE:
> + return f2fs_ioc_decompress_file(filp, arg);
> + case F2FS_IOC_COMPRESS_FILE:
> + return f2fs_ioc_compress_file(filp, arg);
> default:
> return -ENOTTY;
> }
Where is the documentation and tests for these new ioctls?
- Eric