Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280543

[PATCH] f2fs: fix to convert inline inode in ->setattr

From Chao Yu <chao2.yu@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] f2fs: fix to convert inline inode in ->setattr
Date 2015-12-01 04:40 +0100
Message-ID <qAJXj-4df-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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;
+			}
 			inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		}
 	}
-- 
2.6.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] f2fs: fix to convert inline inode in ->setattr Chao Yu <chao2.yu@samsung.com> - 2015-12-01 04:40 +0100
  Re: [PATCH] f2fs: fix to convert inline inode in ->setattr Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-04 22:00 +0100
    Re: [f2fs-dev] [PATCH] f2fs: fix to convert inline inode in ->setattr Jaegeuk Kim <jaegeuk@kernel.org> - 2015-12-04 22:20 +0100

csiph-web