linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext2: start from parent blockgroup when trying linear search for a free inode
@ 2019-06-01  8:49 Chengguang Xu
  2019-06-03 10:05 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2019-06-01  8:49 UTC (permalink / raw)
  To: jack; +Cc: linux-ext4, Chengguang Xu

Start from parent blockgroup when trying linear search
for a free indoe because for non directory inode it's
better to keep in same blockgroup with parent.

Signed-off-by: Chengguang Xu <cgxu519@zoho.com.cn>
---
 fs/ext2/ialloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index fda7d3f5b4be..435463a255e6 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -411,11 +411,11 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
 	 */
 	group = parent_group;
 	for (i = 0; i < ngroups; i++) {
-		if (++group >= ngroups)
-			group = 0;
 		desc = ext2_get_group_desc (sb, group, NULL);
 		if (desc && le16_to_cpu(desc->bg_free_inodes_count))
 			goto found;
+		if (++group >= ngroups)
+			group = 0;
 	}
 
 	return -1;
-- 
2.17.2



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

end of thread, other threads:[~2019-06-03 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-01  8:49 [PATCH] ext2: start from parent blockgroup when trying linear search for a free inode Chengguang Xu
2019-06-03 10:05 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).