mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, chao@kernel.org
Subject: Re: [PATCH 2/4] f2fs: support FIEMAP_FLAG_CACHE
Date: Tue, 9 Jan 2018 11:20:01 -0800	[thread overview]
Message-ID: <20180109192001.GC86686@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <20180108104834.108983-2-yuchao0@huawei.com>

On 01/08, Chao Yu wrote:
> This patch factors out f2fs_precache_extents from
> f2fs_ioc_precache_extents, with the new function we can support
> FIEMAP_FLAG_CACHE in ->fiemap.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/data.c | 12 +++++++++---
>  fs/f2fs/f2fs.h |  1 +
>  fs/f2fs/file.c | 10 +++++++---
>  3 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index f38e660bc889..33ae1bd14a8e 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1228,11 +1228,17 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
>  	u32 flags = 0;
>  	int ret = 0;
>  
> +	inode_lock(inode);
> +
> +	if (fieinfo->fi_flags & FIEMAP_FLAG_CACHE) {
> +		ret = f2fs_precache_extents(inode);
> +		if (ret)
> +			goto out;
> +	}

I think we have to integrate this patch into the previous one which defines
this new behavior.

Thanks,

> +
>  	ret = fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR);
>  	if (ret)
> -		return ret;
> -
> -	inode_lock(inode);
> +		goto out;
>  
>  	if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) {
>  		ret = f2fs_xattr_fiemap(inode, fieinfo);
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 14177cebc3e7..3c3a055c3d4a 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2543,6 +2543,7 @@ int f2fs_getattr(const struct path *path, struct kstat *stat,
>  int f2fs_setattr(struct dentry *dentry, struct iattr *attr);
>  int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end);
>  void truncate_data_blocks_range(struct dnode_of_data *dn, int count);
> +int f2fs_precache_extents(struct inode *inode);
>  long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
>  long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
>  int f2fs_pin_file_control(struct inode *inode, bool inc);
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 14e75871acf3..6e30016f26ad 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -2734,9 +2734,8 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
>  	return ret;
>  }
>  
> -static int f2fs_ioc_precache_extents(struct file *filp, unsigned long arg)
> +int f2fs_precache_extents(struct inode *inode)
>  {
> -	struct inode *inode = file_inode(filp);
>  	struct f2fs_inode_info *fi = F2FS_I(inode);
>  	struct f2fs_map_blocks map;
>  	pgoff_t next_pgofs;
> @@ -2763,7 +2762,12 @@ static int f2fs_ioc_precache_extents(struct file *filp, unsigned long arg)
>  		map.m_lblk = next_pgofs;
>  	}
>  
> -	return 0;
> +	return err;
> +}
> +
> +static int f2fs_ioc_precache_extents(struct file *filp, unsigned long arg)
> +{
> +	return f2fs_precache_extents(file_inode(filp));
>  }
>  
>  long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> -- 
> 2.15.0.55.gc2ece9dc4de6

  reply	other threads:[~2018-01-09 19:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 10:48 [PATCH 1/4] f2fs: support F2FS_IOC_PRECACHE_EXTENTS Chao Yu
2018-01-08 10:48 ` [PATCH 2/4] f2fs: support FIEMAP_FLAG_CACHE Chao Yu
2018-01-09 19:20   ` Jaegeuk Kim [this message]
2018-01-08 10:48 ` [PATCH 3/4] f2fs: avoid high cpu usage in discard thread Chao Yu
2018-01-08 10:48 ` [PATCH 4/4] f2fs: remove unused pend_list_tag Chao Yu
2018-01-09 19:07 ` [PATCH 1/4] f2fs: support F2FS_IOC_PRECACHE_EXTENTS Jaegeuk Kim
2018-01-09 20:43   ` Jaegeuk Kim
2018-01-10  6:22     ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109192001.GC86686@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®