FSTests Archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: fstests@vger.kernel.org
Cc: Richard Weinberger <richard@nod.at>
Subject: [PATCH] generic/020: Compute correct max_attrs for UBIFS
Date: Sun, 14 Jan 2024 14:57:13 +0100	[thread overview]
Message-ID: <20240114135713.10555-1-richard@nod.at> (raw)

When testing on a MTD with a rather small erase block
size, the default max_attr limit can be too much and the
test will fail.
Instead compute the actual limit.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 common/config     | 1 +
 common/ubifs      | 9 +++++++++
 tests/generic/020 | 6 ++++++
 3 files changed, 16 insertions(+)
 create mode 100644 common/ubifs

diff --git a/common/config b/common/config
index c9771ff9..05f2bb35 100644
--- a/common/config
+++ b/common/config
@@ -545,6 +545,7 @@ _source_specific_fs()
 		;;
 	ubifs)
 		[ "$UBIUPDATEVOL_PROG" = "" ] && _fatal "ubiupdatevol not found"
+		. ./common/ubifs
 		;;
 	esac
 }
diff --git a/common/ubifs b/common/ubifs
new file mode 100644
index 00000000..08323260
--- /dev/null
+++ b/common/ubifs
@@ -0,0 +1,9 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+
+_get_leb_size()
+{
+	local ubivol=$1
+
+	cat /sys/class/ubi/`basename $ubivol`/usable_eb_size
+}
diff --git a/tests/generic/020 b/tests/generic/020
index da258aa5..4951b9e3 100755
--- a/tests/generic/020
+++ b/tests/generic/020
@@ -101,6 +101,12 @@ _attr_get_max()
 			let max_attrs=$((($BLOCK_SIZE - 32) / (16 + 12 + 16 )))
 		fi
 		;;
+	ubifs)
+		LEB_SIZE=`_get_leb_size $TEST_DEV`
+		# On UBIFS, the number of xattrs has to be less than 50% LEB size
+		# divided by 160 (inode size)
+		let max_attrs=$((($LEB_SIZE / 2 / 160) - 1))
+		;;
 	*)
 		# Assume max ~1 block of attrs
 		BLOCK_SIZE=`_get_block_size $TEST_DIR`
-- 
2.35.3


             reply	other threads:[~2024-01-14 13:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-14 13:57 Richard Weinberger [this message]
2024-02-02 13:30 ` [PATCH] generic/020: Compute correct max_attrs for UBIFS Zorro Lang

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=20240114135713.10555-1-richard@nod.at \
    --to=richard@nod.at \
    --cc=fstests@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).