[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230517071105.GA26233@lst.de>
Date: Wed, 17 May 2023 09:11:05 +0200
From: Christoph Hellwig <hch@....de>
To: Vincent Whitchurch <vincent.whitchurch@...s.com>
Cc: Phillip Lougher <phillip@...ashfs.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>, hch@....de,
linux-kernel@...r.kernel.org, squashfs-devel@...ts.sourceforge.net,
kernel@...s.com
Subject: Re: [PATCH v3] squashfs: cache partial compressed blocks
This looks generally good, but I have two more nitpicks (sorry for
beeing annoying):
> + struct inode *cache_inode = msblk->cache_inode;
> + struct address_space *cache_mapping = cache_inode ? cache_inode->i_mapping : NULL;
>
> + struct page *page = NULL;
> +
> + if (cache_mapping)
> + page = find_get_page(cache_mapping,
> + read_start + i * PAGE_SIZE);
Given we only ever use the cache inode mapping, I'd suggest to store
that in the super_block and the just use mapping->host for the iput
on unmount.
> + if (cache_mapping) {
> + /*
> + * Use the __ version to avoid merging since we need
> + * each page to be separate when we check for and avoid
> + * cached pages.
> + */
> + __bio_add_page(bio, page, len, offset);
> + } else if (!bio_add_page(bio, page, len, offset)) {
> error = -EIO;
> goto out_free_bio;
And given that random alloc_page pages are basically never mergable
we should be able to just use __bio_add_page here unconditionally.
Powered by blists - more mailing lists