All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: Phillip Lougher <phillip@squashfs.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	hch@lst.de, linux-kernel@vger.kernel.org,
	squashfs-devel@lists.sourceforge.net, kernel@axis.com
Subject: Re: [PATCH v3] squashfs: cache partial compressed blocks
Date: Wed, 17 May 2023 09:11:05 +0200	[thread overview]
Message-ID: <20230517071105.GA26233@lst.de> (raw)
In-Reply-To: <20230510-squashfs-cache-v3-1-9f56ffd43f03@axis.com>

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.

      parent reply	other threads:[~2023-05-17  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16  8:22 [PATCH v3] squashfs: cache partial compressed blocks Vincent Whitchurch
2023-05-16 19:17 ` Phillip Lougher
2023-05-17  7:11 ` Christoph Hellwig [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=20230517071105.GA26233@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillip@squashfs.org.uk \
    --cc=squashfs-devel@lists.sourceforge.net \
    --cc=vincent.whitchurch@axis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.