mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phillip Lougher <phillip@squashfs.org.uk>
To: pangliyuan <pangliyuan1@huawei.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Cc: wangfangpeng1@huawei.com
Subject: Re: [PATCH] Squashfs: Dont allocate fragment caches more than fragments
Date: Sun, 15 Dec 2024 22:21:32 +0000	[thread overview]
Message-ID: <e5611a93-12ee-4f34-bbca-c9ad7c12baa5@squashfs.org.uk> (raw)
In-Reply-To: <20241210090842.160853-1-pangliyuan1@huawei.com>

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;

      reply	other threads:[~2024-12-15 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10  9:08 pangliyuan
2024-12-15 22:21 ` Phillip Lougher [this message]

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=e5611a93-12ee-4f34-bbca-c9ad7c12baa5@squashfs.org.uk \
    --to=phillip@squashfs.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pangliyuan1@huawei.com \
    --cc=wangfangpeng1@huawei.com \
    /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 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®