Skip to contentSkip to conversation

common/defrag: skip defrag tests on DAX-enabled filesystems

PATCH Superseded Disha Goel 2 participants 3 messages Jun 4 – Jun 5 VFS

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Disha Goel

author
#0 lore raw

PATCH v2 1/1 common/defrag: skip defrag tests on DAX-enabled filesystems

Online defragmentation is not supported on ext4 DAX-enabled filesystems. The ext4 defrag ioctl (EXT4_IOC_MOVE_EXT) returns EOPNOTSUPP when used on DAX files.

Add an ext4-specific check in _require_defrag() to skip tests when DAX is enabled, avoiding false failures on ext4/301-304, ext4/308, and generic/018.

XFS defrag works with DAX, so this check is ext4-specific.

---
Changes in v2:
- Made the check ext4-specific as XFS defrag works with DAX (feedback from Darrick)
- Use __scratch_uses_fsdax() instead of grepping MOUNT_OPTIONS
- Removed unnecessary comment as _notrun message is self-explanatory

 common/defrag | 4 ++++
 1 file changed, 4 insertions(+)
common/defrag +4 -0
index 055d0d0e..f17271cd 100644
@@ -6,6 +6,10 @@
 
 _require_defrag()
 {
+    if [ "$FSTYP" = "ext4" ] && __scratch_uses_fsdax; then
+        _notrun "ext4 online defrag not supported with DAX"
+    fi
+
     case "$FSTYP" in
     xfs)
         # xfs_fsr does preallocates, require "falloc"
Signature · 1 line
2.45.1
#1 lore raw
Quoted 27 lines · Disha Goel

Online defragmentation is not supported on ext4 DAX-enabled filesystems. The ext4 defrag ioctl (EXT4_IOC_MOVE_EXT) returns EOPNOTSUPP when used on DAX files.

Add an ext4-specific check in _require_defrag() to skip tests when DAX is enabled, avoiding false failures on ext4/301-304, ext4/308, and generic/018.

XFS defrag works with DAX, so this check is ext4-specific.

---
Changes in v2:
- Made the check ext4-specific as XFS defrag works with DAX (feedback from Darrick)
- Use __scratch_uses_fsdax() instead of grepping MOUNT_OPTIONS
- Removed unnecessary comment as _notrun message is self-explanatory

 common/defrag | 4 ++++
 1 file changed, 4 insertions(+)
common/defrag +0 -0
index 055d0d0e..f17271cd 100644

common/defrag line 9

Quoted 4 lines
common/defrag +1 -0
@@ -6,6 +6,10 @@
 
 _require_defrag()
 {
+    if [ "$FSTYP" = "ext4" ] && __scratch_uses_fsdax; then

Shouldn't this be:

	ext4)
		__scratch_uses_fsdax && _notrun "..."
		;;

in the case statement below?

--D

Quoted 9 lines
common/defrag +3 -0
+        _notrun "ext4 online defrag not supported with DAX"
+    fi
+
     case "$FSTYP" in
     xfs)
         # xfs_fsr does preallocates, require "falloc"
Signature · 1 line
2.45.1
author
#2 lore raw
Quoted 35 lines · Darrick J. Wong
Quoted 27 lines · Disha Goel

Online defragmentation is not supported on ext4 DAX-enabled filesystems. The ext4 defrag ioctl (EXT4_IOC_MOVE_EXT) returns EOPNOTSUPP when used on DAX files.

Add an ext4-specific check in _require_defrag() to skip tests when DAX is enabled, avoiding false failures on ext4/301-304, ext4/308, and generic/018.

XFS defrag works with DAX, so this check is ext4-specific.

---
Changes in v2:
- Made the check ext4-specific as XFS defrag works with DAX (feedback from Darrick)
- Use __scratch_uses_fsdax() instead of grepping MOUNT_OPTIONS
- Removed unnecessary comment as _notrun message is self-explanatory

  common/defrag | 4 ++++
  1 file changed, 4 insertions(+)
common/defrag +0 -0
index 055d0d0e..f17271cd 100644

common/defrag line 9

Quoted 4 lines
common/defrag +1 -0
@@ -6,6 +6,10 @@
 
  _require_defrag()
  {
+    if [ "$FSTYP" = "ext4" ] && __scratch_uses_fsdax; then

Shouldn't this be:

Quoted 7 lines
	ext4)
		__scratch_uses_fsdax && _notrun "..."
		;;

in the case statement below?

--D

Yes, that makes more sense. Keeping the ext4-specific check inside the ext4 case is cleaner and more consistent with the existing structure.

I'll send v3 with this change.

Quoted 10 lines
Quoted 10 lines
common/defrag +3 -0
+        _notrun "ext4 online defrag not supported with DAX"
+    fi
+
      case "$FSTYP" in
      xfs)
          # xfs_fsr does preallocates, require "falloc"
Signature · 1 line
2.45.1
Signature · 2 lines
Regards,
Disha