[PATCH v2] sysdeps: linux: Add BTRFS_SUPER_MAGIC to pathconf

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Wed Mar 5 14:32:35 GMT 2025



On 06/02/25 19:47, Ronan Pigott wrote:
> btrfs has a 65535 maximum link count. Include this value in pathconf to
> give the real max link count for this filesystem.
> 
> changes in v2:
>  - Keep the list of max link counts sorted

LGTM, thanks.  I will install this.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  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 6625e544bf46..975894277fb4 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 5ee17682e23e..87a0a3a76827 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;
>      }



More information about the Libc-alpha mailing list