The cache is initialized during the first read, however, it requires the
block size to establish its buffer. This disables the cache until the
block size is known.

Signed-off-by: Daniel Rosenberg <dro...@google.com>
---
 fsck/mount.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fsck/mount.c b/fsck/mount.c
index 72516f4..658e601 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -3860,8 +3860,12 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi)
 {
        struct f2fs_checkpoint *cp = NULL;
        struct f2fs_super_block *sb = NULL;
+       int num_cache_entry = c.cache_config.num_cache_entry;
        int ret;
 
+       /* Must not initiate cache until block size is known */
+       c.cache_config.num_cache_entry = 0;
+
        sbi->active_logs = NR_CURSEG_TYPE;
        ret = validate_super_block(sbi, SB0_ADDR);
        if (ret) {
@@ -3881,6 +3885,7 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi)
                }
        }
        sb = F2FS_RAW_SUPER(sbi);
+       c.cache_config.num_cache_entry = num_cache_entry;
 
        ret = check_sector_size(sb);
        if (ret)
-- 
2.43.0.rc0.421.g78406f8d94-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to