Skip to content

Commit

Permalink
xfs_syncfs.sh: prefer to use xfs_io -c syncfs
Browse files Browse the repository at this point in the history
Signed-off-by: Amir Goldstein <[email protected]>
  • Loading branch information
amir73il committed Jan 20, 2017
1 parent e79f375 commit dbc590d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/xfs_syncfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
[ -d "$1" ] || exit 1
cd "$1" || exit 1

SYNCFS=`which syncfs`
[ -n "$SYNCFS" ] || SYNCFS="sync -f"
# prefer xfs_io
if xfs_io -c help 2>/dev/null | grep fsync; then
FSYNC="xfs_io -c fsync"
fi
if xfs_io -c help 2>/dev/null | grep syncfs; then
SYNCFS="xfs_io -c syncfs"
fi

# second best syncfs tool
[ -n "$SYNCFS" ] || SYNCFS=`which syncfs`

FSYNC="sync"
XFS_IO=`which xfs_io`
[ -z "$XFS_IO" ] || FSYNC="xfs_io -x -c fsync"
# fall back to sync tool
[ -n "$SYNCFS" ] || SYNCFS="sync -f"
[ -n "$FSYNC" ] || FSYNC="sync"

xfs_sync_stats()
{
Expand Down

0 comments on commit dbc590d

Please sign in to comment.