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>
;;
ubifs)
[ "$UBIUPDATEVOL_PROG" = "" ] && _fatal "ubiupdatevol not found"
+ . ./common/ubifs
;;
esac
}
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+
+_get_leb_size()
+{
+ local ubivol=$1
+
+ cat /sys/class/ubi/`basename $ubivol`/usable_eb_size
+}
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`