mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Baokun Li <libaokun@linux.alibaba.com>
Cc: linux-fscrypt@vger.kernel.org, jaegeuk@kernel.org, tytso@mit.edu,
	linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca,
	jack@suse.cz, yi.zhang@huawei.com, ojaswin@linux.ibm.com,
	ritesh.list@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] fscrypt: Cap data units at the page size
Date: Tue, 3 Nov 2026 14:40:06 -0800	[thread overview]
Message-ID: <20261103224006.GC2281@quark> (raw)
In-Reply-To: <20261103153132.4154855-2-libaokun@linux.alibaba.com>

On Tue, Nov 03, 2026 at 11:31:29PM +0800, Baokun Li wrote:
> diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
> index e602c31b3844..0dc158563e71 100644
> --- a/fs/crypto/fscrypt_private.h
> +++ b/fs/crypto/fscrypt_private.h
> @@ -203,7 +203,9 @@ static inline int
>  fscrypt_policy_v2_du_bits(const struct fscrypt_policy_v2 *policy,
>  			  const struct inode *inode)
>  {
> -	return policy->log2_data_unit_size ?: inode->i_blkbits;
> +	if (policy->log2_data_unit_size)
> +		return policy->log2_data_unit_size;
> +	return min_t(unsigned int, inode->i_blkbits, PAGE_SHIFT);
>  }

This would make the interpretation of the default value
log2_data_unit_size=0 depend on the page size, which (unlike i_blkbits)
is not part of the filesystem's on-disk format.

I think that for a sub-block data unit size to be used, it should need
to continue to be explicitly specified.  Otherwise the default would
become ambiguous.

- Eric

  reply	other threads:[~2026-11-03 22:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:31 [PATCH 0/4] ext4: support encryption with block size larger than " Baokun Li
2026-11-03 15:31 ` [PATCH 1/4] fscrypt: Cap data units at the " Baokun Li
2026-11-03 22:40   ` Eric Biggers [this message]
2026-11-03 15:31 ` [PATCH 2/4] fscrypt: Validate the test_dummy_encryption policy for new inodes Baokun Li
2026-11-03 15:31 ` [PATCH 3/4] ext4: don't put a DUN wraparound in the middle of a read bio Baokun Li
2026-11-03 15:31 ` [PATCH 4/4] ext4: allow large folios and bs > ps encryption Baokun Li

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=20261103224006.GC2281@quark \
    --to=ebiggers@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@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®