Skip to contentSkip to conversation

common/attr: adbjust acl_max of f2fs

PATCH In review Sun Ke 2 participants 3 messages Feb 8, 2022 – Feb 25, 2022

lore
Share & tools
lore

Sun Ke

author
#0 lore raw

PATCH 1/1 common/attr: adbjust acl_max of f2fs

f2fs has set inline_xattr as a default option, and introduced a new option named 'noinline_xattr' for disabling default inline_xattr option. So in _acl_get_max we need to check 'noinline_xattr' string in fs option, otherwise we may select the wrong max acl number since we always found the string 'inline_xattr' in fs option.

Additionally, f2fs has changed disk layout of xattr block a bit, so will contain one more entry in both inline and noinline xattr inode, this patch will modify the max acl number to adjust it.

---
 common/attr | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
common/attr +16 -3
index 35682d7c..dae8a1bb 100644
@@ -26,11 +26,24 @@ _acl_get_max()
 		echo 8191
 		;;
 	f2fs)
-		_fs_options $TEST_DEV | grep "inline_xattr" >/dev/null 2>&1
+		# If noinline_xattr is enabled, max xattr size should be:
+		# (4096 - 24) - (24 + 4) = 4044
+		# then ACL_MAX_ENTRIES should be:
+		# (4044 - (4 + 4 * 4)) / 8 + 4 = 507
+		_fs_options $TEST_DEV | grep "noinline_xattr" >/dev/null 2>&1
 		if [ $? -eq 0 ]; then
-			echo 531
+			echo 507
 		else
-			echo 506
+			# If inline_xattr is enabled, max xattr size should be:
+			# (4096 - 24 + 200) - (24 + 4) = 4244
+			# then ACL_MAX_ENTRIES should be:
+			# (4244 - (4 + 4 * 4)) / 8 + 4 = 532
+			_fs_options $TEST_DEV | grep "inline_xattr" >/dev/null 2>&1
+			if [ $? -eq 0 ]; then
+				echo 532
+			else
+				echo 507
+			fi
 		fi
 		;;
 	bcachefs)
Signature · 1 line
2.13.6
author
#1 lore raw

Friendly ping...

Quoted 48 lines · Sun Ke

f2fs has set inline_xattr as a default option, and introduced a new option named 'noinline_xattr' for disabling default inline_xattr option. So in _acl_get_max we need to check 'noinline_xattr' string in fs option, otherwise we may select the wrong max acl number since we always found the string 'inline_xattr' in fs option.

Additionally, f2fs has changed disk layout of xattr block a bit, so will contain one more entry in both inline and noinline xattr inode, this patch will modify the max acl number to adjust it.

---
  common/attr | 19 ++++++++++++++++---
  1 file changed, 16 insertions(+), 3 deletions(-)
common/attr +16 -3
index 35682d7c..dae8a1bb 100644
@@ -26,11 +26,24 @@ _acl_get_max()
  		echo 8191
  		;;
  	f2fs)
-		_fs_options $TEST_DEV | grep "inline_xattr" >/dev/null 2>&1
+		# If noinline_xattr is enabled, max xattr size should be:
+		# (4096 - 24) - (24 + 4) = 4044
+		# then ACL_MAX_ENTRIES should be:
+		# (4044 - (4 + 4 * 4)) / 8 + 4 = 507
+		_fs_options $TEST_DEV | grep "noinline_xattr" >/dev/null 2>&1
  		if [ $? -eq 0 ]; then
-			echo 531
+			echo 507
  		else
-			echo 506
+			# If inline_xattr is enabled, max xattr size should be:
+			# (4096 - 24 + 200) - (24 + 4) = 4244
+			# then ACL_MAX_ENTRIES should be:
+			# (4244 - (4 + 4 * 4)) / 8 + 4 = 532
+			_fs_options $TEST_DEV | grep "inline_xattr" >/dev/null 2>&1
+			if [ $? -eq 0 ]; then
+				echo 532
+			else
+				echo 507
+			fi
  		fi
  		;;
  	bcachefs)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Sun Ke
Quoted 6 lines · On 2022/2/8 15:16, Sun Ke via Linux-f2fs-devel wrote:

f2fs has set inline_xattr as a default option, and introduced a new option named 'noinline_xattr' for disabling default inline_xattr option. So in _acl_get_max we need to check 'noinline_xattr' string in fs option, otherwise we may select the wrong max acl number since we always found the string 'inline_xattr' in fs option.

Quoted 6 lines

Additionally, f2fs has changed disk layout of xattr block a bit, so will contain one more entry in both inline and noinline xattr inode, this patch will modify the max acl number to adjust it.

Thanks,