linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avantika Mathur <mathur@linux.vnet.ibm.com>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] uninitialized block groups
Date: Fri, 07 Sep 2007 16:06:33 -0700	[thread overview]
Message-ID: <46E1D979.3040306@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070828201840.GX5377@schatzie.adilger.int>

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

Andreas Dilger wrote:
> One last note - if this is being applied on top of mballoc it needs one
> last patch for that file (against the 2.6.18-rhel5 tree, should work
> with s/ext3/ext4/ I think):
>   
Here is the patch for uninitialized block group support in mballoc 
ported to ext4; in the patch queue after mballoc-mkdir-oops-fix.patch. 

Thanks
Avantika

----



[-- Attachment #2: mballoc-uninit-fix --]
[-- Type: text/plain, Size: 3583 bytes --]

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>

Index: linux-2.6.23-rc4/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.23-rc4.orig/fs/ext4/mballoc.c	2007-09-05 13:57:53.000000000 -0700
+++ linux-2.6.23-rc4/fs/ext4/mballoc.c	2007-09-05 13:59:51.000000000 -0700
@@ -36,6 +36,8 @@
 #include <linux/seq_file.h>
 #include <linux/version.h>
 
+#include "group.h"
+
 /*
  * MUSTDO:
  *   - test ext4_ext_search_left() and ext4_ext_search_right()
@@ -321,6 +323,7 @@
 	unsigned long	bb_state;
 	unsigned long 	bb_tid;
 	struct ext4_free_metadata *bb_md_cur;
+	struct ext4_group_desc *bb_gdp;
 	unsigned short	bb_first_free;
 	unsigned short	bb_free;
 	unsigned short	bb_fragments;
@@ -921,10 +924,7 @@
 		if (first_group + i >= EXT4_SB(sb)->s_groups_count)
 			break;
 
-		err = -EIO;
-		desc = ext4_get_group_desc(sb, first_group + i, NULL);
-		if (desc == NULL)
-			goto out;
+		desc = EXT4_GROUP_INFO(sb, first_group + i)->bb_gdp;
 
 		err = -ENOMEM;
 		bh[i] = sb_getblk(sb, le32_to_cpu(desc->bg_block_bitmap));
@@ -939,7 +939,12 @@
 			unlock_buffer(bh[i]);
 			continue;
 		}
-
+		if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
+			ext4_init_block_bitmap(sb, bh[i], first_group + i,desc);
+			set_buffer_uptodate(bh[i]);
+			unlock_buffer(bh[i]);
+			continue;
+		}
 		get_bh(bh[i]);
 		bh[i]->b_end_io = end_buffer_read_sync;
 		submit_bh(READ, bh[i]);
@@ -1722,6 +1727,10 @@
 	switch (cr) {
 		case 0:
 			BUG_ON(ac->ac_2order == 0);
+			/* If this group is uninitialized, skip it initially */
+			if (grp->bb_gdp->bg_flags &
+			    cpu_to_le16(EXT4_BG_BLOCK_UNINIT))
+				return 0;
 			bits = ac->ac_sb->s_blocksize_bits + 1;
 			for (i = ac->ac_2order; i <= bits; i++)
 				if (grp->bb_counters[i] > 0)
@@ -1825,7 +1834,9 @@
 			}
 
 			ac->ac_groups_scanned++;
-			if (cr == 0)
+			if (cr == 0 || (e3b.bd_info->bb_gdp->bg_flags &
+					cpu_to_le16(EXT4_BG_BLOCK_UNINIT) &&
+					ac->ac_2order != 0))
 				ext4_mb_simple_scan_group(ac, &e3b);
 			else if (cr == 1 && ac->ac_g_ex.fe_len == sbi->s_stripe)
 				ext4_mb_scan_aligned(ac, &e3b);
@@ -2304,12 +2315,13 @@
 			i--;
 			goto err_freebuddy;
 		}
+		memset(meta_group_info[j], 0, len);
 		desc = ext4_get_group_desc(sb, i, NULL);
+		meta_group_info[j]->bb_gdp = desc;
 		if (desc == NULL) {
 			printk(KERN_ERR"EXT4-fs: can't read descriptor %u\n",i);
 			goto err_freebuddy;
 		}
-		memset(meta_group_info[j], 0, len);
 		set_bit(EXT4_GROUP_INFO_NEED_INIT_BIT,
 			&meta_group_info[j]->bb_state);
 
@@ -2874,9 +2886,17 @@
 	mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
 
 	spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
+	if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
+		gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
+		gdp->bg_free_blocks_count =
+			cpu_to_le16(ext4_free_blocks_after_init(sb,
+							    ac->ac_b_ex.fe_group,
+							    gdp));
+	}
 	gdp->bg_free_blocks_count =
 		cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)
 				- ac->ac_b_ex.fe_len);
+	gdp->bg_checksum = ext4_group_desc_csum(sbi, ac->ac_b_ex.fe_group, gdp);
 	spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
 	percpu_counter_mod(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
 
@@ -4256,6 +4276,7 @@
 	spin_lock(sb_bgl_lock(sbi, block_group));
 	gdp->bg_free_blocks_count =
 		cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) + count);
+	gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp);
 	spin_unlock(sb_bgl_lock(sbi, block_group));
 	percpu_counter_mod(&sbi->s_freeblocks_counter, count);
 


      parent reply	other threads:[~2007-09-07 23:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23  5:41 [PATCH] uninitialized block groups Avantika Mathur
     [not found] ` <20070828201840.GX5377@schatzie.adilger.int>
2007-08-31  0:46   ` Avantika Mathur
2007-09-07 23:06   ` Avantika Mathur [this message]

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=46E1D979.3040306@linux.vnet.ibm.com \
    --to=mathur@linux.vnet.ibm.com \
    --cc=adilger@clusterfs.com \
    --cc=linux-ext4@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 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).