All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@kernel.org>
To: ltp@lists.linux.it
Cc: linux-btrfs@vger.kernel.org, zlang@redhat.com
Subject: [PATCH 2/3] stat04+lstat03: fix bad blocksize mkfs option for xfs
Date: Sun,  1 Dec 2024 17:36:05 +0800	[thread overview]
Message-ID: <20241201093606.68993-3-zlang@kernel.org> (raw)
In-Reply-To: <20241201093606.68993-1-zlang@kernel.org>

Not all filesystems use "-b 1024" to set its blocksize. XFS uses
"-b size=1024", so this test fails as "unknown option -b 1024" on
xfs.

Signed-off-by: Zorro Lang <zlang@kernel.org>
---
 testcases/kernel/syscalls/lstat/lstat03.c | 8 ++++++--
 testcases/kernel/syscalls/stat/stat04.c   | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/lstat/lstat03.c b/testcases/kernel/syscalls/lstat/lstat03.c
index d48af180b..675fb56f4 100644
--- a/testcases/kernel/syscalls/lstat/lstat03.c
+++ b/testcases/kernel/syscalls/lstat/lstat03.c
@@ -44,8 +44,9 @@ static void run(void)
 
 static void setup(void)
 {
+	char *opt_name="-b";
 	char opt_bsize[32];
-	const char *const fs_opts[] = {opt_bsize, NULL};
+	const char *const fs_opts[] = {opt_name, opt_bsize, NULL};
 	struct stat sb;
 	int pagesize;
 	int fd;
@@ -54,7 +55,10 @@ static void setup(void)
 	SAFE_STAT(".", &sb);
 	pagesize = sb.st_blksize == 4096 ? 1024 : 4096;
 
-	snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", pagesize);
+	if (strcmp(tst_device->fs_type, "xfs") == 0)
+		snprintf(opt_bsize, sizeof(opt_bsize), "size=%i", pagesize);
+	else
+		snprintf(opt_bsize, sizeof(opt_bsize), "%i", pagesize);
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
 	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0);
 
diff --git a/testcases/kernel/syscalls/stat/stat04.c b/testcases/kernel/syscalls/stat/stat04.c
index 05ace606a..2a17cc7d7 100644
--- a/testcases/kernel/syscalls/stat/stat04.c
+++ b/testcases/kernel/syscalls/stat/stat04.c
@@ -43,8 +43,9 @@ static void run(void)
 
 static void setup(void)
 {
+	char *opt_name="-b";
 	char opt_bsize[32];
-	const char *const fs_opts[] = {opt_bsize, NULL};
+	const char *const fs_opts[] = {opt_name, opt_bsize, NULL};
 	struct stat sb;
 	int pagesize;
 	int fd;
@@ -56,7 +57,10 @@ static void setup(void)
 	SAFE_STAT(".", &sb);
 	pagesize = sb.st_blksize == 4096 ? 1024 : 4096;
 
-	snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", pagesize);
+	if (strcmp(tst_device->fs_type, "xfs") == 0)
+		snprintf(opt_bsize, sizeof(opt_bsize), "size=%i", pagesize);
+	else
+		snprintf(opt_bsize, sizeof(opt_bsize), "%i", pagesize);
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
 	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0);
 
-- 
2.45.2


WARNING: multiple messages have this Message-ID (diff)
From: Zorro Lang via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: linux-btrfs@vger.kernel.org
Subject: [LTP] [PATCH 2/3] stat04+lstat03: fix bad blocksize mkfs option for xfs
Date: Sun,  1 Dec 2024 17:36:05 +0800	[thread overview]
Message-ID: <20241201093606.68993-3-zlang@kernel.org> (raw)
In-Reply-To: <20241201093606.68993-1-zlang@kernel.org>

Not all filesystems use "-b 1024" to set its blocksize. XFS uses
"-b size=1024", so this test fails as "unknown option -b 1024" on
xfs.

Signed-off-by: Zorro Lang <zlang@kernel.org>
---
 testcases/kernel/syscalls/lstat/lstat03.c | 8 ++++++--
 testcases/kernel/syscalls/stat/stat04.c   | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/lstat/lstat03.c b/testcases/kernel/syscalls/lstat/lstat03.c
index d48af180b..675fb56f4 100644
--- a/testcases/kernel/syscalls/lstat/lstat03.c
+++ b/testcases/kernel/syscalls/lstat/lstat03.c
@@ -44,8 +44,9 @@ static void run(void)
 
 static void setup(void)
 {
+	char *opt_name="-b";
 	char opt_bsize[32];
-	const char *const fs_opts[] = {opt_bsize, NULL};
+	const char *const fs_opts[] = {opt_name, opt_bsize, NULL};
 	struct stat sb;
 	int pagesize;
 	int fd;
@@ -54,7 +55,10 @@ static void setup(void)
 	SAFE_STAT(".", &sb);
 	pagesize = sb.st_blksize == 4096 ? 1024 : 4096;
 
-	snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", pagesize);
+	if (strcmp(tst_device->fs_type, "xfs") == 0)
+		snprintf(opt_bsize, sizeof(opt_bsize), "size=%i", pagesize);
+	else
+		snprintf(opt_bsize, sizeof(opt_bsize), "%i", pagesize);
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
 	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0);
 
diff --git a/testcases/kernel/syscalls/stat/stat04.c b/testcases/kernel/syscalls/stat/stat04.c
index 05ace606a..2a17cc7d7 100644
--- a/testcases/kernel/syscalls/stat/stat04.c
+++ b/testcases/kernel/syscalls/stat/stat04.c
@@ -43,8 +43,9 @@ static void run(void)
 
 static void setup(void)
 {
+	char *opt_name="-b";
 	char opt_bsize[32];
-	const char *const fs_opts[] = {opt_bsize, NULL};
+	const char *const fs_opts[] = {opt_name, opt_bsize, NULL};
 	struct stat sb;
 	int pagesize;
 	int fd;
@@ -56,7 +57,10 @@ static void setup(void)
 	SAFE_STAT(".", &sb);
 	pagesize = sb.st_blksize == 4096 ? 1024 : 4096;
 
-	snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", pagesize);
+	if (strcmp(tst_device->fs_type, "xfs") == 0)
+		snprintf(opt_bsize, sizeof(opt_bsize), "size=%i", pagesize);
+	else
+		snprintf(opt_bsize, sizeof(opt_bsize), "%i", pagesize);
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
 	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0);
 
-- 
2.45.2


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

  parent reply	other threads:[~2024-12-01  9:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-01  9:36 [PATCH 0/3] LTP random fixes for xfs and btrfs Zorro Lang
2024-12-01  9:36 ` [LTP] " Zorro Lang via ltp
2024-12-01  9:36 ` [PATCH 1/3] ioctl_ficlone02.c: set all_filesystems to zero Zorro Lang
2024-12-01  9:36   ` [LTP] " Zorro Lang via ltp
2024-12-02 13:36   ` Cyril Hrubis
2024-12-02 13:36     ` Cyril Hrubis
2024-12-02 13:59     ` Cyril Hrubis
2024-12-02 13:59       ` Cyril Hrubis
2024-12-02 14:42       ` Petr Vorel
2024-12-02 14:42         ` Petr Vorel
2024-12-02 15:23         ` Cyril Hrubis
2024-12-02 15:23           ` Cyril Hrubis
2024-12-03  4:53           ` Petr Vorel
2024-12-03  4:53             ` Petr Vorel
2024-12-03  7:58             ` Cyril Hrubis
2024-12-03  7:58               ` Cyril Hrubis
2024-12-03  9:24               ` Petr Vorel
2024-12-03  9:24                 ` Petr Vorel
2024-12-09  5:53         ` Zorro Lang
2024-12-09  5:53           ` Zorro Lang via ltp
2024-12-09  6:14           ` Petr Vorel
2024-12-09  6:14             ` Petr Vorel
2024-12-09  9:49             ` Zorro Lang via ltp
2024-12-09 10:42               ` Petr Vorel
2024-12-09 11:34               ` Petr Vorel
2024-12-11 12:08             ` Cyril Hrubis
2024-12-11 12:08               ` Cyril Hrubis
2024-12-11 19:40               ` Petr Vorel
2024-12-11 19:40                 ` Petr Vorel
2024-12-01  9:36 ` Zorro Lang [this message]
2024-12-01  9:36   ` [LTP] [PATCH 2/3] stat04+lstat03: fix bad blocksize mkfs option for xfs Zorro Lang via ltp
2024-12-02 13:56   ` Cyril Hrubis
2024-12-02 13:56     ` Cyril Hrubis
2024-12-01  9:36 ` [PATCH 3/3] stat04+lstat03: skip test on btrfs Zorro Lang
2024-12-01  9:36   ` [LTP] " Zorro Lang via ltp
2024-12-02 13:55   ` Cyril Hrubis
2024-12-02 13:55     ` Cyril Hrubis
2024-12-01  9:55 ` [PATCH 0/3] LTP random fixes for xfs and btrfs Qu Wenruo
2024-12-01  9:55   ` [LTP] " Qu Wenruo via ltp
2024-12-03 16:22   ` David Sterba
2024-12-03 16:22     ` [LTP] " David Sterba

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=20241201093606.68993-3-zlang@kernel.org \
    --to=zlang@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=zlang@redhat.com \
    /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.