Linux filesystem development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] fscrypt: Change fscrypt_encrypt_pagecache_blocks() to take a folio
Date: Tue, 4 Mar 2025 18:15:57 -0800	[thread overview]
Message-ID: <20250305021557.GA20133@sol.localdomain> (raw)
In-Reply-To: <20250304170224.523141-1-willy@infradead.org>

On Tue, Mar 04, 2025 at 05:02:23PM +0000, Matthew Wilcox (Oracle) wrote:
> ext4 and ceph already have a folio to pass; f2fs needs to be properly
> converted but this will do for now.  This removes a reference
> to page->index and page->mapping as well as removing a call to
> compound_head().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> This is against next-20250304 and will have conflicts with the ceph tree
> if applied to mainline.  It might be easiest for Christian to carry it?

That's fine with me.

Acked-by: Eric Biggers <ebiggers@kernel.org>

> +struct page *fscrypt_encrypt_pagecache_blocks(struct folio *folio,
> +		size_t len, size_t offs, gfp_t gfp_flags)
>  {
> -	const struct inode *inode = page->mapping->host;
> +	const struct inode *inode = folio->mapping->host;
>  	const struct fscrypt_inode_info *ci = inode->i_crypt_info;
>  	const unsigned int du_bits = ci->ci_data_unit_bits;
>  	const unsigned int du_size = 1U << du_bits;
>  	struct page *ciphertext_page;
> -	u64 index = ((u64)page->index << (PAGE_SHIFT - du_bits)) +
> +	u64 index = ((u64)folio->index << (PAGE_SHIFT - du_bits)) +
>  		    (offs >> du_bits);
>  	unsigned int i;

'i' should be changed to size_t to match len and offs.

>  	int err;
>  
> -	if (WARN_ON_ONCE(!PageLocked(page)))
> +	VM_BUG_ON_FOLIO(folio_test_large(folio), folio);
> +	if (WARN_ON_ONCE(!folio_test_locked(folio)))
>  		return ERR_PTR(-EINVAL);

I'm not sure you considered using VM_WARN_ON_ONCE_FOLIO() here?  TBH I'm fine
with BUG_ON, but sometimes people complain about it.  That's why fs/crypto/
sticks to WARN_ON_ONCE these days.

- Eric

  reply	other threads:[~2025-03-05  2:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 17:02 [PATCH v2] fscrypt: Change fscrypt_encrypt_pagecache_blocks() to take a folio Matthew Wilcox (Oracle)
2025-03-05  2:15 ` Eric Biggers [this message]
2025-03-05 11:57 ` Christian Brauner

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=20250305021557.GA20133@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=brauner@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=willy@infradead.org \
    /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