All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Andreas Dilger <adilger@clusterfs.com>,
	Avantika Mathur <mathur@linux.vnet.ibm.com>,
	Mingming Cao <cmm@us.ibm.com>,
	linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: update uninitialized-block-groups.patch and mballoc-core.patch
Date: Thu, 04 Oct 2007 00:34:16 +0530	[thread overview]
Message-ID: <4703E7B0.7060900@linux.vnet.ibm.com> (raw)
In-Reply-To: <4703E5B1.7090903@linux.vnet.ibm.com>



Aneesh Kumar K.V wrote:
> 
> 
> Andreas Dilger wrote:
>> On Oct 03, 2007  15:30 +0530, Aneesh Kumar K.V wrote:
>>> +    if (block_group == sbi->s_gdb_count - 1) {
>>> +        /*
>>> +         * Even though mke2fs always initialize first and last group
>>> +         * if some other tool enabled the EXT4_BG_BLOCK_UNINIT we need
>>> +         * to make sure we calculate the right free blocks
>>> +         */
>>> +        free_blocks = ext4_blocks_count(sbi->s_es) -
>>> +                le32_to_cpu(sbi->s_es->s_first_data_block) -
>>> +                (EXT4_BLOCKS_PER_GROUP(sb) * sbi->s_groups_count) -
>>> +                bit_max;
>>
>> Did you verify that subtracting s_first_data_block is indeed the right
>> thing to do.  I _think_ yes, but I didn't look at it very closely when
>> I wrote it late last night.
>>
> 
> yes s_first_data_block is always decremented to find total number of 
> blocks occupied by the reset of the group. But now looking at it again i 
> guess i need to have




diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 8613914..34b1e11 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -50,7 +50,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
 {
 	unsigned long start;
 	int bit, bit_max;
-	unsigned free_blocks;
+	unsigned free_blocks, group_blocks;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 
 	if (bh) {
@@ -96,14 +96,15 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
 		 * if some other tool enabled the EXT4_BG_BLOCK_UNINIT we need
 		 * to make sure we calculate the right free blocks
 		 */
-		free_blocks = ext4_blocks_count(sbi->s_es) -
-				le32_to_cpu(sbi->s_es->s_first_data_block) -
-				(EXT4_BLOCKS_PER_GROUP(sb) * sbi->s_groups_count) -
-				bit_max;
+		group_blocks = ext4_blocks_count(sbi->s_es) -
+			le32_to_cpu(sbi->s_es->s_first_data_block) -
+			(EXT4_BLOCKS_PER_GROUP(sb) * (sbi->s_groups_count -1));
 	} else {
-		free_blocks = EXT4_BLOCKS_PER_GROUP(sb) - bit_max;
+		group_blocks = EXT4_BLOCKS_PER_GROUP(sb);
 	}
 
+	free_blocks = group_blocks - bit_max;
+
 	if (bh) {
 		for (bit = 0; bit < bit_max; bit++)
 			ext4_set_bit(bit, bh->b_data);
@@ -123,8 +124,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
 		 * blocksize * 8 ( which is the size of bitmap ), set rest of the
 		 * block bitmap to 1
 		 */
-		mark_bitmap_end(EXT4_BLOCKS_PER_GROUP(sb),
-					sb->s_blocksize * 8, bh->b_data);
+		mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data);
 	}
 
 	return free_blocks - sbi->s_itb_per_group - 2;

  reply	other threads:[~2007-10-03 19:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03 10:00 update uninitialized-block-groups.patch and mballoc-core.patch Aneesh Kumar K.V
2007-10-03 18:37 ` Andreas Dilger
2007-10-03 18:55   ` Aneesh Kumar K.V
2007-10-03 19:04     ` Aneesh Kumar K.V [this message]
2007-10-04  0:44       ` Mingming Cao
2007-10-05 13:26 ` Valerie Clement
2007-10-05 15:14   ` Aneesh Kumar K.V

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=4703E7B0.7060900@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@clusterfs.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mathur@linux.vnet.ibm.com \
    /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.