From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Daeho Jeong <daeho43@gmail.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: Re: [f2fs-dev] [PATCH v2 18/20] f2fs: support subpage blocks in compression
Date: Wed, 18 Nov 2026 10:29:54 +0800 [thread overview]
Message-ID: <00565d3e-c508-4764-8587-327c874adcc7@kernel.org> (raw)
In-Reply-To: <20261116040851.2849696-19-daeho43@gmail.com>
On 11/16/26 12:08, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> With subpage blocks, a cluster spans fewer folios than blocks, and
> several compressed blocks share a bounce folio.
>
> - Require a cluster to cover at least one page. This raises the minimum
> compress_log_size only when a page has more than four blocks, e.g. to
> 64KB for 4KB blocks on a 64KB page kernel, where the mount option and
> F2FS_IOC_SET_COMPRESS_OPTION reject a smaller one. A file that already
> has a smaller cluster is handled like one with an unsupported
> compression algorithm: it can be looked up and removed, but opening it
> fails with -EOPNOTSUPP.
> - Use block offsets and sizes for compressed data, keep each compressed
> block at its block offset within the cluster, and count pending
> compressed I/O in blocks so that a shared bounce folio is not
> decompressed or freed early.
> - Submit only the written block of a shared bounce folio in
> f2fs_submit_page_write(), at its offset in the folio.
> - Keep compressed files on the page based read and write paths, and
> compress a cluster only when all of its blocks are dirty and below
> EOF.
> - A folio with per-block state may hold uptodate blocks newer than the
> on-disk cluster, so decompress into a bounce page and copy back only
> the blocks that are not uptodate.
> - Cache compressed blocks one block at a time in the compress cache.
> - Lock only the unlocked pages in cancel_cluster_writeback() to avoid a
> self-deadlock.
> - Attach a folio state to the multi-block folios of a rewritten cluster
> before they are dirtied, as the other write paths do.
> - Attach a folio state to multi-block folios that have none when
> compressed writeback starts, as the raw write path does. Otherwise the
> write completion, which does not hold the folio lock, can detach the
> page private flags while a task is moving them into a new folio state.
> - Take sbi from the dic to count the blocks of a compressed page in
> f2fs_finish_read_bio().
> - Write the blocks of a multi-block folio in
> f2fs_write_single_data_page() as f2fs_write_cache_folios() does,
> taking the write_blocks_pending bias with a new helper shared by the
> two and dropping it with f2fs_ffs_put_write_pending().
> - Count a read folio of a compressed file once in the iostat:
> f2fs_mpage_readpages() counts the folios that go through its loop,
> and f2fs_read_data_large_folio() counts the others.
> - Remove the -EOPNOTSUPP checks.
> - Remove inode_inc_dirty_block() and inode_dec_dirty_block(), which
> have no caller left.
>
> The bounce folios are now freed when the last block of a cluster
> completes, also when the block size equals PAGE_SIZE.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
One minor comment below:
> @@ -4277,6 +4354,46 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
>
> folio_zero_segment(folio, offset, folio_size(folio));
> write:
> + if (f2fs_is_multiblock_folio(sbi, folio)) {
> + struct f2fs_lock_context lc;
> + unsigned int to_blk = f2fs_blocks_per_folio(sbi, folio);
> + u64 pos = folio_pos(folio);
> +
> + if (!compr_blocks && !f2fs_verity_in_progress(inode))
> + to_blk = min_t(unsigned int,
> + F2FS_BLK_ALIGN(sbi, i_size - pos),
> + to_blk);
> +
> + /* Deadlock due to between page->lock and f2fs_lock_op */
> + if (!compr_blocks && !f2fs_trylock_op(sbi, &lc)) {
> + err = -EAGAIN;
> + goto redirty_out;
> + }
> +
> + folio_start_writeback(folio);
> + f2fs_folio_get_write_bias(folio, F2FS_BLK_TO_BYTES(sbi, to_blk));
> +
> + err = f2fs_write_folio_dirty_range(folio, &local_submitted,
> + wbc, io_type, pos,
> + pos + F2FS_BLK_TO_BYTES(sbi, to_blk),
> + compr_blocks);
> +
> + if (!compr_blocks)
> + f2fs_unlock_op(sbi, &lc);
> +
> + /* The callers drop the submitted count on error. */
> + if (err && local_submitted)
> + f2fs_submit_merged_write_cond(sbi, NULL, folio);
We'd better clean up this if this is not a bug fix.
I think we can pass local_submitted to @submitted_p in f2fs_write_raw_pages() before
its error handling, so that its caller (f2fs_write_cache_pages()) can flush the bio
cache.
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: Daeho Jeong <daeho43@gmail.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: chao@kernel.org, Daeho Jeong <daehojeong@google.com>
Subject: Re: [f2fs-dev] [PATCH v2 18/20] f2fs: support subpage blocks in compression
Date: Wed, 18 Nov 2026 10:29:54 +0800 [thread overview]
Message-ID: <00565d3e-c508-4764-8587-327c874adcc7@kernel.org> (raw)
In-Reply-To: <20261116040851.2849696-19-daeho43@gmail.com>
On 11/16/26 12:08, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> With subpage blocks, a cluster spans fewer folios than blocks, and
> several compressed blocks share a bounce folio.
>
> - Require a cluster to cover at least one page. This raises the minimum
> compress_log_size only when a page has more than four blocks, e.g. to
> 64KB for 4KB blocks on a 64KB page kernel, where the mount option and
> F2FS_IOC_SET_COMPRESS_OPTION reject a smaller one. A file that already
> has a smaller cluster is handled like one with an unsupported
> compression algorithm: it can be looked up and removed, but opening it
> fails with -EOPNOTSUPP.
> - Use block offsets and sizes for compressed data, keep each compressed
> block at its block offset within the cluster, and count pending
> compressed I/O in blocks so that a shared bounce folio is not
> decompressed or freed early.
> - Submit only the written block of a shared bounce folio in
> f2fs_submit_page_write(), at its offset in the folio.
> - Keep compressed files on the page based read and write paths, and
> compress a cluster only when all of its blocks are dirty and below
> EOF.
> - A folio with per-block state may hold uptodate blocks newer than the
> on-disk cluster, so decompress into a bounce page and copy back only
> the blocks that are not uptodate.
> - Cache compressed blocks one block at a time in the compress cache.
> - Lock only the unlocked pages in cancel_cluster_writeback() to avoid a
> self-deadlock.
> - Attach a folio state to the multi-block folios of a rewritten cluster
> before they are dirtied, as the other write paths do.
> - Attach a folio state to multi-block folios that have none when
> compressed writeback starts, as the raw write path does. Otherwise the
> write completion, which does not hold the folio lock, can detach the
> page private flags while a task is moving them into a new folio state.
> - Take sbi from the dic to count the blocks of a compressed page in
> f2fs_finish_read_bio().
> - Write the blocks of a multi-block folio in
> f2fs_write_single_data_page() as f2fs_write_cache_folios() does,
> taking the write_blocks_pending bias with a new helper shared by the
> two and dropping it with f2fs_ffs_put_write_pending().
> - Count a read folio of a compressed file once in the iostat:
> f2fs_mpage_readpages() counts the folios that go through its loop,
> and f2fs_read_data_large_folio() counts the others.
> - Remove the -EOPNOTSUPP checks.
> - Remove inode_inc_dirty_block() and inode_dec_dirty_block(), which
> have no caller left.
>
> The bounce folios are now freed when the last block of a cluster
> completes, also when the block size equals PAGE_SIZE.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
One minor comment below:
> @@ -4277,6 +4354,46 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
>
> folio_zero_segment(folio, offset, folio_size(folio));
> write:
> + if (f2fs_is_multiblock_folio(sbi, folio)) {
> + struct f2fs_lock_context lc;
> + unsigned int to_blk = f2fs_blocks_per_folio(sbi, folio);
> + u64 pos = folio_pos(folio);
> +
> + if (!compr_blocks && !f2fs_verity_in_progress(inode))
> + to_blk = min_t(unsigned int,
> + F2FS_BLK_ALIGN(sbi, i_size - pos),
> + to_blk);
> +
> + /* Deadlock due to between page->lock and f2fs_lock_op */
> + if (!compr_blocks && !f2fs_trylock_op(sbi, &lc)) {
> + err = -EAGAIN;
> + goto redirty_out;
> + }
> +
> + folio_start_writeback(folio);
> + f2fs_folio_get_write_bias(folio, F2FS_BLK_TO_BYTES(sbi, to_blk));
> +
> + err = f2fs_write_folio_dirty_range(folio, &local_submitted,
> + wbc, io_type, pos,
> + pos + F2FS_BLK_TO_BYTES(sbi, to_blk),
> + compr_blocks);
> +
> + if (!compr_blocks)
> + f2fs_unlock_op(sbi, &lc);
> +
> + /* The callers drop the submitted count on error. */
> + if (err && local_submitted)
> + f2fs_submit_merged_write_cond(sbi, NULL, folio);
We'd better clean up this if this is not a bug fix.
I think we can pass local_submitted to @submitted_p in f2fs_write_raw_pages() before
its error handling, so that its caller (f2fs_write_cache_pages()) can flush the bio
cache.
Thanks,
next prev parent reply other threads:[~2026-11-18 2:30 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 4:08 [PATCH v2 00/20] f2fs: support block size smaller than PAGE_SIZE Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-16 4:08 ` [PATCH v2 01/20] f2fs: use block-based index and size calculations in more paths Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 8:53 ` Chao Yu
2026-11-17 8:53 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 02/20] f2fs: support subpage block size superblock and mount Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 8:53 ` Chao Yu via Linux-f2fs-devel
2026-11-17 8:53 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 03/20] f2fs: extend f2fs_folio_state for subpage blocks Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 8:54 ` Chao Yu
2026-11-17 8:54 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 04/20] f2fs: support subpage blocks in directory operations Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 8:54 ` Chao Yu via Linux-f2fs-devel
2026-11-17 8:54 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 05/20] f2fs: convert inode dirty page counters to dirty block counters Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 8:54 ` Chao Yu
2026-11-17 8:54 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 06/20] f2fs: support subpage blocks in data read path and GC Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 8:58 ` Chao Yu
2026-11-17 8:58 ` Chao Yu via Linux-f2fs-devel
2026-11-17 16:51 ` Jaegeuk Kim
2026-11-17 16:51 ` Jaegeuk Kim via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 07/20] f2fs: support subpage blocks in data write path and writeback Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 10:43 ` Chao Yu
2026-11-17 10:43 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 08/20] f2fs: adapt range operations and mmap for subpage blocks Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:05 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:05 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 09/20] f2fs: support subpage blocks in pinned files Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:09 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:09 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 10/20] f2fs: support subpage blocks in collapse and insert range Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:13 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:13 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 11/20] f2fs: support subpage blocks in move range Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:22 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:22 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 12/20] f2fs: support subpage blocks in defragmentation Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:25 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:25 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 13/20] f2fs: support subpage blocks in swapfile activation Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:25 ` Chao Yu
2026-11-17 11:25 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 14/20] f2fs: support subpage blocks in fs-verity enablement Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:38 ` Chao Yu
2026-11-17 11:38 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 15/20] f2fs: support subpage blocks in atomic writes Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:39 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:39 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 16/20] f2fs: preserve inline data in subpage block mode Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:40 ` Chao Yu
2026-11-17 11:40 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 17/20] f2fs: support subpage blocks in online resize Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-17 11:41 ` Chao Yu via Linux-f2fs-devel
2026-11-17 11:41 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 18/20] f2fs: support subpage blocks in compression Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-18 2:29 ` Chao Yu via Linux-f2fs-devel [this message]
2026-11-18 2:29 ` Chao Yu
2026-11-16 4:08 ` [PATCH v2 19/20] f2fs: count compress cache entries in pages for its memory limit Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-18 2:30 ` Chao Yu
2026-11-18 2:30 ` Chao Yu via Linux-f2fs-devel
2026-11-16 4:08 ` [PATCH v2 20/20] f2fs: enable subpage block size support Daeho Jeong
2026-11-16 4:08 ` [f2fs-dev] " Daeho Jeong
2026-11-18 2:30 ` Chao Yu
2026-11-18 2:30 ` Chao Yu via Linux-f2fs-devel
2026-11-17 16:50 ` [f2fs-dev] [PATCH v2 00/20] f2fs: support block size smaller than PAGE_SIZE patchwork-bot+f2fs--- via Linux-f2fs-devel
2026-11-17 16:50 ` patchwork-bot+f2fs
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=00565d3e-c508-4764-8587-327c874adcc7@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.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 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.