linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: guoweichao@huawei.com, jaegeuk@kernel.org
Cc: heyunlei@huawei.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] f2fs: convert inline data for direct I/O & FI_NO_PREALLOC
Date: Fri, 29 Sep 2017 22:27:16 +0800	[thread overview]
Message-ID: <facc854f-e747-5211-75f2-a54acdfe76c6@kernel.org> (raw)
In-Reply-To: <20170929144323.170386-1-guoweichao@huawei.com>

On 2017/9/29 22:43, guoweichao@huawei.com wrote:
> From: Weichao Guo <guoweichao@huawei.com>
> 
> In FI_NO_PREALLOC cases, direct I/O path may allocate blocks for an
> inode but keep its inline data flag. This inconsistency may trigger
> vfs clear_inode nrpages bug_on when evicting the inode. We should
> convert inline data first in this case.
> 
> Signed-off-by: Weichao Guo <guoweichao@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

> ---
>  fs/f2fs/data.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 36b5352..3793ba4 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -833,6 +833,13 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
>  	struct f2fs_map_blocks map;
>  	int err = 0;
>  
> +	/* convert inline data for Direct I/O*/
> +	if (iocb->ki_flags & IOCB_DIRECT) {
> +		err = f2fs_convert_inline_inode(inode);
> +		if (err)
> +			return err;
> +	}
> +
>  	if (is_inode_flag_set(inode, FI_NO_PREALLOC))
>  		return 0;
>  
> @@ -845,15 +852,11 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
>  
>  	map.m_next_pgofs = NULL;
>  
> -	if (iocb->ki_flags & IOCB_DIRECT) {
> -		err = f2fs_convert_inline_inode(inode);
> -		if (err)
> -			return err;
> +	if (iocb->ki_flags & IOCB_DIRECT)
>  		return f2fs_map_blocks(inode, &map, 1,
>  			__force_buffered_io(inode, WRITE) ?
>  				F2FS_GET_BLOCK_PRE_AIO :
>  				F2FS_GET_BLOCK_PRE_DIO);
> -	}
>  	if (iocb->ki_pos + iov_iter_count(from) > MAX_INLINE_DATA(inode)) {
>  		err = f2fs_convert_inline_inode(inode);
>  		if (err)
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

      reply	other threads:[~2017-09-29 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29 14:43 [PATCH v2] f2fs: convert inline data for direct I/O & FI_NO_PREALLOC guoweichao
2017-09-29 14:27 ` Chao Yu [this message]

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=facc854f-e747-5211-75f2-a54acdfe76c6@kernel.org \
    --to=chao@kernel.org \
    --cc=guoweichao@huawei.com \
    --cc=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).