public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mballoc: fix hot spins after err_freebuddy and err_freemeta
@ 2008-04-17 16:09 Roel Kluin
  2008-04-17 17:58 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 6+ messages in thread
From: Roel Kluin @ 2008-04-17 16:09 UTC (permalink / raw)
  To: alex, sct, akpm, adilger; +Cc: linux-ext4, lkml

ext4_mb_init_backend() has a variable i of type ext4_group_t. which is typedefined
in include/linux/ext4_fs_i.h:34 to unsigned long. Since unsigned, i >= 0 is always
true, so fix hot spins after err_freebuddy and err_freemeta.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index ef97f19..afba9b8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2618,14 +2618,14 @@ static int ext4_mb_init_backend(struct super_block *sb)
 	return 0;
 
 err_freebuddy:
-	while (i >= 0) {
+	do {
 		kfree(ext4_get_group_info(sb, i));
-		i--;
-	}
-	i = num_meta_group_infos;
+	} while (i-- != 0);
+	i = num_meta_group_infos - 1;
 err_freemeta:
-	while (--i >= 0)
+	do {
 		kfree(sbi->s_group_info[i]);
+	} while (i-- != 0);
 	iput(sbi->s_buddy_cache);
 err_freesgi:
 	kfree(sbi->s_group_info);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-18 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-17 16:09 [PATCH] mballoc: fix hot spins after err_freebuddy and err_freemeta Roel Kluin
2008-04-17 17:58 ` Aneesh Kumar K.V
2008-04-17 18:29   ` [PATCH v2] " Roel Kluin
2008-04-18  5:14     ` Aneesh Kumar K.V
2008-04-18  5:21       ` Aneesh Kumar K.V
2008-04-18 12:13         ` Roel Kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox