From 50351e05707f982c06c6d4d7c8fc819f6a5f66f5 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Thu, 6 Feb 2025 15:47:57 -0700 Subject: [PATCH] sysdeps: linux: Add BTRFS_SUPER_MAGIC to pathconf btrfs has a 65535 maximum link count. Include this value in pathconf to give the real max link count for this filesystem. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/linux_fsinfo.h | 1 + sysdeps/unix/sysv/linux/pathconf.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sysdeps/unix/sysv/linux/linux_fsinfo.h b/sysdeps/unix/sysv/linux/linux_fsinfo.h index 6625e544bf..975894277f 100644 --- a/sysdeps/unix/sysv/linux/linux_fsinfo.h +++ b/sysdeps/unix/sysv/linux/linux_fsinfo.h @@ -251,6 +251,7 @@ #define XFS_SUPER_MAGIC 0x58465342 /* Maximum link counts. */ +#define BTRFS_LINK_MAX 65535 #define COH_LINK_MAX 10000 #define EXT2_LINK_MAX 32000 #define EXT4_LINK_MAX 65000 diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c index 5ee17682e2..87a0a3a768 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c +++ b/sysdeps/unix/sysv/linux/pathconf.c @@ -186,6 +186,9 @@ __statfs_link_max (int result, const struct statfs *fsbuf, const char *file, case LUSTRE_SUPER_MAGIC: return LUSTRE_LINK_MAX; + case BTRFS_SUPER_MAGIC: + return BTRFS_LINK_MAX; + default: return LINUX_LINK_MAX; }