xfs
[Top] [All Lists]

Re: [PATCH 2/4] xfs_repair: remove impossible tests in process_sf_dir2

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 2/4] xfs_repair: remove impossible tests in process_sf_dir2
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Fri, 13 Mar 2015 10:34:24 -0400
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <54FF5BA6.4000508@xxxxxxxxxxx>
References: <54FF59DA.60700@xxxxxxxxxxx> <54FF5BA6.4000508@xxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Tue, Mar 10, 2015 at 05:01:26PM -0400, Eric Sandeen wrote:
> We're testing for an impossible case in here:
> 
>                 if (i == num_entries - 1)  {
> ...
>                 } else  {
> ...
>                                 if (i == num_entries - 1)
>                                     /* can't happen! */
> ...
>                 }
> 
> So, remove the impossible case.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

> 
> diff --git a/repair/dir2.c b/repair/dir2.c
> index 25793e9..7aede6a 100644
> --- a/repair/dir2.c
> +++ b/repair/dir2.c
> @@ -928,26 +928,12 @@ _("size of last entry overflows space left in in 
> shortform dir %" PRIu64 ", "),
>                               do_warn(
>  _("size of entry #%d overflows space left in in shortform dir %" PRIu64 
> "\n"),
>                                       i, ino);
> -                             if (!no_modify)  {
> -                                     if (i == num_entries - 1)
> -                                             do_warn(
> -                                             _("junking entry #%d\n"),
> -                                                     i);
> -                                     else
> -                                             do_warn(
> -                                             _("junking %d entries\n"),
> -                                                     num_entries - i);
> -                             } else  {
> -                                     if (i == num_entries - 1)
> -                                             do_warn(
> -                                             _("would junk entry #%d\n"),
> -                                                     i);
> -                                     else
> -                                             do_warn(
> -                                             _("would junk %d entries\n"),
> -                                                     num_entries - i);
> -                             }
> -
> +                             if (!no_modify)
> +                                     do_warn(_("junking %d entries\n"),
> +                                             num_entries - i);
> +                             else
> +                                     do_warn(_("would junk %d entries\n"),
> +                                             num_entries - i);
>                               break;
>                       }
>               }
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

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