xfs
[Top] [All Lists]

Re: [PATCH 3/3] generic/009: get the correct dev name when testing ext4

To: Eryu Guan <eguan@xxxxxxxxxx>
Subject: Re: [PATCH 3/3] generic/009: get the correct dev name when testing ext4
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 22 Apr 2014 10:07:55 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1397708214-8197-3-git-send-email-eguan@xxxxxxxxxx>
References: <1397708214-8197-1-git-send-email-eguan@xxxxxxxxxx> <1397708214-8197-3-git-send-email-eguan@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Apr 17, 2014 at 12:16:54PM +0800, Eryu Guan wrote:
> If TEST_DEV is a symlink(usually a lvm), we get the wrong DEV
> name. Follow link and get the correct dev name.
> 
> Signed-off-by: Eryu Guan <eguan@xxxxxxxxxx>
> ---
>  tests/generic/009 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/generic/009 b/tests/generic/009
> index 1e487b4..7675c69 100644
> --- a/tests/generic/009
> +++ b/tests/generic/009
> @@ -51,7 +51,7 @@ testfile=$TEST_DIR/009.$$
>  
>  # Disable extent zeroing for ext4 as that change where holes are created
>  if [ "$FSTYP" = "ext4" ]; then
> -     DEV=`basename $TEST_DEV`
> +     DEV=`basename $(readlink -f $TEST_DEV)`
>       echo 0 >/sys/fs/ext4/$DEV/extent_max_zeroout_kb
>  fi

We've made this mistake several times now. Can you add a function
in common/rc that does this. e.g. "_real_dev()" and replace
all the current 'readlink -f $DEV' calls with that function?
i.e. something like:

_real_dev()
{
        local _dev=$1
        if [ -L "$_dev" ]; then
                _dev=`readlink -f $_dev`
        fi
        echo $_dev
}

_short_dev()
{
        echo `basename $(_real_dev $1)`
}

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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