xfs
[Top] [All Lists]

[PATCH 06/13] xfs_repair: remove impossible tests in process_sf_dir2

To: xfs@xxxxxxxxxxx
Subject: [PATCH 06/13] xfs_repair: remove impossible tests in process_sf_dir2
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Tue, 17 Mar 2015 15:33:08 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1426624395-8258-1-git-send-email-sandeen@xxxxxxxxxx>
References: <1426624395-8258-1-git-send-email-sandeen@xxxxxxxxxx>
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>
---
 repair/dir2.c |   26 ++++++--------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

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;
                        }
                }
-- 
1.7.1

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