[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1415926774-49230-3-git-send-email-jaegeuk@kernel.org>
Date: Thu, 13 Nov 2014 16:59:34 -0800
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@...nel.org>
Subject: [PATCH 3/3] f2fs: convert inline_data when i_size becomes large
If i_size becomes large outside of MAX_INLINE_DATA, we shoud convert the inode.
Otherwise, we can make some dirty pages during the truncation, and those pages
will be written through f2fs_write_data_page.
At that moment, the inode has still inline_data, so that it tries to write non-
zero pages into inline_data area.
Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
---
fs/f2fs/file.c | 6 ++++++
fs/f2fs/inline.c | 3 +++
2 files changed, 9 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index edc3ce8..7c2ec3e 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -522,6 +522,12 @@ void f2fs_truncate(struct inode *inode)
trace_f2fs_truncate(inode);
+ /* we should check inline_data size */
+ if (f2fs_has_inline_data(inode) && !f2fs_may_inline(inode)) {
+ if (f2fs_convert_inline_inode(inode))
+ return;
+ }
+
if (!truncate_blocks(inode, i_size_read(inode), true)) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
mark_inode_dirty(inode);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 2310670..053d114 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -24,6 +24,9 @@ bool f2fs_may_inline(struct inode *inode)
if (!S_ISREG(inode->i_mode))
return false;
+ if (i_size_read(inode) > MAX_INLINE_DATA)
+ return false;
+
return true;
}
--
2.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists