From: Chao Yu <chao@kernel.org>
To: Daniel Rosenberg <drosen@google.com>,
linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>, kernel-team@android.com
Subject: Re: [f2fs-dev] [PATCH 2/3] f2fs-tools: Wait for Block Size to initialize Cache
Date: Mon, 27 Nov 2023 09:42:24 +0800 [thread overview]
Message-ID: <b68dfcda-5e30-d752-1539-e88db98949ee@kernel.org> (raw)
In-Reply-To: <20231118020309.1894531-3-drosen@google.com>
On 2023/11/18 10:03, Daniel Rosenberg wrote:
> 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.
Hi Daniel,
How about this? It be more explicit to indicate the logic?
---
fsck/mount.c | 2 ++
include/f2fs_fs.h | 3 +++
lib/libf2fs_io.c | 4 ++++
3 files changed, 9 insertions(+)
diff --git a/fsck/mount.c b/fsck/mount.c
index 72516f4..4dfb996 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1238,6 +1238,8 @@ int init_sb_info(struct f2fs_sb_info *sbi)
MSG(0, "Info: total FS sectors = %"PRIu64" (%"PRIu64" MB)\n",
total_sectors, total_sectors >>
(20 - get_sb(log_sectorsize)));
+
+ c.cache_config.blksize_initialized = true;
return 0;
}
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 6df2e73..e377d48 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -460,6 +460,9 @@ typedef struct {
unsigned max_hash_collision;
bool dbg_en;
+
+ /* whether blksize has been initialized */
+ bool blksize_initialized;
} dev_cache_config_t;
/* f2fs_configration for compression used for sload.f2fs */
diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 39d3777..bb77418 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -199,6 +199,10 @@ void dcache_init(void)
{
long n;
+ /* Must not initiate cache until block size is known */
+ if (!c.cache_config.blksize_initialized)
+ return;
+
if (c.cache_config.num_cache_entry <= 0)
return;
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2023-11-27 1:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-18 2:03 [f2fs-dev] [PATCH 0/3] F2FS Tools 16K Bug Fixes Daniel Rosenberg via Linux-f2fs-devel
2023-11-18 2:03 ` [f2fs-dev] [PATCH 1/3] f2fs-tools: Fix debug size print Daniel Rosenberg via Linux-f2fs-devel
2023-11-24 8:02 ` Chao Yu
2023-11-18 2:03 ` [f2fs-dev] [PATCH 2/3] f2fs-tools: Wait for Block Size to initialize Cache Daniel Rosenberg via Linux-f2fs-devel
2023-11-27 1:42 ` Chao Yu [this message]
2023-11-28 0:52 ` Daniel Rosenberg via Linux-f2fs-devel
2023-11-28 1:53 ` Chao Yu
2023-11-18 2:03 ` [f2fs-dev] [PATCH 3/3] f2fs-tools: Fix dqb_curspace to reflect blocksize Daniel Rosenberg via Linux-f2fs-devel
2023-11-27 1:42 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b68dfcda-5e30-d752-1539-e88db98949ee@kernel.org \
--to=chao@kernel.org \
--cc=drosen@google.com \
--cc=jaegeuk@kernel.org \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.