[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241210090842.160853-1-pangliyuan1@huawei.com>
Date: Tue, 10 Dec 2024 17:08:42 +0800
From: pangliyuan <pangliyuan1@...wei.com>
To: <linux-kernel@...r.kernel.org>, <phillip@...ashfs.org.uk>
CC: <wangfangpeng1@...wei.com>
Subject: [PATCH] Squashfs: Dont allocate fragment caches more than fragments
Sometimes the actual number of fragments in image is between
0 and SQUASHFS_CACHED_FRAGMENTS, which cause additional
fragment caches to be allocated.
Sets the number of fragment caches to the minimum of fragments
and SQUASHFS_CACHED_FRAGMENTS.
Signed-off-by: pangliyuan <pangliyuan1@...wei.com>
---
fs/squashfs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 22e812808e5c..269c6d61bc29 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -405,7 +405,7 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
goto check_directory_table;
msblk->fragment_cache = squashfs_cache_init("fragment",
- SQUASHFS_CACHED_FRAGMENTS, msblk->block_size);
+ min(SQUASHFS_CACHED_FRAGMENTS, fragments), msblk->block_size);
if (msblk->fragment_cache == NULL) {
err = -ENOMEM;
goto failed_mount;
--
2.37.7
Powered by blists - more mailing lists