diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-05-07 20:28:52 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-05-31 11:31:50 -0700 |
commit | 1c41e6808e69564bbd44d71687916151b9c63df1 (patch) | |
tree | 0e0b6d0566ebaab2a954f196baad4cd0df99619a /fs/f2fs/namei.c | |
parent | 299254d85dec4ac0515a14e6d96ff70841302719 (diff) | |
download | lwn-1c41e6808e69564bbd44d71687916151b9c63df1.tar.gz lwn-1c41e6808e69564bbd44d71687916151b9c63df1.zip |
f2fs: fix to initialize i_current_depth according to inode type
i_current_depth is used only for directory inode, but its space is
shared with i_gc_failures field used for regular inode, in order to
avoid affecting i_gc_failures' value, this patch fixes to initialize
the union's fields according to inode type.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
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 fef6e3ab2135..bcfc4219b29e 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -54,6 +54,9 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) F2FS_I(inode)->i_crtime = current_time(inode); inode->i_generation = sbi->s_next_generation++; + if (S_ISDIR(inode->i_mode)) + F2FS_I(inode)->i_current_depth = 1; + err = insert_inode_locked(inode); if (err) { err = -EINVAL; |