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.

Non-overridden default `xattr` prop of existing pools
will automatically use `sa` after this commit too.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #15147
This commit is contained in:
George Melikov 2024-09-23 19:50:48 +03:00 committed by GitHub
parent 1d84c9eb66
commit e419a63bf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 12 deletions

View File

@ -1971,14 +1971,13 @@ enabled for virus scanning to occur.
The default value is The default value is
.Sy off . .Sy off .
This property is not used by OpenZFS. 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. Controls whether extended attributes are enabled for this file system.
Two styles of extended attributes are supported: either directory-based Two styles of extended attributes are supported: either directory-based
or system-attribute-based. or system-attribute-based.
.Pp .Pp
The default value of Directory-based extended attributes can be enabled by setting the value to
.Sy on .Sy dir .
enables directory-based extended attributes.
This style of extended attribute imposes no practical limit This style of extended attribute imposes no practical limit
on either the size or number of attributes which can be set on a file. on either the size or number of attributes which can be set on a file.
Although under Linux the Although under Linux the
@ -1991,7 +1990,10 @@ This is the most compatible
style of extended attribute and is supported by all ZFS implementations. style of extended attribute and is supported by all ZFS implementations.
.Pp .Pp
System-attribute-based xattrs can be enabled by setting the value to 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. The key advantage of this type of xattr is improved performance.
Storing extended attributes as system attributes Storing extended attributes as system attributes
significantly decreases the amount of disk I/O required. significantly decreases the amount of disk I/O required.

View File

@ -164,7 +164,7 @@ zfsvfs_parse_option(char *option, int token, substring_t *args, vfs_t *vfsp)
vfsp->vfs_do_xattr = B_TRUE; vfsp->vfs_do_xattr = B_TRUE;
break; break;
case TOKEN_XATTR: case TOKEN_XATTR:
vfsp->vfs_xattr = ZFS_XATTR_DIR; vfsp->vfs_xattr = ZFS_XATTR_SA;
vfsp->vfs_do_xattr = B_TRUE; vfsp->vfs_do_xattr = B_TRUE;
break; break;
case TOKEN_NOXATTR: case TOKEN_NOXATTR:

View File

@ -362,7 +362,7 @@ zfs_prop_init(void)
static const zprop_index_t xattr_table[] = { static const zprop_index_t xattr_table[] = {
{ "off", ZFS_XATTR_OFF }, { "off", ZFS_XATTR_OFF },
{ "on", ZFS_XATTR_DIR }, { "on", ZFS_XATTR_SA },
{ "sa", ZFS_XATTR_SA }, { "sa", ZFS_XATTR_SA },
{ "dir", ZFS_XATTR_DIR }, { "dir", ZFS_XATTR_DIR },
{ NULL } { NULL }
@ -475,7 +475,7 @@ zfs_prop_init(void)
zprop_register_index(ZFS_PROP_LOGBIAS, "logbias", ZFS_LOGBIAS_LATENCY, zprop_register_index(ZFS_PROP_LOGBIAS, "logbias", ZFS_LOGBIAS_LATENCY,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"latency | throughput", "LOGBIAS", logbias_table, sfeatures); "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, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT,
"on | off | dir | sa", "XATTR", xattr_table, sfeatures); "on | off | dir | sa", "XATTR", xattr_table, sfeatures);
zprop_register_index(ZFS_PROP_DNODESIZE, "dnodesize", zprop_register_index(ZFS_PROP_DNODESIZE, "dnodesize",

View File

@ -59,7 +59,7 @@ log_onexit cleanup
log_assert "Check changing project ID with directory-based extended attributes" log_assert "Check changing project ID with directory-based extended attributes"
log_must zfs set xattr=on $QFS log_must zfs set xattr=dir $QFS
log_must touch $PRJGUARD log_must touch $PRJGUARD
log_must chattr -p $PRJID1 $PRJGUARD log_must chattr -p $PRJID1 $PRJGUARD
@ -76,6 +76,6 @@ sync_pool
typeset prj_aft=$(project_obj_count $QFS $PRJID1) typeset prj_aft=$(project_obj_count $QFS $PRJID1)
[[ $prj_aft -ge $((prj_bef + 5)) ]] || [[ $prj_aft -ge $((prj_bef + 5)) ]] ||
log_fail "new value ($prj_aft) is NOT 5 largr than old one ($prj_bef)" log_fail "new value ($prj_aft) is NOT 5 larger than old one ($prj_bef)"
log_pass "Changing project ID with directory-based extended attributes pass" log_pass "Changing project ID with directory-based extended attributes pass"

View File

@ -52,7 +52,7 @@ function cleanup {
fi fi
} }
set -A args "on" "sa" set -A args "dir" "sa"
log_assert "Create/read/write/append of xattrs works" log_assert "Create/read/write/append of xattrs works"
log_onexit cleanup log_onexit cleanup

View File

@ -46,7 +46,7 @@ function cleanup {
} }
set -A args "on" "sa" set -A args "dir" "sa"
log_assert "A read of a non-existent xattr fails" log_assert "A read of a non-existent xattr fails"
log_onexit cleanup log_onexit cleanup