From: Dhruva G <goledhruva@gmail.com>
To: fstests@vger.kernel.org
Cc: Anand Jain <asj@kernel.org>, Filipe Manana <fdmanana@suse.com>,
Zorro Lang <zlang@kernel.org>,
linux-btrfs@vger.kernel.org, Qu Wenruo <quwenruo.btrfs@gmx.com>
Subject: [PATCH 3/3] btrfs: cover NOCOMPRESS inline eligibility and short tails
Date: Mon, 12 Oct 2026 01:11:47 +0530 [thread overview]
Message-ID: <11049c99-ddd9-4495-a46e-34d830e6a15d@gmail.com> (raw)
In-Reply-To: <cover.1791395660.git.goledhruva@gmail.com>
Check that --nocomp preserves a compressed inline extent while it remains
eligible under max_inline, including after a remount. Lower max_inline to
zero and require the same extent to become regular, uncompressed data.
Exercise one-byte, sector-minus-one, sector-plus-one, and
maximum-compressed-extent-plus-one file sizes. Check every mapped byte
range for regular uncompressed data after defrag, and verify all file
contents, sizes, and converted mappings again after a remount.
Use FIEMAP INLINE and ENCODED flags instead of parsing dump-tree output,
and skip configurations without inline extent creation support.
Signed-off-by: Dhruva Gole <goledhruva@gmail.com>
---
tests/btrfs/357 | 59 +++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/357.out | 2 ++
2 files changed, 61 insertions(+)
create mode 100755 tests/btrfs/357
create mode 100644 tests/btrfs/357.out
diff --git a/tests/btrfs/357 b/tests/btrfs/357
new file mode 100755
index 00000000..0d7b1e33
--- /dev/null
+++ b/tests/btrfs/357
@@ -0,0 +1,59 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+#
+# FS QA Test 357
+#
+# Verify NOCOMPRESS inline eligibility and short EOF tails.
+#
+. ./common/preamble
+_begin_fstest auto quick defrag compress fiemap
+
+. ./common/filter
+. ./common/btrfs_nocomp
+
+_nc_require
+_require_btrfs_inline_extents_creation
+_scratch_mkfs -s 4k >> "$seqres.full" 2>&1 || _fail "mkfs failed"
+_scratch_mount -o compress=zlib,max_inline=4096
+_nc_probe
+
+file="$SCRATCH_MNT/inline"
+_nc_write "$file" 0 2048 0x34
+_nc_save_file "$file"
+_nc_check_range "$file" 0 2048 inline
+_nc_defrag "$file"
+_nc_check_range "$file" 0 2048 inline
+_nc_verify_files
+_scratch_cycle_mount compress=zlib,max_inline=4096
+_nc_check_range "$file" 0 2048 inline
+_nc_verify_files
+
+# Lowering max_inline makes the same extent eligible for conversion.
+_scratch_cycle_mount compress=zlib,max_inline=0
+_nc_defrag "$file"
+_nc_check_range "$file" 0 2048 regular
+_nc_verify_files
+
+for length in 1 4095 4097 131073; do
+ f="$SCRATCH_MNT/tail-$length"
+ _nc_write "$f" 0 "$length" 0x36
+ _nc_save_file "$f"
+ # One-sector files cannot save a sector through compression. The larger
+ # fixtures must contain compressed data before testing conversion.
+ if [ "$length" -gt 4096 ]; then
+ _nc_check_range "$f" 0 4096 compressed
+ fi
+ _nc_defrag "$f"
+ _nc_check_range "$f" 0 "$length" regular
+done
+_nc_verify_files
+_scratch_cycle_mount compress=zlib,max_inline=0
+_nc_verify_files
+_nc_check_range "$file" 0 2048 regular
+for length in 1 4095 4097 131073; do
+ _nc_check_range "$SCRATCH_MNT/tail-$length" 0 "$length" regular
+done
+
+echo "Silence is golden"
+_exit 0
diff --git a/tests/btrfs/357.out b/tests/btrfs/357.out
new file mode 100644
index 00000000..25875c6d
--- /dev/null
+++ b/tests/btrfs/357.out
@@ -0,0 +1,2 @@
+QA output created by 357
+Silence is golden
--
2.43.0
prev parent reply other threads:[~2026-10-11 19:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1791395660.git.goledhruva@gmail.com>
2026-10-11 19:40 ` [PATCH 1/3] btrfs: exercise NOCOMPRESS range and EOF handling Dhruva G
2026-10-11 22:00 ` Qu Wenruo
2026-10-13 18:08 ` Dhruva G
2026-10-12 11:04 ` Filipe Manana
2026-10-11 19:41 ` [PATCH 2/3] btrfs: check NOCOMPRESS preserves holes and preallocation Dhruva G
2026-10-11 19:41 ` Dhruva G [this message]
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=11049c99-ddd9-4495-a46e-34d830e6a15d@gmail.com \
--to=goledhruva@gmail.com \
--cc=asj@kernel.org \
--cc=fdmanana@suse.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
--cc=zlang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox