diff --git a/man/man7/zfsprops.7 b/man/man7/zfsprops.7 index a3ae4d877f79..f33b663d1196 100644 --- a/man/man7/zfsprops.7 +++ b/man/man7/zfsprops.7 @@ -1971,14 +1971,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 @@ -1991,7 +1990,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 b28efd3c58cd..a6d1202e424f 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -164,7 +164,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 618e863c59a8..20cc0dffc27e 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -362,7 +362,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 } @@ -475,7 +475,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", diff --git a/tests/zfs-tests/tests/functional/projectquota/projectid_003_pos.ksh b/tests/zfs-tests/tests/functional/projectquota/projectid_003_pos.ksh index 93474b53709a..a66d61b686b3 100755 --- a/tests/zfs-tests/tests/functional/projectquota/projectid_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/projectquota/projectid_003_pos.ksh @@ -59,7 +59,7 @@ log_onexit cleanup 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 chattr -p $PRJID1 $PRJGUARD @@ -76,6 +76,6 @@ sync_pool typeset prj_aft=$(project_obj_count $QFS $PRJID1) [[ $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" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh index ab61211d9fd2..447f230ba18a 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh @@ -52,7 +52,7 @@ function cleanup { fi } -set -A args "on" "sa" +set -A args "dir" "sa" log_assert "Create/read/write/append of xattrs works" log_onexit cleanup diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh index c60be2217dae..50062ed35e92 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh @@ -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_onexit cleanup