* [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection
@ 2025-09-23 15:32 Martin Doucha
2025-09-24 8:48 ` Cyril Hrubis
0 siblings, 1 reply; 6+ messages in thread
From: Martin Doucha @ 2025-09-23 15:32 UTC (permalink / raw)
To: andrea.cervesato, ltp
Copy on write XFS features require reflink support. Enable it in mkfs
options for older systems which don't enable it by default and mount
the filesystem explicitly with checks for feature support.
Also use the correct (filesystem) blocksize instead of block device
blocksize.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
.../kernel/syscalls/file_attr/file_attr02.c | 30 ++++++++++++++-----
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/file_attr/file_attr02.c b/testcases/kernel/syscalls/file_attr/file_attr02.c
index 4e0d87f0f..d565a2687 100644
--- a/testcases/kernel/syscalls/file_attr/file_attr02.c
+++ b/testcases/kernel/syscalls/file_attr/file_attr02.c
@@ -41,9 +41,18 @@ static void run(void)
static void setup(void)
{
- int block_size;
+ struct stat statbuf;
- block_size = tst_dev_block_size(MNTPOINT);
+ SAFE_MKDIR(MNTPOINT, 0755);
+ TEST(mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL));
+
+ if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
+ tst_brk(TCONF, "Kernel does not support XFS reflinks");
+
+ if (TST_RET)
+ tst_brk(TBROK | TTERRNO, "Mount failed");
+
+ SAFE_STAT(MNTPOINT, &statbuf);
dfd = SAFE_OPEN(MNTPOINT, O_RDONLY);
fd = SAFE_CREAT(MNTPOINT "/" FILENAME, 0777);
@@ -52,8 +61,8 @@ static void setup(void)
xattr.fsx_xflags |= FS_XFLAG_EXTSIZE;
xattr.fsx_xflags |= FS_XFLAG_COWEXTSIZE;
- xattr.fsx_extsize = BLOCKS * block_size;
- xattr.fsx_cowextsize = BLOCKS * block_size;
+ xattr.fsx_extsize = BLOCKS * statbuf.st_blksize;
+ xattr.fsx_cowextsize = BLOCKS * statbuf.st_blksize;
xattr.fsx_projid = PROJID;
SAFE_IOCTL(fd, FS_IOC_FSSETXATTR, &xattr);
@@ -72,17 +81,24 @@ static void cleanup(void)
if (dfd != -1)
SAFE_CLOSE(dfd);
+
+ if (tst_is_mounted(MNTPOINT))
+ SAFE_UMOUNT(MNTPOINT);
}
static struct tst_test test = {
.test_all = run,
.setup = setup,
.cleanup = cleanup,
- .mntpoint = MNTPOINT,
.needs_root = 1,
- .mount_device = 1,
+ .format_device = 1,
.filesystems = (struct tst_fs []) {
- {.type = "xfs"},
+ {
+ .type = "xfs",
+ .mkfs_opts = (const char *const[]){
+ "-m", "reflink=1", NULL
+ },
+ },
{}
},
.bufs = (struct tst_buffers []) {
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection
2025-09-23 15:32 [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection Martin Doucha
@ 2025-09-24 8:48 ` Cyril Hrubis
2025-09-24 8:54 ` Cyril Hrubis
2025-09-26 13:58 ` Cyril Hrubis
0 siblings, 2 replies; 6+ messages in thread
From: Cyril Hrubis @ 2025-09-24 8:48 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
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] 6+ messages in thread
* Re: [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection
2025-09-24 8:48 ` Cyril Hrubis
@ 2025-09-24 8:54 ` Cyril Hrubis
2025-09-26 12:46 ` Martin Doucha
2025-09-26 13:58 ` Cyril Hrubis
1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2025-09-24 8:54 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
And it looks like our CI builds fail because of implicit defintion of
the mount() function. I guess that we need to add #include <sys/mount.h>
before applying.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection
2025-09-24 8:54 ` Cyril Hrubis
@ 2025-09-26 12:46 ` Martin Doucha
2025-09-26 13:48 ` Cyril Hrubis
0 siblings, 1 reply; 6+ messages in thread
From: Martin Doucha @ 2025-09-26 12:46 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
On 9/24/25 10:54, Cyril Hrubis wrote:
> Hi!
> And it looks like our CI builds fail because of implicit defintion of
> the mount() function. I guess that we need to add #include <sys/mount.h>
> before applying.
Yes, please add it during merge. Or should I submit v2?
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection
2025-09-26 12:46 ` Martin Doucha
@ 2025-09-26 13:48 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2025-09-26 13:48 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
> > And it looks like our CI builds fail because of implicit defintion of
> > the mount() function. I guess that we need to add #include <sys/mount.h>
> > before applying.
>
> Yes, please add it during merge. Or should I submit v2?
I will fix that during the merge.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection
2025-09-24 8:48 ` Cyril Hrubis
2025-09-24 8:54 ` Cyril Hrubis
@ 2025-09-26 13:58 ` Cyril Hrubis
1 sibling, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2025-09-26 13:58 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-26 13:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 15:32 [LTP] [PATCH] file_attr02: Enable reflinks and fix blocksize detection Martin Doucha
2025-09-24 8:48 ` Cyril Hrubis
2025-09-24 8:54 ` Cyril Hrubis
2025-09-26 12:46 ` Martin Doucha
2025-09-26 13:48 ` Cyril Hrubis
2025-09-26 13:58 ` Cyril Hrubis
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.