Thread (46 messages) 46 messages, 3 authors, 2021-04-17
STALE1901d
Revisions (4)
  1. v3 [diff vs current]
  2. v4 [diff vs current]
  3. v5 [diff vs current]
  4. v6 current

[PATCH V6 02/13] common/xfs: Add a helper to get an inode fork's extent count

From: Chandan Babu R <hidden>
Date: 2021-03-09 05:02:29
Also in: fstests
Subsystem: the rest · Maintainer: Linus Torvalds

This commit adds the helper _scratch_get_iext_count() which returns an
inode fork's extent count.

Signed-off-by: Chandan Babu R <redacted>
---
 common/xfs | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff --git a/common/xfs b/common/xfs
index 41dd8676..26ae21b9 100644
--- a/common/xfs
+++ b/common/xfs
@@ -924,6 +924,26 @@ _scratch_get_bmx_prefix() {
 	return 1
 }
 
+_scratch_get_iext_count()
+{
+	local ino=$1
+	local whichfork=$2
+	local field=""
+
+	case $whichfork in
+		"attr")
+			field=core.naextents
+			;;
+		"data")
+			field=core.nextents
+			;;
+		*)
+			return 1
+	esac
+
+	_scratch_xfs_get_metadata_field $field "inode $ino"
+}
+
 #
 # Ensures that we don't pass any mount options incompatible with XFS v4
 #
-- 
2.29.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help