summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/namei.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2019-02-25 09:46:45 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-03-12 18:59:18 -0700
commit428e3bcf07696ff252b7ff3ff7711c2b9bbdb908 (patch)
treeac45ae40c6165175976cc197c5b4e201ca9df644 /fs/f2fs/namei.c
parent613f3dcdf0d8ffdb3e5d820f6d69076905efddc3 (diff)
downloadlinux-stable-428e3bcf07696ff252b7ff3ff7711c2b9bbdb908.tar.gz
linux-stable-428e3bcf07696ff252b7ff3ff7711c2b9bbdb908.tar.bz2
linux-stable-428e3bcf07696ff252b7ff3ff7711c2b9bbdb908.zip
f2fs: give random value to i_generation
This follows to give random number to i_generation along with commit 232530680290b ("ext4: improve smp scalability for inode generation") This can be used for DUN for UFS HW encryption. Reviewed-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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 62d9829f3a6a..f218d9424d8b 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -10,6 +10,7 @@
#include <linux/pagemap.h>
#include <linux/sched.h>
#include <linux/ctype.h>
+#include <linux/random.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/quotaops.h>
@@ -50,7 +51,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
F2FS_I(inode)->i_crtime = inode->i_mtime;
- inode->i_generation = sbi->s_next_generation++;
+ inode->i_generation = prandom_u32();
if (S_ISDIR(inode->i_mode))
F2FS_I(inode)->i_current_depth = 1;