All of lore.kernel.org
 help / color / mirror / Atom feed
From: Naohiro Aota <naohiro.aota@wdc.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH 1/5] common/rc: introduce minimal fs size check
Date: Fri, 21 May 2021 13:58:21 +0900	[thread overview]
Message-ID: <20210521045825.1720305-2-naohiro.aota@wdc.com> (raw)
In-Reply-To: <20210521045825.1720305-1-naohiro.aota@wdc.com>

_scratch_mkfs_sized() create a file system with specified size
limit. It can, however, too small for certain kind of devices. For
example, zoned btrfs requires at least 5 zones to make a file system.

This commit introduces MIN_FSSIZE, which specify the minimum size of the
possible file system. We can set this variable e.g. $ZONE_SIZE *
$MIN_ZONE_COUNT.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 README    |  4 ++++
 common/rc | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/README b/README
index 048491a68838..a7888281aa09 100644
--- a/README
+++ b/README
@@ -117,6 +117,10 @@ Preparing system for tests:
                name of a file to compress; and it must accept '-d -f -k' and
                the name of a file to decompress.  In other words, it must
                emulate gzip.
+	     - Set MIN_FSSIZE to specify the minimal size (bytes) of a
+               filesystem we can create. Setting this parameter will
+               skip the tests creating a filesystem less than
+               MIN_FSSIZE.
 
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
diff --git a/common/rc b/common/rc
index b18cf61e8a96..9a8458d4a3b6 100644
--- a/common/rc
+++ b/common/rc
@@ -956,6 +956,16 @@ _available_memory_bytes()
 	fi
 }
 
+_check_minimal_fs_size()
+{
+	local fssize=$1
+
+	if [ -n "$MIN_FSSIZE" ]; then
+		[ $MIN_FSSIZE -gt "$fssize" ] &&
+			_notrun "specified filesystem size is too small"
+	fi
+}
+
 # Create fs of certain size on scratch device
 # _scratch_mkfs_sized <size in bytes> [optional blocksize]
 _scratch_mkfs_sized()
@@ -989,6 +999,8 @@ _scratch_mkfs_sized()
 
 	local blocks=`expr $fssize / $blocksize`
 
+	_check_minimal_fs_size $fssize
+
 	if [ -b "$SCRATCH_DEV" ]; then
 		local devsize=`blockdev --getsize64 $SCRATCH_DEV`
 		[ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
-- 
2.31.1


  reply	other threads:[~2021-05-21  4:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  4:58 [PATCH 0/5] fstests: add checks for testing zoned btrfs Naohiro Aota
2021-05-21  4:58 ` Naohiro Aota [this message]
2021-05-21  4:58 ` [PATCH 2/5] btrfs/057: use _scratch_mkfs_sized to set filesystem size Naohiro Aota
2021-05-21  4:58 ` [PATCH 3/5] btrfs: add minimal file system size check Naohiro Aota
2021-05-21  4:58 ` [PATCH 4/5] common: add zoned block device checks Naohiro Aota
2021-05-21  4:58 ` [PATCH 5/5] shared/032: add check for zoned block device Naohiro Aota
2021-05-21 10:17 ` [PATCH 0/5] fstests: add checks for testing zoned btrfs Johannes Thumshirn
2021-05-21 11:06   ` Johannes Thumshirn

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=20210521045825.1720305-2-naohiro.aota@wdc.com \
    --to=naohiro.aota@wdc.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.