[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a2af52b-f8cc-7118-2d08-44bcba1b8fd4@squashfs.org.uk>
Date: Wed, 17 May 2023 18:48:58 +0100
From: Phillip Lougher <phillip@...ashfs.org.uk>
To: Vincent Whitchurch <vincent.whitchurch@...s.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: hch@....de, linux-kernel@...r.kernel.org,
squashfs-devel@...ts.sourceforge.net, kernel@...s.com
Subject: Re: [PATCH v4] squashfs: cache partial compressed blocks
On 17/05/2023 15:18, Vincent Whitchurch wrote:
> Before commit 93e72b3c612adcaca1 ("squashfs: migrate from ll_rw_block
> usage to BIO"), compressed blocks read by squashfs were cached in the
> page cache, but that is not the case after that commit. That has lead
> to squashfs having to re-read a lot of sectors from disk/flash.
>
> For example, the first sectors of every metadata block need to be read
> twice from the disk. Once partially to read the length, and a
> second time to read the block itself. Also, in linear reads of large
> files, the last sectors of one data block are re-read from disk when
> reading the next data block, since the compressed blocks are of variable
> sizes and not aligned to device blocks. This extra I/O results in a
> degrade in read performance of, for example, ~16% in one scenario on my
> ARM platform using squashfs with dm-verity and NAND.
>
> Since the decompressed data is cached in the page cache or squashfs'
> internal metadata and fragment caches, caching _all_ compressed pages
> would lead to a lot of double caching and is undesirable. But make the
> code cache any disk blocks which were only partially requested, since
> these are the ones likely to include data which is needed by other file
> system blocks. This restores read performance in my test scenario.
>
> The compressed block caching is only applied when the disk block size is
> equal to the page size, to avoid having to deal with caching sub-page
> reads.
>
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
Reviewed-by: Phillip Lougher <phillip@...ashfs.org.uk>
Powered by blists - more mailing lists