]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/020: Compute correct max_attrs for UBIFS
authorRichard Weinberger <richard@nod.at>
Sun, 14 Jan 2024 13:57:13 +0000 (14:57 +0100)
committerZorro Lang <zlang@kernel.org>
Fri, 9 Feb 2024 05:27:17 +0000 (13:27 +0800)
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>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/config
common/ubifs [new file with mode: 0644]
tests/generic/020

index 1f9edceec57a19f4d6bb454b22e38d1910156fa9..a3b15b96f3367fbc07fe282af516f01512adcb57 100644 (file)
@@ -546,6 +546,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 (file)
index 0000000..0832326
--- /dev/null
@@ -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
+}
index da258aa501d78cc45880cf16b05572c16d90e9f2..4951b9e376248c6f52bb4cd9d4b71c62bbf6ca47 100755 (executable)
@@ -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`