xfs
[Top] [All Lists]

Re: [PATCH] xfstests: make defrag test 222 generic

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfstests: make defrag test 222 generic
From: David Sterba <dsterba@xxxxxxx>
Date: Fri, 15 Mar 2013 15:55:40 +0100
Cc: xfs-oss <xfs@xxxxxxxxxxx>, ext4 development <linux-ext4@xxxxxxxxxxxxxxx>, linux-btrfs <linux-btrfs@xxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <513F5B0A.4030405@xxxxxxxxxx>
Mail-followup-to: dsterba@xxxxxxx, Eric Sandeen <sandeen@xxxxxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>, ext4 development <linux-ext4@xxxxxxxxxxxxxxx>, linux-btrfs <linux-btrfs@xxxxxxxxxxxxxxx>
References: <513F5B0A.4030405@xxxxxxxxxx>
Reply-to: dsterba@xxxxxxx
User-agent: Mutt/1.5.21 (2012-12-30)
On Tue, Mar 12, 2013 at 11:42:50AM -0500, Eric Sandeen wrote:
> Define a new _defrag_dir() helper which just runs noisy/debug
> dir defrag for ext4 and/or btrfs as well, and use that in 222
> instead of hardcoded xfs_fsr.

Dir defrag on btrfs does not recurse in the given directory to defrag
all files, but defragments the tree of the containing subvolume and the
whole extent tree (thus needs CAP_SYS_ADMIN).

This is known (and not very intuitive) behaviour, it would be better to
add a special parameter to defrag the root and/or the extent root and
pass it down to the ioctl via flags.

Until this is implemented I suggest to use a workaround via 'find':

 find $dir -print -execdir $DEFRAG_PROG '{}' +

Otherwise the test looks ok.

david

> +# Defrag a whole directory.  No checking as above, just run it, noisily
> +# output should be sent to $seq.full since it's very fs-specific
> +_defrag_dir()
> +{
> +    case "$FSTYP" in
> +    xfs)
> +     $DEFRAG_PROG -d -v $1
> +     ;;
> +    ext4|ext4dev|btrfs)
       ext4|ext4dev)
> +     $DEFRAG_PROG -v $1
> +     ;;
       btrfs)
        find $1 -print -execdir $DEFRAG_PROG '{}' +
        ;;
> +    *)
> +     $DEFRAG_PROG $1
> +     ;;
> +    esac
> +}

<Prev in Thread] Current Thread [Next in Thread>