ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/6] Track minimal size per filesystem
@ 2022-08-27  0:28 Petr Vorel
  2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
                   ` (6 more replies)
  0 siblings, 7 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

Hi all,

This patchset require to be on the top of:

[RFC,1/1] API: Allow to use xfs filesystems < 300 MB
https://lore.kernel.org/ltp/20220817204015.31420-1-pvorel@suse.cz/
https://patchwork.ozlabs.org/project/ltp/patch/20220817204015.31420-1-pvorel@suse.cz/

It replaces previous effort to just increase loop device size to 300 MB
https://lore.kernel.org/ltp/20220818100945.7935-1-pvorel@suse.cz/
https://patchwork.ozlabs.org/project/ltp/list/?series=314303&state=*

This patchset tracks minimal filesystem requirements as we agreed.
It fixes both C and shell API.

** Please test the patchset in your setup. **

I tried to find all tests with problems, but likely I missed some.

I have no idea why sendfile09 fails:

tst_test.c:1540: TINFO: Timeout per run is 0h 00m 30s
sendfile09.c:88: TPASS: sendfile() with offset at 0
Test timeouted, sending SIGKILL!
tst_test.c:1590: TINFO: If you are running on slow machine, try
exporting LTP_TIMEOUT_MUL > 1
tst_test.c:1591: TBROK: Test killed! (timeout?)

Summary:
passed   1
failed   0
broken   1
skipped  0
warnings 0

df01.sh and mkfs01.sh (except -f exfat) are shell tests which use loop
device. mkfs01.sh -t exfat fails (not yet in the runtest file).

If applied, "v3 shell: nfs: $TST_ALL_FILESYSTEMS (.all_filesystems)"
patchset will need to be rebased (not a problem, I'd just like to get
both into LTP release in September)
https://patchwork.ozlabs.org/project/ltp/list/?series=312567&state=*
https://lore.kernel.org/ltp/20220804121946.19564-1-pvorel@suse.cz/

Kind regards,
Petr

Petr Vorel (6):
  tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  API: tst_device: Track minimal size per filesystem
  tst_test: Use 16 MB also for tmpfs
  tst_device: Use getopts
  tst_device: Add support -f filesystem
  tst_test.sh: Pass used filesystem to tst_device

 include/old/old_device.h                      |  6 +-
 include/tst_fs.h                              | 21 ++++-
 lib/tst_device.c                              | 36 +++++++--
 lib/tst_fs_type.c                             | 34 ++++++++
 lib/tst_test.c                                |  9 ++-
 testcases/kernel/fs/squashfs/squashfs01.c     |  1 +
 .../kernel/syscalls/fanotify/fanotify05.c     |  1 +
 testcases/kernel/syscalls/preadv2/preadv203.c |  1 +
 .../kernel/syscalls/readahead/readahead02.c   |  1 +
 testcases/lib/tst_device.c                    | 81 ++++++++++++-------
 testcases/lib/tst_test.sh                     |  4 +-
 testcases/misc/lvm/cleanup_lvm.sh             |  2 +-
 testcases/misc/lvm/prepare_lvm.sh             |  8 +-
 13 files changed, 157 insertions(+), 48 deletions(-)

-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
@ 2022-08-27  0:28 ` Petr Vorel
  2022-08-29 10:44   ` Cyril Hrubis
                     ` (2 more replies)
  2022-08-27  0:28 ` [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem Petr Vorel
                   ` (5 subsequent siblings)
  6 siblings, 3 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_fs.h  | 5 ++++-
 lib/tst_fs_type.c | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/tst_fs.h b/include/tst_fs.h
index 8159b99eb..a6f934b0f 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -5,7 +5,7 @@
 #ifndef TST_FS_H__
 #define TST_FS_H__
 
-/* man 2 statfs or kernel-source/include/linux/magic.h */
+/* man 2 statfs or kernel-source/include/uapi/linux/magic.h */
 #define TST_BTRFS_MAGIC    0x9123683E
 #define TST_NFS_MAGIC      0x6969
 #define TST_RAMFS_MAGIC    0x858458f6
@@ -32,6 +32,9 @@
 #define TST_FUSE_MAGIC     0x65735546
 #define TST_VFAT_MAGIC     0x4d44 /* AKA MSDOS */
 #define TST_EXFAT_MAGIC    0x2011BAB0UL
+#define TST_SQUASHFS_MAGIC 0x73717368
+/* kernel-source/fs/ntfs/ntfs.h */
+#define TST_NTFS_MAGIC     0x5346544e
 
 enum {
 	TST_BYTES = 1,
diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
index 9de80224b..de4facef5 100644
--- a/lib/tst_fs_type.c
+++ b/lib/tst_fs_type.c
@@ -88,6 +88,12 @@ const char *tst_fs_type_name(long f_type)
 		return "fuse";
 	case TST_EXFAT_MAGIC:
 		return "exfat";
+	case TST_NTFS_MAGIC:
+		return "ntfs";
+	case TST_SQUASHFS_MAGIC:
+		return "squashfs";
+	case TST_VFAT_MAGIC:
+		return "vfat";
 	default:
 		return "unknown";
 	}
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
  2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
@ 2022-08-27  0:28 ` Petr Vorel
  2022-08-29 10:58   ` Cyril Hrubis
  2022-08-27  0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

Previously we required 256 MB for loop device size regardless used
filesystem due btrfs requirements. New defaults are based on used
filesystem:

* Btrfs: 110 MB
* SquashFS: 1 MB
* others: 16 MB

This helps embedded systems with lower resources.

NOTE: XFS has 300 MB requirement from xfsprogs 5.19, but it was
workarounded by environment variables by previous commit.

Tests required to change setup:
* fanotify05: .dev_min_size = 65
* preadv203: .dev_min_size = 230
* readahead02: .dev_min_size = 135
* squashfs01: .dev_fs_type = "squashfs" to be able to keep .dev_min_size = 1

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/old/old_device.h                      |  6 ++--
 include/tst_fs.h                              | 16 +++++++++
 lib/tst_device.c                              | 36 +++++++++++++++----
 lib/tst_fs_type.c                             | 28 +++++++++++++++
 lib/tst_test.c                                |  7 +++-
 testcases/kernel/fs/squashfs/squashfs01.c     |  1 +
 .../kernel/syscalls/fanotify/fanotify05.c     |  1 +
 testcases/kernel/syscalls/preadv2/preadv203.c |  1 +
 .../kernel/syscalls/readahead/readahead02.c   |  1 +
 testcases/lib/tst_device.c                    |  2 +-
 10 files changed, 88 insertions(+), 11 deletions(-)

diff --git a/include/old/old_device.h b/include/old/old_device.h
index a6e9fea86..f67cee2b9 100644
--- a/include/old/old_device.h
+++ b/include/old/old_device.h
@@ -43,13 +43,13 @@ const char *tst_dev_fs_type(void);
  * Returns path to the device or NULL if it cannot be created.
  * Call tst_release_device() when you're done.
  */
-const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size);
+const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size, long f_type);
 
-const char *tst_acquire_device__(unsigned int size);
+const char *tst_acquire_device__(unsigned int size, long f_type);
 
 static inline const char *tst_acquire_device(void (cleanup_fn)(void))
 {
-	return tst_acquire_device_(cleanup_fn, 0);
+	return tst_acquire_device_(cleanup_fn, 0, TST_ALL_FILESYSTEMS);
 }
 
 /*
diff --git a/include/tst_fs.h b/include/tst_fs.h
index a6f934b0f..ea2c6b527 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -5,6 +5,8 @@
 #ifndef TST_FS_H__
 #define TST_FS_H__
 
+#define TST_ALL_FILESYSTEMS	0
+
 /* man 2 statfs or kernel-source/include/uapi/linux/magic.h */
 #define TST_BTRFS_MAGIC    0x9123683E
 #define TST_NFS_MAGIC      0x6969
@@ -49,6 +51,15 @@ enum {
 #define OVL_WORK	OVL_BASE_MNTPOINT"/work"
 #define OVL_MNT		OVL_BASE_MNTPOINT"/ovl"
 
+/*
+ * Returns minimum requested for filesystem size.
+ * This size is enforced for all but tmpfs.
+ *
+ * @fs_type filesystem to be searched for, 0 is for the biggest size of all
+ * supported filesystems (used for .all_filesystems).
+ */
+unsigned int tst_min_fs_size(long f_type);
+
 /*
  * @path: path is the pathname of any file within the mounted file system
  * @mult: mult should be TST_KB, TST_MB or TST_GB
@@ -87,6 +98,11 @@ long tst_fs_type_(void (*cleanup)(void), const char *path);
  */
 const char *tst_fs_type_name(long f_type);
 
+/*
+ * Returns magic given filesystem name.
+ */
+long tst_fs_name_type(const char *fs);
+
 /*
  * Try to get maximum number of hard links to a regular file inside the @dir.
  *
diff --git a/lib/tst_device.c b/lib/tst_device.c
index c34cbe6d1..bb336abe4 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -36,6 +36,7 @@
 #include "lapi/syscalls.h"
 #include "test.h"
 #include "safe_macros.h"
+#include "tst_fs.h"
 
 #ifndef LOOP_CTL_GET_FREE
 # define LOOP_CTL_GET_FREE 0x4C82
@@ -44,12 +45,28 @@
 #define LOOP_CONTROL_FILE "/dev/loop-control"
 
 #define DEV_FILE "test_dev.img"
-#define DEV_SIZE_MB 256u
+#define DEV_SIZE_MB_DEFAULT 16u
+#define DEV_SIZE_MB_BTRFS 110u
+#define DEV_SIZE_MB_SQUASHFS 1u
 
 static char dev_path[1024];
 static int device_acquired;
 static unsigned long prev_dev_sec_write;
 
+unsigned int tst_min_fs_size(long f_type)
+{
+	switch (f_type) {
+	case 0:
+		return MAX(DEV_SIZE_MB_BTRFS, DEV_SIZE_MB_DEFAULT);
+	case TST_BTRFS_MAGIC:
+		return DEV_SIZE_MB_BTRFS;
+	case TST_SQUASHFS_MAGIC:
+		return DEV_SIZE_MB_SQUASHFS;
+	default:
+		return DEV_SIZE_MB_DEFAULT;
+	}
+}
+
 static const char *dev_variants[] = {
 	"/dev/loop%i",
 	"/dev/loop/%i",
@@ -279,7 +296,7 @@ int tst_dev_sync(int fd)
 
 const char *tst_acquire_loop_device(unsigned int size, const char *filename)
 {
-	unsigned int acq_dev_size = size ? size : DEV_SIZE_MB;
+	unsigned int acq_dev_size = size ?: tst_min_fs_size(0);
 
 	if (tst_prealloc_file(filename, 1024 * 1024, acq_dev_size)) {
 		tst_resm(TWARN | TERRNO, "Failed to create %s", filename);
@@ -295,13 +312,20 @@ const char *tst_acquire_loop_device(unsigned int size, const char *filename)
 	return dev_path;
 }
 
-const char *tst_acquire_device__(unsigned int size)
+const char *tst_acquire_device__(unsigned int size, long f_type)
 {
 	const char *dev;
 	unsigned int acq_dev_size;
 	uint64_t ltp_dev_size;
+	unsigned int min_size = tst_min_fs_size(f_type);
+
+	if (size && size < min_size) {
+		tst_brkm(TBROK, NULL, "Request device size %u smaller than min size: %u",
+				 size, min_size);
+		return NULL;
+	}
 
-	acq_dev_size = size ? size : DEV_SIZE_MB;
+	acq_dev_size = size ?: min_size;
 
 	dev = getenv("LTP_DEV");
 
@@ -325,7 +349,7 @@ const char *tst_acquire_device__(unsigned int size)
 	return dev;
 }
 
-const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
+const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size, long f_type)
 {
 	const char *device;
 
@@ -340,7 +364,7 @@ const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
 		return NULL;
 	}
 
-	device = tst_acquire_device__(size);
+	device = tst_acquire_device__(size, f_type);
 
 	if (!device) {
 		tst_brkm(TBROK, cleanup_fn, "Failed to acquire device");
diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
index de4facef5..49db2fff7 100644
--- a/lib/tst_fs_type.c
+++ b/lib/tst_fs_type.c
@@ -43,6 +43,34 @@ long tst_fs_type_(void (*cleanup)(void), const char *path)
 	return sbuf.f_type;
 }
 
+long tst_fs_name_type(const char *fs)
+{
+	if (!strcmp(fs, "btrfs"))
+		return TST_BTRFS_MAGIC;
+	else if (!strcmp(fs, "exfat"))
+		return TST_EXFAT_MAGIC;
+	else if (!strcmp(fs, "ext2"))
+		return TST_EXT2_OLD_MAGIC;
+	else if (!strcmp(fs, "ext3") || !strcmp(fs, "ext4"))
+		return TST_EXT234_MAGIC;
+	else if (!strcmp(fs, "minix"))
+		return TST_MINIX3_MAGIC;
+	else if (!strcmp(fs, "msdos"))
+		return TST_VFAT_MAGIC;
+	else if (!strcmp(fs, "ntfs"))
+		return TST_NTFS_MAGIC;
+	else if (!strcmp(fs, "squashfs"))
+		return TST_SQUASHFS_MAGIC;
+	else if (!strcmp(fs, "tmpfs"))
+		return TST_TMPFS_MAGIC;
+	else if (!strcmp(fs, "vfat"))
+		return TST_VFAT_MAGIC;
+	else if (!strcmp(fs, "xfs"))
+		return TST_XFS_MAGIC;
+
+	return -1;
+}
+
 const char *tst_fs_type_name(long f_type)
 {
 	switch (f_type) {
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 657348732..bfc40554f 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1225,7 +1225,12 @@ static void do_setup(int argc, char *argv[])
 	}
 
 	if (tst_test->needs_device && !mntpoint_mounted) {
-		tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size);
+		long f_type = tst_fs_name_type(tst_test->dev_fs_type ?: DEFAULT_FS_TYPE);
+
+		if (tst_test->all_filesystems)
+			f_type = TST_ALL_FILESYSTEMS;
+
+		tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size, f_type);
 
 		if (!tdev.dev)
 			tst_brk(TCONF, "Failed to acquire device");
diff --git a/testcases/kernel/fs/squashfs/squashfs01.c b/testcases/kernel/fs/squashfs/squashfs01.c
index 502de419d..d7f91c129 100644
--- a/testcases/kernel/fs/squashfs/squashfs01.c
+++ b/testcases/kernel/fs/squashfs/squashfs01.c
@@ -104,6 +104,7 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.needs_device = 1,
 	.dev_min_size = 1,
+	.dev_fs_type = "squashfs",
 	.needs_cmds = (const char *const []) {
 		"mksquashfs",
 		NULL
diff --git a/testcases/kernel/syscalls/fanotify/fanotify05.c b/testcases/kernel/syscalls/fanotify/fanotify05.c
index 04670cb1c..a4bc5ef54 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify05.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify05.c
@@ -215,6 +215,7 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.mount_device = 1,
 	.mntpoint = MOUNT_PATH,
+	.dev_min_size = 65,
 };
 #else
 	TST_TEST_TCONF("system doesn't have required fanotify support");
diff --git a/testcases/kernel/syscalls/preadv2/preadv203.c b/testcases/kernel/syscalls/preadv2/preadv203.c
index 60dc4a882..8c08c86ea 100644
--- a/testcases/kernel/syscalls/preadv2/preadv203.c
+++ b/testcases/kernel/syscalls/preadv2/preadv203.c
@@ -280,4 +280,5 @@ static struct tst_test test = {
 	.all_filesystems = 1,
 	.max_runtime = 60,
 	.needs_root = 1,
+	.dev_min_size = 230,
 };
diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
index 4fa8cfaf8..07a5172fc 100644
--- a/testcases/kernel/syscalls/readahead/readahead02.c
+++ b/testcases/kernel/syscalls/readahead/readahead02.c
@@ -406,6 +406,7 @@ static struct tst_test test = {
 	},
 	.test = test_readahead,
 	.tcnt = ARRAY_SIZE(tcases),
+	.dev_min_size = 135,
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "b833a3660394"},
 		{"linux-git", "5b910bd615ba"},
diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
index d6b74a5ff..b76abf52b 100644
--- a/testcases/lib/tst_device.c
+++ b/testcases/lib/tst_device.c
@@ -43,7 +43,7 @@ static int acquire_device(int argc, char *argv[])
 	if (argc >= 4)
 		device = tst_acquire_loop_device(size, argv[3]);
 	else
-		device = tst_acquire_device__(size);
+		device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS);
 
 	if (!device)
 		return 1;
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
  2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
  2022-08-27  0:28 ` [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem Petr Vorel
@ 2022-08-27  0:28 ` Petr Vorel
  2022-08-29 11:00   ` Cyril Hrubis
  2022-08-30  6:12   ` Li Wang
  2022-08-27  0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

Previously 32 MB was used, use the default size used
for most of the filesystems (16 MB).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index bfc40554f..fce73c2f9 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1030,7 +1030,7 @@ static const char *limit_tmpfs_mount_size(const char *mnt_data,
 		return mnt_data;
 
 	if (!tst_test->dev_min_size)
-		tmpfs_size = 32;
+		tmpfs_size = tst_min_fs_size(TST_TMPFS_MAGIC);
 	else
 		tmpfs_size = tdev.size;
 
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [LTP] [PATCH 4/6] tst_device: Use getopts
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
                   ` (2 preceding siblings ...)
  2022-08-27  0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
@ 2022-08-27  0:28 ` Petr Vorel
  2022-08-29 11:03   ` [LTP] [Automated-testing] " Cyril Hrubis
  2022-08-30  6:14   ` [LTP] " Li Wang
  2022-08-27  0:28 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Petr Vorel
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

size and filesystems are passed by -s and -f flags.
That will help to pass used filesystem.

When it, add also -h.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_device.c        | 71 +++++++++++++++++++------------
 testcases/lib/tst_test.sh         |  2 +-
 testcases/misc/lvm/cleanup_lvm.sh |  2 +-
 testcases/misc/lvm/prepare_lvm.sh |  8 ++--
 4 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
index b76abf52b..b672202e2 100644
--- a/testcases/lib/tst_device.c
+++ b/testcases/lib/tst_device.c
@@ -18,30 +18,18 @@ static struct tst_test test = {
 
 static void print_help(void)
 {
-	fprintf(stderr, "\nUsage: tst_device acquire [size [filename]]\n");
-	fprintf(stderr, "   or: tst_device release /path/to/device\n\n");
+	fprintf(stderr, "\nUsage:\n");
+	fprintf(stderr, "tst_device [-s size [-d /path/to/device]] acquire\n");
+	fprintf(stderr, "tst_device -d /path/to/device release\n");
+	fprintf(stderr, "tst_device -h\n\n");
 }
 
-static int acquire_device(int argc, char *argv[])
+static int acquire_device(const char *device_path, unsigned int size)
 {
-	unsigned int size = 0;
 	const char *device;
 
-	if (argc > 4)
-		return 1;
-
-	if (argc >= 3) {
-		size = atoi(argv[2]);
-
-		if (!size) {
-			fprintf(stderr, "ERROR: Invalid device size '%s'",
-				argv[2]);
-			return 1;
-		}
-	}
-
-	if (argc >= 4)
-		device = tst_acquire_loop_device(size, argv[3]);
+	if (device_path)
+		device = tst_acquire_loop_device(size, device_path);
 	else
 		device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS);
 
@@ -58,10 +46,12 @@ static int acquire_device(int argc, char *argv[])
 	return 0;
 }
 
-static int release_device(int argc, char *argv[])
+static int release_device(const char *device_path)
 {
-	if (argc != 3)
+	if (!device_path) {
+		fprintf(stderr, "ERROR: Missing /path/to/device\n");
 		return 1;
+	}
 
 	/*
 	 * tst_acquire_[loop_]device() was called in a different process.
@@ -69,11 +59,15 @@ static int release_device(int argc, char *argv[])
 	 * and do nothing. Call tst_detach_device() directly to bypass
 	 * the check.
 	 */
-	return tst_detach_device(argv[2]);
+	return tst_detach_device(device_path);
 }
 
 int main(int argc, char *argv[])
 {
+	char *device_path = NULL;
+	unsigned int size = 0;
+	int ret;
+
 	/*
 	 * Force messages to be printed from the new library i.e. tst_test.c
 	 *
@@ -85,17 +79,38 @@ int main(int argc, char *argv[])
 	 */
 	tst_test = &test;
 
-	if (argc < 2)
+	while ((ret = getopt(argc, argv, "d:hs:"))) {
+		if (ret < 0)
+			break;
+
+		switch (ret) {
+		case 'd':
+			device_path = optarg;
+			break;
+		case 'h':
+			print_help();
+			return 0;
+		case 's':
+			size = atoi(optarg);
+			if (!size) {
+				fprintf(stderr, "ERROR: Invalid device size '%s'", optarg);
+				return 1;
+			}
+			break;
+		}
+	}
+
+	if (argc - optind < 1)
 		goto help;
 
-	if (!strcmp(argv[1], "acquire")) {
-		if (acquire_device(argc, argv))
+	if (!strcmp(argv[optind], "acquire")) {
+		if (acquire_device(device_path, size))
 			goto help;
-	} else if (!strcmp(argv[1], "release")) {
-		if (release_device(argc, argv))
+	} else if (!strcmp(argv[optind], "release")) {
+		if (release_device(device_path))
 			goto help;
 	} else {
-		fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[1]);
+		fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[optind]);
 		goto help;
 	}
 
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index b42e54ca1..7aea9ee5f 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -46,7 +46,7 @@ _tst_do_exit()
 	fi
 
 	if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then
-		if ! tst_device release "$TST_DEVICE"; then
+		if ! tst_device -d "$TST_DEVICE" release; then
 			tst_res TWARN "Failed to release device '$TST_DEVICE'"
 		fi
 	fi
diff --git a/testcases/misc/lvm/cleanup_lvm.sh b/testcases/misc/lvm/cleanup_lvm.sh
index f05289f00..c876b4bbf 100755
--- a/testcases/misc/lvm/cleanup_lvm.sh
+++ b/testcases/misc/lvm/cleanup_lvm.sh
@@ -24,7 +24,7 @@ cleanup_lvm()
 	ROD vgremove -y ltp_test_vg2
 
 	for devname in $DEVLIST; do
-		ROD tst_device release $devname
+		ROD tst_device -d $devname release
 	done
 
 	rm -rf $LVM_DIR/ltp
diff --git a/testcases/misc/lvm/prepare_lvm.sh b/testcases/misc/lvm/prepare_lvm.sh
index d3ae4b23f..dbf1e3157 100755
--- a/testcases/misc/lvm/prepare_lvm.sh
+++ b/testcases/misc/lvm/prepare_lvm.sh
@@ -43,17 +43,17 @@ prepare_mounts()
 	FSNAME1=$1
 	FSNAME2=$2
 	shift 2
-	LVM_DEV1=`tst_device acquire 1040 "$LVM_IMGDIR/lvm_pv1.img"`
+	LVM_DEV1=`tst_device -s 1040 -d "$LVM_IMGDIR/lvm_pv1.img" acquire`
 	error_check
-	LVM_DEV2=`tst_device acquire 1040 "$LVM_IMGDIR/lvm_pv2.img"`
+	LVM_DEV2=`tst_device -s 1040 -d "$LVM_IMGDIR/lvm_pv2.img" acquire`
 	error_check
 
 	# DEVSIZE=($# * 1GB / 2) + 16MB. The extra 16MB is for LVM physical
 	# volume headers
 	DEVSIZE=$(( $# * 512 + 16 ))
-	LVM_DEV3=`tst_device acquire $DEVSIZE "$LVM_IMGDIR/lvm_pv3.img"`
+	LVM_DEV3=`tst_device -s $DEVSIZE -d "$LVM_IMGDIR/lvm_pv3.img" acquire`
 	error_check
-	LVM_DEV4=`tst_device acquire $DEVSIZE "$LVM_IMGDIR/lvm_pv4.img"`
+	LVM_DEV4=`tst_device -s $DEVSIZE -d "$LVM_IMGDIR/lvm_pv4.img" acquire`
 	error_check
 	ROD pvcreate $LVM_DEV1 $LVM_DEV2 $LVM_DEV3 $LVM_DEV4
 	ROD vgcreate ltp_test_vg1 $LVM_DEV1 $LVM_DEV2
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [LTP] [PATCH 5/6] tst_device: Add support -f filesystem
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
                   ` (3 preceding siblings ...)
  2022-08-27  0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
@ 2022-08-27  0:28 ` Petr Vorel
  2022-08-29 11:04   ` Cyril Hrubis
  2022-08-30  6:14   ` Li Wang
  2022-08-27  0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
  2022-08-29 10:43 ` [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem Cyril Hrubis
  6 siblings, 2 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

Useful to get smaller minimal required size.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_device.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
index b672202e2..a161fb069 100644
--- a/testcases/lib/tst_device.c
+++ b/testcases/lib/tst_device.c
@@ -19,19 +19,19 @@ static struct tst_test test = {
 static void print_help(void)
 {
 	fprintf(stderr, "\nUsage:\n");
-	fprintf(stderr, "tst_device [-s size [-d /path/to/device]] acquire\n");
+	fprintf(stderr, "tst_device [-f filesystem] [-s size [-d /path/to/device]] acquire\n");
 	fprintf(stderr, "tst_device -d /path/to/device release\n");
 	fprintf(stderr, "tst_device -h\n\n");
 }
 
-static int acquire_device(const char *device_path, unsigned int size)
+static int acquire_device(const char *device_path, unsigned int size, long f_type)
 {
 	const char *device;
 
 	if (device_path)
 		device = tst_acquire_loop_device(size, device_path);
 	else
-		device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS);
+		device = tst_acquire_device__(size, f_type);
 
 	if (!device)
 		return 1;
@@ -66,6 +66,7 @@ int main(int argc, char *argv[])
 {
 	char *device_path = NULL;
 	unsigned int size = 0;
+	long f_type = TST_ALL_FILESYSTEMS;
 	int ret;
 
 	/*
@@ -79,7 +80,7 @@ int main(int argc, char *argv[])
 	 */
 	tst_test = &test;
 
-	while ((ret = getopt(argc, argv, "d:hs:"))) {
+	while ((ret = getopt(argc, argv, "d:f:hs:"))) {
 		if (ret < 0)
 			break;
 
@@ -87,6 +88,13 @@ int main(int argc, char *argv[])
 		case 'd':
 			device_path = optarg;
 			break;
+		case 'f':
+			f_type = tst_fs_name_type(optarg);
+			if (f_type == -1) {
+				fprintf(stderr, "ERROR: Unsupported filesystem '%s'", optarg);
+				return 1;
+			}
+			break;
 		case 'h':
 			print_help();
 			return 0;
@@ -104,7 +112,7 @@ int main(int argc, char *argv[])
 		goto help;
 
 	if (!strcmp(argv[optind], "acquire")) {
-		if (acquire_device(device_path, size))
+		if (acquire_device(device_path, size, f_type))
 			goto help;
 	} else if (!strcmp(argv[optind], "release")) {
 		if (release_device(device_path))
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
                   ` (4 preceding siblings ...)
  2022-08-27  0:28 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Petr Vorel
@ 2022-08-27  0:28 ` Petr Vorel
  2022-08-29 11:05   ` Cyril Hrubis
  2022-08-30  6:16   ` Li Wang
  2022-08-29 10:43 ` [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem Cyril Hrubis
  6 siblings, 2 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-27  0:28 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

This allow to get smaller minimal required size.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 7aea9ee5f..1eb0ce91c 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -694,7 +694,7 @@ tst_run()
 	TST_MNTPOINT="${TST_MNTPOINT:-$PWD/mntpoint}"
 	if [ "$TST_NEEDS_DEVICE" = 1 ]; then
 
-		TST_DEVICE=$(tst_device acquire)
+		TST_DEVICE=$(tst_device -f $TST_FS_TYPE acquire)
 
 		if [ ! -b "$TST_DEVICE" -o $? -ne 0 ]; then
 			unset TST_DEVICE
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem
  2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
                   ` (5 preceding siblings ...)
  2022-08-27  0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
@ 2022-08-29 10:43 ` Cyril Hrubis
  2022-08-29 11:39   ` Petr Vorel
  6 siblings, 1 reply; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 10:43 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
> This patchset require to be on the top of:
> 
> [RFC,1/1] API: Allow to use xfs filesystems < 300 MB
> https://lore.kernel.org/ltp/20220817204015.31420-1-pvorel@suse.cz/
> https://patchwork.ozlabs.org/project/ltp/patch/20220817204015.31420-1-pvorel@suse.cz/

I'm not that sure if we want to run tests for xfs filesystem that is
smaller than minimal size used in production. I bet that we will cover
different codepaths that eventually end up being used in production
that way.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
@ 2022-08-29 10:44   ` Cyril Hrubis
  2022-08-29 15:46   ` Bird, Tim
  2022-08-30  5:59   ` Li Wang
  2 siblings, 0 replies; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 10:44 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem
  2022-08-27  0:28 ` [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem Petr Vorel
@ 2022-08-29 10:58   ` Cyril Hrubis
  2022-08-29 11:29     ` Petr Vorel
  2022-08-30  6:11     ` [LTP] " Li Wang
  0 siblings, 2 replies; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 10:58 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
> Previously we required 256 MB for loop device size regardless used
> filesystem due btrfs requirements. New defaults are based on used
> filesystem:
> 
> * Btrfs: 110 MB
> * SquashFS: 1 MB
> * others: 16 MB
> 
> This helps embedded systems with lower resources.
> 
> NOTE: XFS has 300 MB requirement from xfsprogs 5.19, but it was
> workarounded by environment variables by previous commit.
> 
> Tests required to change setup:
> * fanotify05: .dev_min_size = 65
> * preadv203: .dev_min_size = 230
> * readahead02: .dev_min_size = 135
> * squashfs01: .dev_fs_type = "squashfs" to be able to keep .dev_min_size = 1
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  include/old/old_device.h                      |  6 ++--
>  include/tst_fs.h                              | 16 +++++++++
>  lib/tst_device.c                              | 36 +++++++++++++++----
>  lib/tst_fs_type.c                             | 28 +++++++++++++++
>  lib/tst_test.c                                |  7 +++-
>  testcases/kernel/fs/squashfs/squashfs01.c     |  1 +
>  .../kernel/syscalls/fanotify/fanotify05.c     |  1 +
>  testcases/kernel/syscalls/preadv2/preadv203.c |  1 +
>  .../kernel/syscalls/readahead/readahead02.c   |  1 +
>  testcases/lib/tst_device.c                    |  2 +-
>  10 files changed, 88 insertions(+), 11 deletions(-)
> 
> diff --git a/include/old/old_device.h b/include/old/old_device.h
> index a6e9fea86..f67cee2b9 100644
> --- a/include/old/old_device.h
> +++ b/include/old/old_device.h
> @@ -43,13 +43,13 @@ const char *tst_dev_fs_type(void);
>   * Returns path to the device or NULL if it cannot be created.
>   * Call tst_release_device() when you're done.
>   */
> -const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size);
> +const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size, long f_type);
>  
> -const char *tst_acquire_device__(unsigned int size);
> +const char *tst_acquire_device__(unsigned int size, long f_type);
>  
>  static inline const char *tst_acquire_device(void (cleanup_fn)(void))
>  {
> -	return tst_acquire_device_(cleanup_fn, 0);
> +	return tst_acquire_device_(cleanup_fn, 0, TST_ALL_FILESYSTEMS);
>  }
>  
>  /*
> diff --git a/include/tst_fs.h b/include/tst_fs.h
> index a6f934b0f..ea2c6b527 100644
> --- a/include/tst_fs.h
> +++ b/include/tst_fs.h
> @@ -5,6 +5,8 @@
>  #ifndef TST_FS_H__
>  #define TST_FS_H__
>  
> +#define TST_ALL_FILESYSTEMS	0
> +
>  /* man 2 statfs or kernel-source/include/uapi/linux/magic.h */
>  #define TST_BTRFS_MAGIC    0x9123683E
>  #define TST_NFS_MAGIC      0x6969
> @@ -49,6 +51,15 @@ enum {
>  #define OVL_WORK	OVL_BASE_MNTPOINT"/work"
>  #define OVL_MNT		OVL_BASE_MNTPOINT"/ovl"
>  
> +/*
> + * Returns minimum requested for filesystem size.
> + * This size is enforced for all but tmpfs.
> + *
> + * @fs_type filesystem to be searched for, 0 is for the biggest size of all
> + * supported filesystems (used for .all_filesystems).
> + */
> +unsigned int tst_min_fs_size(long f_type);
> +
>  /*
>   * @path: path is the pathname of any file within the mounted file system
>   * @mult: mult should be TST_KB, TST_MB or TST_GB
> @@ -87,6 +98,11 @@ long tst_fs_type_(void (*cleanup)(void), const char *path);
>   */
>  const char *tst_fs_type_name(long f_type);
>  
> +/*
> + * Returns magic given filesystem name.
> + */
> +long tst_fs_name_type(const char *fs);
> +
>  /*
>   * Try to get maximum number of hard links to a regular file inside the @dir.
>   *
> diff --git a/lib/tst_device.c b/lib/tst_device.c
> index c34cbe6d1..bb336abe4 100644
> --- a/lib/tst_device.c
> +++ b/lib/tst_device.c
> @@ -36,6 +36,7 @@
>  #include "lapi/syscalls.h"
>  #include "test.h"
>  #include "safe_macros.h"
> +#include "tst_fs.h"
>  
>  #ifndef LOOP_CTL_GET_FREE
>  # define LOOP_CTL_GET_FREE 0x4C82
> @@ -44,12 +45,28 @@
>  #define LOOP_CONTROL_FILE "/dev/loop-control"
>  
>  #define DEV_FILE "test_dev.img"
> -#define DEV_SIZE_MB 256u
> +#define DEV_SIZE_MB_DEFAULT 16u
> +#define DEV_SIZE_MB_BTRFS 110u
> +#define DEV_SIZE_MB_SQUASHFS 1u
>  
>  static char dev_path[1024];
>  static int device_acquired;
>  static unsigned long prev_dev_sec_write;
>  
> +unsigned int tst_min_fs_size(long f_type)
> +{
> +	switch (f_type) {
> +	case 0:

TST_ALL_FILESYSTEMS ?

> +		return MAX(DEV_SIZE_MB_BTRFS, DEV_SIZE_MB_DEFAULT);

I do not think that we should harcode this here. I would be for a more
dynamic approach, i.e. add a function into the tst_supported_fs_types.c
that loops over supported filesystems and chooses max over the minimal
values for all supported filesystems. That way if we run on embedded
targets the device size will be 16MB as long as btrfs-progs is not
installed. Also that way we can easily define minimal size for xfs 300MB
and things will work for embedded as long as xfs-progs are not
installed.

> +	case TST_BTRFS_MAGIC:
> +		return DEV_SIZE_MB_BTRFS;
> +	case TST_SQUASHFS_MAGIC:
> +		return DEV_SIZE_MB_SQUASHFS;
> +	default:
> +		return DEV_SIZE_MB_DEFAULT;
> +	}
> +}
> +
>  static const char *dev_variants[] = {
>  	"/dev/loop%i",
>  	"/dev/loop/%i",
> @@ -279,7 +296,7 @@ int tst_dev_sync(int fd)
>  
>  const char *tst_acquire_loop_device(unsigned int size, const char *filename)
>  {
> -	unsigned int acq_dev_size = size ? size : DEV_SIZE_MB;
> +	unsigned int acq_dev_size = size ?: tst_min_fs_size(0);
>  
>  	if (tst_prealloc_file(filename, 1024 * 1024, acq_dev_size)) {
>  		tst_resm(TWARN | TERRNO, "Failed to create %s", filename);
> @@ -295,13 +312,20 @@ const char *tst_acquire_loop_device(unsigned int size, const char *filename)
>  	return dev_path;
>  }
>  
> -const char *tst_acquire_device__(unsigned int size)
> +const char *tst_acquire_device__(unsigned int size, long f_type)
>  {
>  	const char *dev;
>  	unsigned int acq_dev_size;
>  	uint64_t ltp_dev_size;
> +	unsigned int min_size = tst_min_fs_size(f_type);
> +
> +	if (size && size < min_size) {
> +		tst_brkm(TBROK, NULL, "Request device size %u smaller than min size: %u",
> +				 size, min_size);
> +		return NULL;
> +	}
>  
> -	acq_dev_size = size ? size : DEV_SIZE_MB;
> +	acq_dev_size = size ?: min_size;
>  
>  	dev = getenv("LTP_DEV");
>  
> @@ -325,7 +349,7 @@ const char *tst_acquire_device__(unsigned int size)
>  	return dev;
>  }
>  
> -const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
> +const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size, long f_type)
>  {
>  	const char *device;
>  
> @@ -340,7 +364,7 @@ const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
>  		return NULL;
>  	}
>  
> -	device = tst_acquire_device__(size);
> +	device = tst_acquire_device__(size, f_type);
>  
>  	if (!device) {
>  		tst_brkm(TBROK, cleanup_fn, "Failed to acquire device");
> diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
> index de4facef5..49db2fff7 100644
> --- a/lib/tst_fs_type.c
> +++ b/lib/tst_fs_type.c
> @@ -43,6 +43,34 @@ long tst_fs_type_(void (*cleanup)(void), const char *path)
>  	return sbuf.f_type;
>  }
>  
> +long tst_fs_name_type(const char *fs)
> +{
> +	if (!strcmp(fs, "btrfs"))
> +		return TST_BTRFS_MAGIC;
> +	else if (!strcmp(fs, "exfat"))
> +		return TST_EXFAT_MAGIC;
> +	else if (!strcmp(fs, "ext2"))
> +		return TST_EXT2_OLD_MAGIC;

I'm not sure that this is a correct mapping, I think that all ext
filesystems goes by EXT234_MAGIC these days.

> +	else if (!strcmp(fs, "ext3") || !strcmp(fs, "ext4"))
> +		return TST_EXT234_MAGIC;
> +	else if (!strcmp(fs, "minix"))
> +		return TST_MINIX3_MAGIC;
> +	else if (!strcmp(fs, "msdos"))
> +		return TST_VFAT_MAGIC;
> +	else if (!strcmp(fs, "ntfs"))
> +		return TST_NTFS_MAGIC;
> +	else if (!strcmp(fs, "squashfs"))
> +		return TST_SQUASHFS_MAGIC;
> +	else if (!strcmp(fs, "tmpfs"))
> +		return TST_TMPFS_MAGIC;
> +	else if (!strcmp(fs, "vfat"))
> +		return TST_VFAT_MAGIC;
> +	else if (!strcmp(fs, "xfs"))
> +		return TST_XFS_MAGIC;
> +
> +	return -1;
> +}
> +
>  const char *tst_fs_type_name(long f_type)
>  {
>  	switch (f_type) {
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 657348732..bfc40554f 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1225,7 +1225,12 @@ static void do_setup(int argc, char *argv[])
>  	}
>  
>  	if (tst_test->needs_device && !mntpoint_mounted) {
> -		tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size);
> +		long f_type = tst_fs_name_type(tst_test->dev_fs_type ?: DEFAULT_FS_TYPE);
> +
> +		if (tst_test->all_filesystems)
> +			f_type = TST_ALL_FILESYSTEMS;
> +
> +		tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size, f_type);
>  
>  		if (!tdev.dev)
>  			tst_brk(TCONF, "Failed to acquire device");
> diff --git a/testcases/kernel/fs/squashfs/squashfs01.c b/testcases/kernel/fs/squashfs/squashfs01.c
> index 502de419d..d7f91c129 100644
> --- a/testcases/kernel/fs/squashfs/squashfs01.c
> +++ b/testcases/kernel/fs/squashfs/squashfs01.c
> @@ -104,6 +104,7 @@ static struct tst_test test = {
>  	.needs_root = 1,
>  	.needs_device = 1,
>  	.dev_min_size = 1,
> +	.dev_fs_type = "squashfs",
>  	.needs_cmds = (const char *const []) {
>  		"mksquashfs",
>  		NULL
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify05.c b/testcases/kernel/syscalls/fanotify/fanotify05.c
> index 04670cb1c..a4bc5ef54 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify05.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify05.c
> @@ -215,6 +215,7 @@ static struct tst_test test = {
>  	.needs_root = 1,
>  	.mount_device = 1,
>  	.mntpoint = MOUNT_PATH,
> +	.dev_min_size = 65,
>  };
>  #else
>  	TST_TEST_TCONF("system doesn't have required fanotify support");
> diff --git a/testcases/kernel/syscalls/preadv2/preadv203.c b/testcases/kernel/syscalls/preadv2/preadv203.c
> index 60dc4a882..8c08c86ea 100644
> --- a/testcases/kernel/syscalls/preadv2/preadv203.c
> +++ b/testcases/kernel/syscalls/preadv2/preadv203.c
> @@ -280,4 +280,5 @@ static struct tst_test test = {
>  	.all_filesystems = 1,
>  	.max_runtime = 60,
>  	.needs_root = 1,
> +	.dev_min_size = 230,
>  };
> diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
> index 4fa8cfaf8..07a5172fc 100644
> --- a/testcases/kernel/syscalls/readahead/readahead02.c
> +++ b/testcases/kernel/syscalls/readahead/readahead02.c
> @@ -406,6 +406,7 @@ static struct tst_test test = {
>  	},
>  	.test = test_readahead,
>  	.tcnt = ARRAY_SIZE(tcases),
> +	.dev_min_size = 135,
>  	.tags = (const struct tst_tag[]) {
>  		{"linux-git", "b833a3660394"},
>  		{"linux-git", "5b910bd615ba"},
> diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
> index d6b74a5ff..b76abf52b 100644
> --- a/testcases/lib/tst_device.c
> +++ b/testcases/lib/tst_device.c
> @@ -43,7 +43,7 @@ static int acquire_device(int argc, char *argv[])
>  	if (argc >= 4)
>  		device = tst_acquire_loop_device(size, argv[3]);
>  	else
> -		device = tst_acquire_device__(size);
> +		device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS);
>  
>  	if (!device)
>  		return 1;
> -- 
> 2.37.2
> 

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs
  2022-08-27  0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
@ 2022-08-29 11:00   ` Cyril Hrubis
  2022-08-30  6:12   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 11:00 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 4/6] tst_device: Use getopts
  2022-08-27  0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
@ 2022-08-29 11:03   ` Cyril Hrubis
  2022-08-29 11:42     ` Petr Vorel
  2022-08-30  6:14   ` [LTP] " Li Wang
  1 sibling, 1 reply; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 11:03 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
> size and filesystems are passed by -s and -f flags.
> That will help to pass used filesystem.

This part should be in the next commit description.

> When it, add also -h.

"When at it, ..."


Otherwise it looks good.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 5/6] tst_device: Add support -f filesystem
  2022-08-27  0:28 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Petr Vorel
@ 2022-08-29 11:04   ` Cyril Hrubis
  2022-08-30  6:14   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 11:04 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
Looks good.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device
  2022-08-27  0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
@ 2022-08-29 11:05   ` Cyril Hrubis
  2022-08-30  6:16   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 11:05 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem
  2022-08-29 10:58   ` Cyril Hrubis
@ 2022-08-29 11:29     ` Petr Vorel
  2022-08-29 12:24       ` [LTP] [Automated-testing] " Cyril Hrubis
  2022-08-30  6:11     ` [LTP] " Li Wang
  1 sibling, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2022-08-29 11:29 UTC (permalink / raw)
  To: Cyril Hrubis
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi Cyril,

thanks a lot for a review!

...
> > +++ b/include/tst_fs.h
...
> > +unsigned int tst_min_fs_size(long f_type)
> > +{
> > +	switch (f_type) {
> > +	case 0:

> TST_ALL_FILESYSTEMS ?

Thanks for catching this. Mistake which is a result of very late Friday night coding.

> > +		return MAX(DEV_SIZE_MB_BTRFS, DEV_SIZE_MB_DEFAULT);

> I do not think that we should harcode this here. I would be for a more
> dynamic approach, i.e. add a function into the tst_supported_fs_types.c
> that loops over supported filesystems and chooses max over the minimal
> values for all supported filesystems. That way if we run on embedded
> targets the device size will be 16MB as long as btrfs-progs is not
> installed. Also that way we can easily define minimal size for xfs 300MB
> and things will work for embedded as long as xfs-progs are not
> installed.
Correct. So the value for .all_filesystems should be maximum of supported
filesystems. The only think I don't like about it that it takes some time to
check everything (mkfs.* available ... etc), but we can't avoid it.

Is it worth to cache this value (make it static in the function) so that it's not
searched more than once?

> > +	case TST_BTRFS_MAGIC:
> > +		return DEV_SIZE_MB_BTRFS;
> > +	case TST_SQUASHFS_MAGIC:
> > +		return DEV_SIZE_MB_SQUASHFS;
> > +	default:
> > +		return DEV_SIZE_MB_DEFAULT;
> > +	}
> > +}
...
> > +++ b/lib/tst_fs_type.c
> > @@ -43,6 +43,34 @@ long tst_fs_type_(void (*cleanup)(void), const char *path)
> >  	return sbuf.f_type;
> >  }

> > +long tst_fs_name_type(const char *fs)
> > +{
> > +	if (!strcmp(fs, "btrfs"))
> > +		return TST_BTRFS_MAGIC;
> > +	else if (!strcmp(fs, "exfat"))
> > +		return TST_EXFAT_MAGIC;
> > +	else if (!strcmp(fs, "ext2"))
> > +		return TST_EXT2_OLD_MAGIC;

> I'm not sure that this is a correct mapping, I think that all ext
> filesystems goes by EXT234_MAGIC these days.
OK, I'll dig into kernel's fs/ext{2,4}/
The problem is, that we still theoretically support kernel 3.0,
thus old kernels are likely using this approach and newer not.
Let's see if and when it was changed.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem
  2022-08-29 10:43 ` [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem Cyril Hrubis
@ 2022-08-29 11:39   ` Petr Vorel
  2022-08-30  5:52     ` Li Wang
  0 siblings, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2022-08-29 11:39 UTC (permalink / raw)
  To: Cyril Hrubis
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi Cyril,

> Hi!
> > This patchset require to be on the top of:

> > [RFC,1/1] API: Allow to use xfs filesystems < 300 MB
> > https://lore.kernel.org/ltp/20220817204015.31420-1-pvorel@suse.cz/
> > https://patchwork.ozlabs.org/project/ltp/patch/20220817204015.31420-1-pvorel@suse.cz/

> I'm not that sure if we want to run tests for xfs filesystem that is
> smaller than minimal size used in production. I bet that we will cover
> different codepaths that eventually end up being used in production
> that way.

	> > LTP community: do we want to depend on this behavior or we just increase from 256MB to 301 MB
	> > (either for XFS or for all). It might not be a good idea to test size users are required
	> > to use.

	> It might *not*? <confused>
	Again, I'm sorry, missing another not. I.e. I suppose normal users will not try
	to go below 301MB, therefore LTP probably should not do it either. That's why
	RFC.

@Darrick, others (kernel/LTP maintainers, embedded folks) WDYT?

I'm personally OK to use 300 MB (safer to use code paths which are used in
production), it's just that for older kernels even with xfs-progs installed it's
unnecessary boundary. We could base XFS size on runtime kernel, but unless it's
300 MB a real problem for anybody I would not address it. i.e. is there anybody
using XFS on old kernels? (old LTS, whey sooner or later need to use these
variables themselves).

Kind regards,
Petr

[1] https://lore.kernel.org/ltp/Yv4ABHlsP+BZ3bRD@pevik/

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 4/6] tst_device: Use getopts
  2022-08-29 11:03   ` [LTP] [Automated-testing] " Cyril Hrubis
@ 2022-08-29 11:42     ` Petr Vorel
  0 siblings, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-29 11:42 UTC (permalink / raw)
  To: Cyril Hrubis
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi Cyril,

> Hi!
> > size and filesystems are passed by -s and -f flags.
> > That will help to pass used filesystem.

> This part should be in the next commit description.

> > When it, add also -h.

> "When at it, ..."


> Otherwise it looks good.

Thanks for catching these!
I'll fix them in v2.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 2/6] API: tst_device: Track minimal size per filesystem
  2022-08-29 11:29     ` Petr Vorel
@ 2022-08-29 12:24       ` Cyril Hrubis
  0 siblings, 0 replies; 30+ messages in thread
From: Cyril Hrubis @ 2022-08-29 12:24 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, ltp, automated-testing

Hi!
> > I do not think that we should harcode this here. I would be for a more
> > dynamic approach, i.e. add a function into the tst_supported_fs_types.c
> > that loops over supported filesystems and chooses max over the minimal
> > values for all supported filesystems. That way if we run on embedded
> > targets the device size will be 16MB as long as btrfs-progs is not
> > installed. Also that way we can easily define minimal size for xfs 300MB
> > and things will work for embedded as long as xfs-progs are not
> > installed.
> Correct. So the value for .all_filesystems should be maximum of supported
> filesystems. The only think I don't like about it that it takes some time to
> check everything (mkfs.* available ... etc), but we can't avoid it.
> 
> Is it worth to cache this value (make it static in the function) so that it's not
> searched more than once?

Actually all we would need is a flag that would just return the pointer
to the fs_types array from the tst_get_supported_fs_types() on second
and subsequent calls.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
  2022-08-29 10:44   ` Cyril Hrubis
@ 2022-08-29 15:46   ` Bird, Tim
  2022-08-29 16:14     ` Petr Vorel
  2022-08-30  5:59   ` Li Wang
  2 siblings, 1 reply; 30+ messages in thread
From: Bird, Tim @ 2022-08-29 15:46 UTC (permalink / raw)
  To: Petr Vorel, ltp
  Cc: Richard Palethorpe, Joerg Vehlow, linux-fsdevel, automated-testing

Minor nit, but the subject line has nsfs when I think it means ntfs.
 -- Tim

> -----Original Message-----
> From: Petr Vorel <pvorel@suse.cz>
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  include/tst_fs.h  | 5 ++++-
>  lib/tst_fs_type.c | 6 ++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/include/tst_fs.h b/include/tst_fs.h
> index 8159b99eb..a6f934b0f 100644
> --- a/include/tst_fs.h
> +++ b/include/tst_fs.h
> @@ -5,7 +5,7 @@
>  #ifndef TST_FS_H__
>  #define TST_FS_H__
> 
> -/* man 2 statfs or kernel-source/include/linux/magic.h */
> +/* man 2 statfs or kernel-source/include/uapi/linux/magic.h */
>  #define TST_BTRFS_MAGIC    0x9123683E
>  #define TST_NFS_MAGIC      0x6969
>  #define TST_RAMFS_MAGIC    0x858458f6
> @@ -32,6 +32,9 @@
>  #define TST_FUSE_MAGIC     0x65735546
>  #define TST_VFAT_MAGIC     0x4d44 /* AKA MSDOS */
>  #define TST_EXFAT_MAGIC    0x2011BAB0UL
> +#define TST_SQUASHFS_MAGIC 0x73717368
> +/* kernel-source/fs/ntfs/ntfs.h */
> +#define TST_NTFS_MAGIC     0x5346544e
> 
>  enum {
>  	TST_BYTES = 1,
> diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
> index 9de80224b..de4facef5 100644
> --- a/lib/tst_fs_type.c
> +++ b/lib/tst_fs_type.c
> @@ -88,6 +88,12 @@ const char *tst_fs_type_name(long f_type)
>  		return "fuse";
>  	case TST_EXFAT_MAGIC:
>  		return "exfat";
> +	case TST_NTFS_MAGIC:
> +		return "ntfs";
> +	case TST_SQUASHFS_MAGIC:
> +		return "squashfs";
> +	case TST_VFAT_MAGIC:
> +		return "vfat";
>  	default:
>  		return "unknown";
>  	}
> --
> 2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-29 15:46   ` Bird, Tim
@ 2022-08-29 16:14     ` Petr Vorel
  2022-08-29 16:35       ` Bird, Tim
  0 siblings, 1 reply; 30+ messages in thread
From: Petr Vorel @ 2022-08-29 16:14 UTC (permalink / raw)
  To: Bird, Tim
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, ltp, automated-testing

Hi Tim,

> Minor nit, but the subject line has nsfs when I think it means ntfs.
>  -- Tim
Thanks, will be fixed in v2.

How about XFS using 300 MB vs 16 MB but using different code paths?
How big deal it'd be if we require 300 MB in case testing on kernel with XFS
enabled and xfsprogs installed?

https://lore.kernel.org/ltp/YwyYUzvlxfIGpTwo@yuki/
https://lore.kernel.org/ltp/YwyljsgYIK3AvUr+@pevik/

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-29 16:14     ` Petr Vorel
@ 2022-08-29 16:35       ` Bird, Tim
  2022-08-29 16:49         ` Petr Vorel
  0 siblings, 1 reply; 30+ messages in thread
From: Bird, Tim @ 2022-08-29 16:35 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, ltp, automated-testing



> -----Original Message-----
> From: Petr Vorel <pvorel@suse.cz>
> Hi Tim,
> 
> > Minor nit, but the subject line has nsfs when I think it means ntfs.
> >  -- Tim
> Thanks, will be fixed in v2.
> 
> How about XFS using 300 MB vs 16 MB but using different code paths?
> How big deal it'd be if we require 300 MB in case testing on kernel with XFS
> enabled and xfsprogs installed?
> 
> https://lore.kernel.org/ltp/YwyYUzvlxfIGpTwo@yuki/
> https://lore.kernel.org/ltp/YwyljsgYIK3AvUr+@pevik/

I'm not personally aware of any uses of XFS in embedded projects, let alone
ones with a filesystem size of less than 300 MB.  So I think it would be OK.
Such a test might hit some lightly used codepaths, so it might have more likelihood
to reveal a bug in XFS.  But if literally no one is using XFS in this configuration,
I'm not sure how valuable the testing would be.

That said, my knowledge of the embedded ecosystem is not comprehensive.
I just posted a question about this on the celinux-dev and Linux-embedded
mailing lists.  I let you know if I hear of anyone using an XFS filesystem less
than 300 MB in size in their embedded Linux project or device.
 -- Tim


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-29 16:35       ` Bird, Tim
@ 2022-08-29 16:49         ` Petr Vorel
  0 siblings, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-29 16:49 UTC (permalink / raw)
  To: Bird, Tim
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, ltp, automated-testing



> > -----Original Message-----
> > From: Petr Vorel <pvorel@suse.cz>
> > Hi Tim,

> > > Minor nit, but the subject line has nsfs when I think it means ntfs.
> > >  -- Tim
> > Thanks, will be fixed in v2.

> > How about XFS using 300 MB vs 16 MB but using different code paths?
> > How big deal it'd be if we require 300 MB in case testing on kernel with XFS
> > enabled and xfsprogs installed?

> > https://lore.kernel.org/ltp/YwyYUzvlxfIGpTwo@yuki/
> > https://lore.kernel.org/ltp/YwyljsgYIK3AvUr+@pevik/

> I'm not personally aware of any uses of XFS in embedded projects, let alone
> ones with a filesystem size of less than 300 MB.  So I think it would be OK.
> Such a test might hit some lightly used codepaths, so it might have more likelihood
> to reveal a bug in XFS.  But if literally no one is using XFS in this configuration,
> I'm not sure how valuable the testing would be.

> That said, my knowledge of the embedded ecosystem is not comprehensive.
> I just posted a question about this on the celinux-dev and Linux-embedded
> mailing lists.  I let you know if I hear of anyone using an XFS filesystem less
> than 300 MB in size in their embedded Linux project or device.
>  -- Tim

Thanks a lot, Tim!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem
  2022-08-29 11:39   ` Petr Vorel
@ 2022-08-30  5:52     ` Li Wang
  2022-08-30  8:18       ` Petr Vorel
  0 siblings, 1 reply; 30+ messages in thread
From: Li Wang @ 2022-08-30  5:52 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 1806 bytes --]

Hi Petr, All,

On Mon, Aug 29, 2022 at 7:40 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Cyril,
>
> > Hi!
> > > This patchset require to be on the top of:
>
> > > [RFC,1/1] API: Allow to use xfs filesystems < 300 MB
> > > https://lore.kernel.org/ltp/20220817204015.31420-1-pvorel@suse.cz/
> > >
> https://patchwork.ozlabs.org/project/ltp/patch/20220817204015.31420-1-pvorel@suse.cz/
>
> > I'm not that sure if we want to run tests for xfs filesystem that is
> > smaller than minimal size used in production. I bet that we will cover
> > different codepaths that eventually end up being used in production
> > that way.
>
>         > > LTP community: do we want to depend on this behavior or we
> just increase from 256MB to 301 MB
>         > > (either for XFS or for all). It might not be a good idea to
> test size users are required
>         > > to use.
>
>         > It might *not*? <confused>
>         Again, I'm sorry, missing another not. I.e. I suppose normal users
> will not try
>         to go below 301MB, therefore LTP probably should not do it either.
> That's why
>         RFC.
>
> @Darrick, others (kernel/LTP maintainers, embedded folks) WDYT?
>
> I'm personally OK to use 300 MB (safer to use code paths which are used in
> production), it's just that for older kernels even with xfs-progs
> installed it's
> unnecessary boundary. We could base XFS size on runtime kernel, but unless
> it's
> 300 MB a real problem for anybody I would not address it. i.e. is there
> anybody
> using XFS on old kernels? (old LTS, whey sooner or later need to use these
> variables themselves).
>

Another compromised way I can think of is to let LTP choose
300MB for XFS by default, if the test bed can't provide that size,
simply go back to try 16MB.  Does this sound acceptable?

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 2901 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name()
  2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
  2022-08-29 10:44   ` Cyril Hrubis
  2022-08-29 15:46   ` Bird, Tim
@ 2022-08-30  5:59   ` Li Wang
  2 siblings, 0 replies; 30+ messages in thread
From: Li Wang @ 2022-08-30  5:59 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 63 bytes --]

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 355 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem
  2022-08-29 10:58   ` Cyril Hrubis
  2022-08-29 11:29     ` Petr Vorel
@ 2022-08-30  6:11     ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Li Wang @ 2022-08-30  6:11 UTC (permalink / raw)
  To: Cyril Hrubis
  Cc: Richard Palethorpe, Joerg Vehlow, LTP List, automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 754 bytes --]

Cyril Hrubis <chrubis@suse.cz> wrote:


>
> > +             return MAX(DEV_SIZE_MB_BTRFS, DEV_SIZE_MB_DEFAULT);
>
> I do not think that we should harcode this here. I would be for a more
> dynamic approach, i.e. add a function into the tst_supported_fs_types.c
> that loops over supported filesystems and chooses max over the minimal
> values for all supported filesystems. That way if we run on embedded
> targets the device size will be 16MB as long as btrfs-progs is not
> installed. Also that way we can easily define minimal size for xfs 300MB
> and things will work for embedded as long as xfs-progs are not
> installed.
>

+1 this is a quite good suggestion that solved what we were concerned about
different XFS code paths.

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 1301 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs
  2022-08-27  0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
  2022-08-29 11:00   ` Cyril Hrubis
@ 2022-08-30  6:12   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Li Wang @ 2022-08-30  6:12 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 63 bytes --]

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 394 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 4/6] tst_device: Use getopts
  2022-08-27  0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
  2022-08-29 11:03   ` [LTP] [Automated-testing] " Cyril Hrubis
@ 2022-08-30  6:14   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Li Wang @ 2022-08-30  6:14 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 106 bytes --]

With fix the tiny issues in description.

Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 613 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 5/6] tst_device: Add support -f filesystem
  2022-08-27  0:28 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Petr Vorel
  2022-08-29 11:04   ` Cyril Hrubis
@ 2022-08-30  6:14   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Li Wang @ 2022-08-30  6:14 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 63 bytes --]

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 431 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device
  2022-08-27  0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
  2022-08-29 11:05   ` Cyril Hrubis
@ 2022-08-30  6:16   ` Li Wang
  1 sibling, 0 replies; 30+ messages in thread
From: Li Wang @ 2022-08-30  6:16 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing


[-- Attachment #1.1: Type: text/plain, Size: 110 bytes --]

Hi Petr,

Nice work on this patchset. Thanks!

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 598 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem
  2022-08-30  5:52     ` Li Wang
@ 2022-08-30  8:18       ` Petr Vorel
  0 siblings, 0 replies; 30+ messages in thread
From: Petr Vorel @ 2022-08-30  8:18 UTC (permalink / raw)
  To: Li Wang
  Cc: Joerg Vehlow, linux-fsdevel, Richard Palethorpe, LTP List,
	automated-testing

> Hi Petr, All,

> On Mon, Aug 29, 2022 at 7:40 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Cyril,

> > > Hi!
> > > > This patchset require to be on the top of:

> > > > [RFC,1/1] API: Allow to use xfs filesystems < 300 MB
> > > > https://lore.kernel.org/ltp/20220817204015.31420-1-pvorel@suse.cz/

> > https://patchwork.ozlabs.org/project/ltp/patch/20220817204015.31420-1-pvorel@suse.cz/

> > > I'm not that sure if we want to run tests for xfs filesystem that is
> > > smaller than minimal size used in production. I bet that we will cover
> > > different codepaths that eventually end up being used in production
> > > that way.

> >         > > LTP community: do we want to depend on this behavior or we
> > just increase from 256MB to 301 MB
> >         > > (either for XFS or for all). It might not be a good idea to
> > test size users are required
> >         > > to use.

> >         > It might *not*? <confused>
> >         Again, I'm sorry, missing another not. I.e. I suppose normal users
> > will not try
> >         to go below 301MB, therefore LTP probably should not do it either.
> > That's why
> >         RFC.

> > @Darrick, others (kernel/LTP maintainers, embedded folks) WDYT?

> > I'm personally OK to use 300 MB (safer to use code paths which are used in
> > production), it's just that for older kernels even with xfs-progs
> > installed it's
> > unnecessary boundary. We could base XFS size on runtime kernel, but unless
> > it's
> > 300 MB a real problem for anybody I would not address it. i.e. is there
> > anybody
> > using XFS on old kernels? (old LTS, whey sooner or later need to use these
> > variables themselves).


> Another compromised way I can think of is to let LTP choose
> 300MB for XFS by default, if the test bed can't provide that size,
> simply go back to try 16MB.  Does this sound acceptable?

I'll try to have look into this, but it'd would be quite special case given we
don't try to detect and recovery mkfs.* failures.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2022-08-30  8:19 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
2022-08-29 10:44   ` Cyril Hrubis
2022-08-29 15:46   ` Bird, Tim
2022-08-29 16:14     ` Petr Vorel
2022-08-29 16:35       ` Bird, Tim
2022-08-29 16:49         ` Petr Vorel
2022-08-30  5:59   ` Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem Petr Vorel
2022-08-29 10:58   ` Cyril Hrubis
2022-08-29 11:29     ` Petr Vorel
2022-08-29 12:24       ` [LTP] [Automated-testing] " Cyril Hrubis
2022-08-30  6:11     ` [LTP] " Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
2022-08-29 11:00   ` Cyril Hrubis
2022-08-30  6:12   ` Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
2022-08-29 11:03   ` [LTP] [Automated-testing] " Cyril Hrubis
2022-08-29 11:42     ` Petr Vorel
2022-08-30  6:14   ` [LTP] " Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Petr Vorel
2022-08-29 11:04   ` Cyril Hrubis
2022-08-30  6:14   ` Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
2022-08-29 11:05   ` Cyril Hrubis
2022-08-30  6:16   ` Li Wang
2022-08-29 10:43 ` [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem Cyril Hrubis
2022-08-29 11:39   ` Petr Vorel
2022-08-30  5:52     ` Li Wang
2022-08-30  8:18       ` Petr Vorel

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 NNTP newsgroup(s).