[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}"
}
+
+# Get the inode flags for a particular inode number
+_ext4_get_inum_iflags() {
+ local dev="$1"
+ local inumber="$2"
+
+ debugfs -R "stat <${inumber}>" "${dev}" 2> /dev/null | \
+ sed -n 's/^.*Flags: \([0-9a-fx]*\).*$/\1/p'
+}
extents=0
etree=0
debugfs -R "stat <${inode}>" "${dev}" 2> /dev/null | grep 'ETB[0-9]' -q && etree=1
- iflags="$(debugfs -R "stat <${inode}>" "${dev}" 2> /dev/null | grep 'Flags:' | sed -e 's/^.*Flags: \([0-9a-fx]*\).*$/\1/g')"
+ iflags="$(_ext4_get_inum_iflags "${dev}" "${inode}")"
test "$(echo "${iflags}" | awk '{print and(strtonum($1), 0x80000);}')" -gt 0 && extents=1
case "${format}" in
htree=0
inline=0
- iflags="$(debugfs -R "stat <${inode}>" "${dev}" 2> /dev/null | grep 'Flags:' | sed -e 's/^.*Flags: \([0-9a-fx]*\).*$/\1/g')"
+ iflags="$(_ext4_get_inum_iflags "${dev}" "${inode}")"
test "$(echo "${iflags}" | awk '{print and(strtonum($1), 0x1000);}')" -gt 0 && htree=1
test "$(echo "${iflags}" | awk '{print and(strtonum($1), 0x10000000);}')" -gt 0 && inline=1
{
local path="$1"
- $XFS_INFO_PROG "$path" | grep 'rtextents' | \
- sed -e 's/^.*rtextents=\([0-9]*\).*$/\1/g'
+ $XFS_INFO_PROG "$path" | sed -n "s/^.*rtextents=\([[:digit:]]*\).*/\1/p"
}
# Get the realtime extent size of a mounted filesystem.
{
local path="$1"
- $XFS_INFO_PROG "$path" | grep 'realtime.*extsz' | \
- sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g'
+ $XFS_INFO_PROG "$path" | sed -n "s/^.*realtime.*extsz=\([[:digit:]]*\).*/\1/p"
}
# Get the size of an allocation unit of a file. Normally this is just the
{
local fs="$1"
- $XFS_INFO_PROG "$fs" | grep 'naming.*bsize' | \
- sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g'
+ $XFS_INFO_PROG "$fs" | sed -n "s/^naming.*bsize=\([[:digit:]]*\).*/\1/p"
}
# Set or clear the realtime status of every supplied path. The first argument
# Find AG count of mounted filesystem
_xfs_mount_agcount()
{
- $XFS_INFO_PROG "$1" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g'
+ $XFS_INFO_PROG "$1" | sed -n "s/^.*agcount=\([[:digit:]]*\).*/\1/p"
}
# Wipe the superblock of each XFS AGs