If seed is not set, rand always uses 1 as the default seed.

Signed-off-by: Liu Xue <liuxueliu....@huawei.com>
Signed-off-by: Sheng Yong <shengyo...@huawei.com>
---
 mkfs/f2fs_format.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index a130001..9d7e180 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -574,6 +574,7 @@ static int f2fs_write_check_point_pack(void)
        }
 
        /* 1. cp page 1 of checkpoint pack 1 */
+       srand(time(NULL));
        cp->checkpoint_ver = cpu_to_le64(rand() | 0x1);
        set_cp(cur_node_segno[0], c.cur_seg[CURSEG_HOT_NODE]);
        set_cp(cur_node_segno[1], c.cur_seg[CURSEG_WARM_NODE]);
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to