From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Dave Chinner <david@fromorbit.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Goldwyn Rodrigues <rgoldwyn@suse.de>
Subject: Re: [PATCH 06/12] iomap: Introduce read_inline() function hook
Date: Fri, 11 Oct 2024 11:28:42 +0800 [thread overview]
Message-ID: <381c349d-2eb7-419f-a2f8-a41ca6a9e9f0@linux.alibaba.com> (raw)
In-Reply-To: <Zwh0rzp8hpCoF/or@dread.disaster.area>
Hi Dave,
On 2024/10/11 08:43, Dave Chinner wrote:
> On Thu, Oct 10, 2024 at 02:10:25PM -0400, Goldwyn Rodrigues wrote:
...
>
> .... there is specific ordering needed.
>
> For writes, the ordering is:
>
> 1. pre-write data compression - requires data copy
> 2. pre-write data encryption - requires data copy
> 3. pre-write data checksums - data read only
> 4. write the data
> 5. post-write metadata updates
>
> We cannot usefully perform compression after encryption -
> random data doesn't compress - and the checksum must match what is
> written to disk, so it has to come after all other transformations
> have been done.
>
> For reads, the order is:
>
> 1. read the data
> 2. verify the data checksum
> 3. decrypt the data - requires data copy
> 4. decompress the data - requires data copy
> 5. place the plain text data in the page cache
Just random stuffs for for reference, currently fsverity makes
markle tree for the plain text, but from the on-disk data
security/authentication and integrity perspective, I guess the
order you mentioned sounds more saner to me, or:
1. read the data
2. pre-verify the encoded data checksum (optional,
dm-verity likewise way)
3. decrypt the data - requires data copy
4. decompress the data - requires data copy
5. post-verify the decoded (plain) checksum (optional)
6. place the plain text data in the page cache
2,5 may apply to different use cases though.
>
...
>
> Compression is where using xattrs gets interesting - the xattrs can
> have a fixed "offset" they blong to, but can store variable sized
> data records for that offset.
>
> If we say we have a 64kB compression block size, we can store the
> compressed data for a 64k block entirely in a remote xattr even if
> compression fails (i.e. we can store the raw data, not the expanded
> "compressed" data). The remote xattr can store any amount of smaller
> data, and we map the compressed data directly into the page cache at
> a high offset. Then decompression can run on the high offset pages
> with the destination being some other page cache offset....
but compressed data itself can also be multiple reference (reflink
likewise), so currently EROFS uses a seperate pseudo inode if it
decides with physical addresses as indexes.
>
> On the write side, compression can be done directly into the high
> offset page cache range for that 64kb offset range, then we can
> map that to a remote xattr block and write the xattr. The xattr
> naturally handles variable size blocks.
Also different from plain text, each compression fses may keep
different encoded data forms (e.g. fses could add headers or
trailers to the on-disk compressed data or add more informations
to extent metadata) for their own needs. So unlike the current
unique plain text process, an unique encoder/decoder may not sound
quite flexible though.
Thanks,
Gao Xiang
next prev parent reply other threads:[~2024-10-11 3:28 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 20:04 [PATCH 00/12] btrfs reads through iomap Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 01/12] iomap: check if folio size is equal to FS block size Goldwyn Rodrigues
2024-10-05 2:17 ` Matthew Wilcox
2024-10-07 16:57 ` Darrick J. Wong
2024-10-10 17:59 ` Goldwyn Rodrigues
2024-10-08 9:40 ` Christoph Hellwig
2024-10-04 20:04 ` [PATCH 02/12] iomap: Introduce iomap_read_folio_ops Goldwyn Rodrigues
2024-10-05 2:20 ` Matthew Wilcox
2024-10-07 17:01 ` Darrick J. Wong
2024-10-08 9:43 ` Christoph Hellwig
2024-10-04 20:04 ` [PATCH 03/12] iomap: add bioset in iomap_read_folio_ops for filesystems to use own bioset Goldwyn Rodrigues
2024-10-08 9:45 ` Christoph Hellwig
2024-10-10 17:51 ` Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 04/12] iomap: include iomap_read_end_io() in header Goldwyn Rodrigues
2024-10-07 17:02 ` Darrick J. Wong
2024-10-10 18:12 ` Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 05/12] iomap: Introduce IOMAP_ENCODED Goldwyn Rodrigues
2024-10-08 9:48 ` Christoph Hellwig
2024-10-10 9:42 ` Christoph Hellwig
2024-10-10 17:50 ` Goldwyn Rodrigues
2024-10-15 3:43 ` Ritesh Harjani
2024-10-04 20:04 ` [PATCH 06/12] iomap: Introduce read_inline() function hook Goldwyn Rodrigues
2024-10-05 2:30 ` Matthew Wilcox
2024-10-07 17:47 ` Darrick J. Wong
2024-10-10 18:10 ` Goldwyn Rodrigues
2024-10-11 0:43 ` Dave Chinner
2024-10-11 3:28 ` Gao Xiang [this message]
2024-10-11 4:52 ` Dave Chinner
2024-10-11 5:19 ` Gao Xiang
2024-10-04 20:04 ` [PATCH 07/12] btrfs: btrfs_em_to_iomap() to convert em to iomap Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 08/12] btrfs: iomap_begin() for buffered reads Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 09/12] btrfs: define btrfs_iomap_read_folio_ops Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 10/12] btrfs: define btrfs_iomap_folio_ops Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 11/12] btrfs: add read_inline for folio operations for read() calls Goldwyn Rodrigues
2024-10-04 20:04 ` [PATCH 12/12] btrfs: switch to iomap for buffered reads Goldwyn Rodrigues
2024-10-08 9:39 ` [PATCH 00/12] btrfs reads through iomap Christoph Hellwig
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=381c349d-2eb7-419f-a2f8-a41ca6a9e9f0@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rgoldwyn@suse.de \
--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
Powered by JetHome