All of lore.kernel.org
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>
Subject: [PATCH 1/4] btrfs: add a _require_btrfs_send_v2 helper
Date: Mon, 28 Nov 2022 12:07:21 +0000	[thread overview]
Message-ID: <28f1249372f13e5f73ba7f7c7478e80c6fc66474.1669636339.git.fdmanana@suse.com> (raw)
In-Reply-To: <cover.1669636339.git.fdmanana@suse.com>

From: Filipe Manana <fdmanana@suse.com>

Add a helper to check that both btrfs-progs and kernel support the v2 send
stream, so that we can have tests specific for send v2 stream.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 common/btrfs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/common/btrfs b/common/btrfs
index d27d3384..ee673a93 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -585,3 +585,17 @@ _require_btrfs_corrupt_block()
 {
 	_require_command "$BTRFS_CORRUPT_BLOCK_PROG" btrfs-corrupt-block
 }
+
+_require_btrfs_send_v2()
+{
+	# Check first if btrfs-progs supports the v2 stream.
+	_require_btrfs_command send --compressed-data
+
+	# Now check the kernel support. If send_stream_version does not exists,
+	# then it's a kernel that only supports v1.
+	[ -f /sys/fs/btrfs/features/send_stream_version ] || \
+		_notrun "kernel does not support send stream v2"
+
+	[ $(cat /sys/fs/btrfs/features/send_stream_version) -gt 1 ] || \
+		_notrun "kernel does not support send stream v2"
+}
-- 
2.35.1


  reply	other threads:[~2022-11-28 12:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 12:07 [PATCH 0/4] fstests/btrfs: add a test case for send v2 and an update fdmanana
2022-11-28 12:07 ` fdmanana [this message]
2022-11-28 12:07 ` [PATCH 2/4] common: make _filter_fiemap_flags optionally print the encoded flag fdmanana
2022-11-28 12:07 ` [PATCH 3/4] btrfs/280: also verify that fiemap reports extents as encoded fdmanana
2022-11-28 12:07 ` [PATCH 4/4] btrfs: test a case with compressed send stream and a shared extent fdmanana
2022-11-28 16:05 ` [PATCH 0/4] fstests/btrfs: add a test case for send v2 and an update Josef Bacik

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=28f1249372f13e5f73ba7f7c7478e80c6fc66474.1669636339.git.fdmanana@suse.com \
    --to=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@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.