diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-10-23 22:48:09 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-11-04 20:34:11 -0500 |
commit | b3d208f96d6bb21247108a956dead6a028d5cdb2 (patch) | |
tree | 0adfa5781bae898208c62a94c6087322f16a94be /fs/f2fs/namei.c | |
parent | 1f7732fe6cc0c37befc74cef1d289cd2272b7a5c (diff) |
f2fs: revisit inline_data to avoid data races and potential bugs
This patch simplifies the inline_data usage with the following rule.
1. inline_data is set during the file creation.
2. If new data is requested to be written ranges out of inline_data,
f2fs converts that inode permanently.
3. There is no cases which converts non-inline_data inode to inline_data.
4. The inline_data flag should be changed under inode page lock.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r-- | fs/f2fs/namei.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index a004a978096f..6312dd2e53f7 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -55,6 +55,8 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) | |||
55 | goto out; | 55 | goto out; |
56 | } | 56 | } |
57 | 57 | ||
58 | if (f2fs_may_inline(inode)) | ||
59 | set_inode_flag(F2FS_I(inode), FI_INLINE_DATA); | ||
58 | if (test_opt(sbi, INLINE_DENTRY) && S_ISDIR(inode->i_mode)) | 60 | if (test_opt(sbi, INLINE_DENTRY) && S_ISDIR(inode->i_mode)) |
59 | set_inode_flag(F2FS_I(inode), FI_INLINE_DENTRY); | 61 | set_inode_flag(F2FS_I(inode), FI_INLINE_DENTRY); |
60 | 62 | ||
@@ -133,6 +135,7 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
133 | 135 | ||
134 | alloc_nid_done(sbi, ino); | 136 | alloc_nid_done(sbi, ino); |
135 | 137 | ||
138 | stat_inc_inline_inode(inode); | ||
136 | d_instantiate(dentry, inode); | 139 | d_instantiate(dentry, inode); |
137 | unlock_new_inode(inode); | 140 | unlock_new_inode(inode); |
138 | return 0; | 141 | return 0; |