[Top] [All Lists]

Re: xfsprogs: Fix for xfstest 252 hang on ext4

To: Allison Henderson <achender@xxxxxxxxxxxxxxxxxx>
Subject: Re: xfsprogs: Fix for xfstest 252 hang on ext4
From: Yongqiang Yang <xiaoqiangnk@xxxxxxxxx>
Date: Tue, 24 May 2011 09:16:24 +0800
Cc: xfs-oss <xfs@xxxxxxxxxxx>, Ext4 Developers List <linux-ext4@xxxxxxxxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GvXLaW42SrET5F9IeUqeaLSZaMncoLFrAlL1lSBx25g=; b=owu9WjXNFhyjgyPE0aGM1Akizpw7qSWPz043vtouRPBVd4BQ3IFnLPq2+gshjx+NMu xPqjMEnkaSfsKGliCIRg2gm96Mqx3GDZRw/DdXprdbWdlh4tLfGLEsH8cw9GjbASVBdz i1JRsn0Ynu7kQMovxkC54s+8j97g6jPnXkEL4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=rhDw2Lfs1X8GWBEI2ZM7FBpXc4yAxvmsrZwJmA/Fg7tiVZiv/gCHHKhqpz9ohWwsN2 zG4NHMEqA0S1nhLHXeiR9fse7uewCr8bvQHTj0uFLo8TbQnlOReuGMI/r0OnP9d+UfFk otM+4fqG4MdOpI+cWcgeFMSNwp6M6PYwSENSQ=
In-reply-to: <4DDAC4EF.1050702@xxxxxxxxxxxxxxxxxx>
References: <4DDAC4EF.1050702@xxxxxxxxxxxxxxxxxx>
On Tue, May 24, 2011 at 4:34 AM, Allison Henderson
<achender@xxxxxxxxxxxxxxxxxx> wrote:
> Hi all,
> While trying to add more punch hole tests to xfstest, I found that test 252 
> hangs on ext4 due to a loop in xfsprogs that does not exit.  XFS gets out of 
> this loop because there is logic in the loop that looks for the last extent 
> flag and breaks out.  But it looks like ext4 does not return a last extent 
> when the file has a hole at the end.  I am not sure if this is the correct 
> behavior or not, so I will copy the ext4 folks on this too.  Below is a copy 
> of the fix for xfsprogs:

Hi there,

What's blocksize of the tested ext4?    For now, ext4 returns
LAST_EXTENT if the logical offset covered by the extent is greater
than file size, so if there is a hole at the end, no last extent is
returned. Thx!


> diff --git a/io/fiemap.c b/io/fiemap.c
> index fa990cc..81fc92c 100644
> --- a/io/fiemap.c
> +++ b/io/fiemap.c
> @@ -246,7 +246,7 @@ fiemap_f(
>                       flg_w, _("FLAGS"));
>        }
> -       while (!last && ((cur_extent + 1) != max_extents)) {
> +       while (!last && (cur_extent <= max_extents)) {
>                if (max_extents)
>                        num_extents = min(num_extents,
>                                          max_extents - (cur_extent + 1));
> It looks like the loop enters with last=0, cur_extents=0, and max_extents = 
> 0, and on the first iteration cur_extents get set to 2, so we dont see 
> ((cur_extent + 1) == max_extents for a very long time.  I doubt the logic was 
> meant to work that way, so this patch should fix it, but I wanted to make 
> sure that the fiemap for ext4 is working as intended too.  Feed back 
> appreciated!  Thx all!
> Allison Henderson
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Best Wishes
Yongqiang Yang

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