From 0042287df1289c3da83e625fbfe42d538cee63cb Mon Sep 17 00:00:00 2001 From: George Melikov Date: Wed, 2 Aug 2023 21:13:56 +0300 Subject: [PATCH] xattr dataset prop: change defaults to sa It's the main recommendation to set xattr=sa even in man pages, so let's set it by default. xattr=sa don't use feature flag, so in the worst case we'll have non-readable xattrs by other non-openzfs platforms. Signed-off-by: George Melikov --- man/man7/zfsprops.7 | 12 +++++++----- module/os/linux/zfs/zfs_vfsops.c | 2 +- module/zcommon/zfs_prop.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/man/man7/zfsprops.7 b/man/man7/zfsprops.7 index 8f6b919cfc0b..c64acd7d5b65 100644 --- a/man/man7/zfsprops.7 +++ b/man/man7/zfsprops.7 @@ -1856,14 +1856,13 @@ enabled for virus scanning to occur. The default value is .Sy off . This property is not used by OpenZFS. -.It Sy xattr Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy sa +.It Sy xattr Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy dir Ns | Ns Sy sa Controls whether extended attributes are enabled for this file system. Two styles of extended attributes are supported: either directory-based or system-attribute-based. .Pp -The default value of -.Sy on -enables directory-based extended attributes. +directory-based extended attributes can be enabled by setting the value to +.Sy dir . This style of extended attribute imposes no practical limit on either the size or number of attributes which can be set on a file. Although under Linux the @@ -1876,7 +1875,10 @@ This is the most compatible style of extended attribute and is supported by all ZFS implementations. .Pp System-attribute-based xattrs can be enabled by setting the value to -.Sy sa . +.Sy sa +(default and equal to +.Sy on +) . The key advantage of this type of xattr is improved performance. Storing extended attributes as system attributes significantly decreases the amount of disk I/O required. diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 464c12e1108d..6bc324a83af8 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -163,7 +163,7 @@ zfsvfs_parse_option(char *option, int token, substring_t *args, vfs_t *vfsp) vfsp->vfs_do_xattr = B_TRUE; break; case TOKEN_XATTR: - vfsp->vfs_xattr = ZFS_XATTR_DIR; + vfsp->vfs_xattr = ZFS_XATTR_SA; vfsp->vfs_do_xattr = B_TRUE; break; case TOKEN_NOXATTR: diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index 3db6fd13f4ae..7589e175437c 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -354,7 +354,7 @@ zfs_prop_init(void) static const zprop_index_t xattr_table[] = { { "off", ZFS_XATTR_OFF }, - { "on", ZFS_XATTR_DIR }, + { "on", ZFS_XATTR_SA }, { "sa", ZFS_XATTR_SA }, { "dir", ZFS_XATTR_DIR }, { NULL } @@ -456,7 +456,7 @@ zfs_prop_init(void) zprop_register_index(ZFS_PROP_LOGBIAS, "logbias", ZFS_LOGBIAS_LATENCY, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "latency | throughput", "LOGBIAS", logbias_table, sfeatures); - zprop_register_index(ZFS_PROP_XATTR, "xattr", ZFS_XATTR_DIR, + zprop_register_index(ZFS_PROP_XATTR, "xattr", ZFS_XATTR_SA, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, "on | off | dir | sa", "XATTR", xattr_table, sfeatures); zprop_register_index(ZFS_PROP_DNODESIZE, "dnodesize",