All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Baokun Li" <libaokun@linux.alibaba.com>
Cc: tytso@mit.edu, linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 06/13] blk-crypto: support data units larger than a page
Date: Sun, 11 Oct 2026 17:27:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-167350@kernel.org> (raw)
In-Reply-To: <20261011170958.1759230-7-libaokun@linux.alibaba.com>

> blk-crypto-fallback requires each data unit to be contained in a single
> bio_vec, and fails a bio with a larger data unit with BLK_STS_INVAL.
> fscrypt uses the filesystem block size as its data unit size, so
> encrypted files are unusable on filesystems with a block size larger
> than the page size; the write failure is silent and loses the data.
> 
> Since commit 5acc6f649a68 ("fscrypt: Always use blk-crypto for
> contents on block-based filesystems") there is no fs-layer path left.
> Fix this by describing a data unit by one bio_vec per page: data units
> that fit keep using the bio_vec and the scatterlists in the data unit
> context, and larger ones get arrays from the new blk_crypto_du_ctx_pool.
> 
> The pool is a mempool backed by a dedicated slab cache, as kmalloc()
> would round the element size up to the next power of two.  It is set
> up when a key with such a data unit size is first used, and one array
> is reused for all data units of a bio.
> 
> A data unit must start at a data unit boundary (a page boundary for a
> larger one), and the accepted data unit sizes grow to the number of
> pages that fit in one encrypted bio, rounded down to a power of two.
> An encrypted bio can run out of room before the source bio ends; free
> its unused bounce pages with the new blk_crypto_free_enc_pages().
> 
> One crypto request per data unit is kept, so the ciphertext of data
> units that fit in a page is unchanged, and larger data units produce
> the same ciphertext as inline encryption hardware.
> 
> Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011170958.1759230-1-libaokun@linux.alibaba.com?part=6


  reply	other threads:[~2026-10-11 17:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 17:09 [PATCH 00/13] block, ext4: allow encryption with a block size larger than the page size Baokun Li
2026-10-11 17:09 ` [PATCH 01/13] ext4: refuse encryption when block size > " Baokun Li
2026-10-11 17:26   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 02/13] ext4: reject encrypted inodes " Baokun Li
2026-10-11 17:16   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 03/13] blk-crypto: reject fallback data unit sizes it can't handle Baokun Li
2026-10-11 17:20   ` sashiko-bot
2026-10-12  7:50     ` Baokun Li
2026-10-11 17:09 ` [PATCH 04/13] blk-crypto: decrypt one data unit per crypto request Baokun Li
2026-10-11 17:19   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 05/13] blk-crypto: encrypt " Baokun Li
2026-10-11 17:26   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 06/13] blk-crypto: support data units larger than a page Baokun Li
2026-10-11 17:27   ` sashiko-bot [this message]
2026-10-11 17:09 ` [PATCH 07/13] iomap: align the direct I/O bios of encrypted files to the block size Baokun Li
2026-10-11 17:25   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 08/13] block: split encrypted bios at data unit boundaries Baokun Li
2026-10-11 17:20   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 09/13] block: warn about bios that can't be split Baokun Li
2026-10-11 17:18   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 10/13] block: don't require data unit aligned bio_vecs for encrypted bios Baokun Li
2026-10-11 17:24   ` sashiko-bot
2026-10-12  8:09     ` Baokun Li
2026-10-11 17:09 ` [PATCH 11/13] ext4: allow encryption with a block size larger than the page size Baokun Li
2026-10-11 17:30   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 12/13] ext4: send folios that cover a wraparound to the buffer_head path Baokun Li
2026-10-11 17:22   ` sashiko-bot
2026-10-11 17:09 ` [PATCH 13/13] ext4: allow large folios for encrypted files Baokun Li
2026-10-11 17:23   ` sashiko-bot

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=sashiko-outbox-167350@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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.