linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: fix to convert inline inode in ->setattr
Date: Fri, 4 Dec 2015 12:55:23 -0800	[thread overview]
Message-ID: <20151204205523.GA73158@jaegeuk.local> (raw)
In-Reply-To: <000001d12be9$87054960$950fdc20$@samsung.com>

Hi Chao,

On Tue, Dec 01, 2015 at 11:36:16AM +0800, Chao Yu wrote:
> In commit 3c4541452748 ("f2fs: do not trim preallocated blocks when
> truncating after i_size"), in order to follow the regulation: "truncate(x)
> where x > i_size will not trim all blocks past i_size." like other file
> systems, in ->setattr we invoked truncate_setsize instead of f2fs_truncate
> to avoid unneeded block trimming in such case, but forgot to call
> f2fs_convert_inline_inode keep consistency of inline data conversion rule.
> 
> This patch fixes to convert inline data if necessary.
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
>  fs/f2fs/file.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 96e4e04..a018ed3 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -686,6 +686,14 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
>  			 * larger than i_size.
>  			 */
>  			truncate_setsize(inode, attr->ia_size);
> +
> +			/* should convert inline inode here */
> +			if (f2fs_has_inline_data(inode) &&
> +					!f2fs_may_inline_data(inode)) {
> +				err = f2fs_convert_inline_inode(inode);
> +				if (err)
> +					return err;
> +			}

Without this, f2fs handles correctly inline_data when user tries to write
something later, right?

One corner case is:
if the partiton is filled up to 100% with data + inline_data, we cannot truncate
one of inline_data after merging this patch.
Cause it failed to convert it.

Thanks,

>  			inode->i_mtime = inode->i_ctime = CURRENT_TIME;
>  		}
>  	}
> -- 
> 2.6.3
> 

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140

  reply	other threads:[~2015-12-04 20:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01  3:36 [PATCH] f2fs: fix to convert inline inode in ->setattr Chao Yu
2015-12-04 20:55 ` Jaegeuk Kim [this message]
2015-12-04 21:18   ` [f2fs-dev] " Jaegeuk Kim

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=20151204205523.GA73158@jaegeuk.local \
    --to=jaegeuk@kernel.org \
    --cc=chao2.yu@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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).