* [PATCH] Squashfs: Dont allocate fragment caches more than fragments
@ 2024-12-10 9:08 pangliyuan
2024-12-15 22:21 ` Phillip Lougher
0 siblings, 1 reply; 2+ messages in thread
From: pangliyuan @ 2024-12-10 9:08 UTC (permalink / raw)
To: linux-kernel, phillip; +Cc: wangfangpeng1
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@huawei.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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Squashfs: Dont allocate fragment caches more than fragments
2024-12-10 9:08 [PATCH] Squashfs: Dont allocate fragment caches more than fragments pangliyuan
@ 2024-12-15 22:21 ` Phillip Lougher
0 siblings, 0 replies; 2+ messages in thread
From: Phillip Lougher @ 2024-12-15 22:21 UTC (permalink / raw)
To: pangliyuan, linux-kernel, Andrew Morton; +Cc: wangfangpeng1
On 10/12/2024 09:08, pangliyuan wrote:
> 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@huawei.com>
A small but useful optimisation.
Reviewed-by: Phillip Lougher <phillip@squashfs.org.uk>
> ---
> 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-15 22:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-10 9:08 [PATCH] Squashfs: Dont allocate fragment caches more than fragments pangliyuan
2024-12-15 22:21 ` Phillip Lougher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®