From: Eric Biggers <ebiggers@kernel.org>
To: fstests@vger.kernel.org
Cc: linux-fscrypt@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>,
Daeho Jeong <daeho43@gmail.com>
Subject: [PATCH 4/5] common/f2fs: add _require_scratch_f2fs_compression()
Date: Wed, 30 Sep 2020 17:25:06 -0700 [thread overview]
Message-ID: <20201001002508.328866-5-ebiggers@kernel.org> (raw)
In-Reply-To: <20201001002508.328866-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
Create the file common/f2fs, which will contain f2fs-specific utilities.
Then add a function _require_scratch_f2fs_compression(), which checks
for f2fs compression support on the scratch filesystem.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
common/f2fs | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 common/f2fs
diff --git a/common/f2fs b/common/f2fs
new file mode 100644
index 00000000..1b39d8ce
--- /dev/null
+++ b/common/f2fs
@@ -0,0 +1,27 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+# Copyright 2020 Google LLC
+
+# Require f2fs compression support on the scratch filesystem.
+# Optionally, check for support for a specific compression algorithm.
+_require_scratch_f2fs_compression()
+{
+ local algorithm=$1
+
+ _require_scratch
+
+ if [ ! -e /sys/fs/f2fs/features/compression ]; then
+ _notrun "Kernel doesn't support f2fs compression"
+ fi
+ # Note: '-O compression' is only accepted when used in
+ # combination with extra_attr.
+ if ! _scratch_mkfs -O compression,extra_attr >> $seqres.full; then
+ _notrun "f2fs-tools doesn't support compression"
+ fi
+ if [ -n "$algorithm" ]; then
+ if ! _scratch_mount "-o compress_algorithm=$algorithm"; then
+ _notrun "Kernel doesn't support $algorithm compression algorithm for f2fs"
+ fi
+ _scratch_unmount
+ fi
+}
--
2.28.0
next prev parent reply other threads:[~2020-10-01 0:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 0:25 [PATCH 0/5] xfstests: test f2fs compression+encryption Eric Biggers
2020-10-01 0:25 ` [PATCH 1/5] fscrypt-crypt-util: clean up parsing --block-size and --inode-number Eric Biggers
2020-10-01 0:25 ` [PATCH 2/5] fscrypt-crypt-util: fix IV incrementing for --iv-ino-lblk-32 Eric Biggers
2020-10-01 0:25 ` [PATCH 3/5] fscrypt-crypt-util: add --block-number option Eric Biggers
2020-10-01 0:25 ` Eric Biggers [this message]
2020-10-01 0:25 ` [PATCH 5/5] f2fs: verify ciphertext of compressed+encrypted file Eric Biggers
2020-10-07 3:48 ` [PATCH 0/5] xfstests: test f2fs compression+encryption Eric Biggers
2020-10-07 4:27 ` [f2fs-dev] " Daeho Jeong
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=20201001002508.328866-5-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=daeho43@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=yuchao0@huawei.com \
/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