All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] ext2: remove pointless vars in inode allocators
Date: Thu, 07 Jun 2007 14:38:57 -0500	[thread overview]
Message-ID: <46685ED1.5050100@redhat.com> (raw)

ext2's find_group_dir tests whether best_desc is not set and if
so returns -1.  But if it was not set, best_group was not set either,
and it was initialized to -1.  So may as well just return best_group.
This matches ext3/4 too.

In find_group_orlov, best_desc is updated in a loop and eventually
assigned to "desc" but then we return without using either.  Looks like
it can just be removed.

Compiled & booted & lightly tested.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: linux-2.6.22-rc3/fs/ext2/ialloc.c
===================================================================
--- linux-2.6.22-rc3.orig/fs/ext2/ialloc.c
+++ linux-2.6.22-rc3/fs/ext2/ialloc.c
@@ -224,16 +224,13 @@ static int find_group_dir(struct super_b
 			continue;
 		if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
 			continue;
-		if (!best_desc || 
+		if (!best_desc ||
 		    (le16_to_cpu(desc->bg_free_blocks_count) >
 		     le16_to_cpu(best_desc->bg_free_blocks_count))) {
 			best_group = group;
 			best_desc = desc;
 		}
 	}
-	if (!best_desc)
-		return -1;
-
 	return best_group;
 }
 
@@ -290,7 +287,6 @@ static int find_group_orlov(struct super
 
 	if ((parent == sb->s_root->d_inode) ||
 	    (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
-		struct ext2_group_desc *best_desc = NULL;
 		int best_ndir = inodes_per_group;
 		int best_group = -1;
 
@@ -309,10 +305,8 @@ static int find_group_orlov(struct super
 				continue;
 			best_group = group;
 			best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
-			best_desc = desc;
 		}
 		if (best_group >= 0) {
-			desc = best_desc;
 			group = best_group;
 			goto found;
 		}

                 reply	other threads:[~2007-06-07 19:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46685ED1.5050100@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.