public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Celine Bourde <celine.bourde@bull.net>
To: linux-ext4@vger.kernel.org
Cc: jrs@us.ibm.com, valerie.clement@bull.net,
	Solofo.Ramangalahy@bull.net, celine.bourde@bull.net
Subject: flexbg metadata offset
Date: Wed, 23 Apr 2008 18:38:48 +0200	[thread overview]
Message-ID: <20080423163848.GD21318@bourdec> (raw)


There is a problem on offset metadata. In all flexbg groups the block
between the last block bitmap and the first inode bitmap is not used,
which introduces a hole.

This patch changes this. It corrects the offset of flexbg metadata,
specifically at the end of the disk, if the number of groups isn't
a multiple of the -G option argument.

Céline Bourde.

Signed-off-by: Bourde Celine <celine.bourde@bull.net>

diff -r -u a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
--- a/lib/ext2fs/alloc_tables.c	2008-04-23 17:32:39.000000000 -0400
+++ b/lib/ext2fs/alloc_tables.c	2008-04-23 17:31:52.000000000 -0400
@@ -84,7 +84,7 @@
 	errcode_t	retval;
 	blk_t		group_blk, start_blk, last_blk, new_blk, blk;
 	dgrp_t		last_grp;
-	int		j, rem_grps, flexbg_size = 0;
+	int		j, rem_grps, flexbg_size = 0, last_flexbg_size = 0;
 
 	group_blk = ext2fs_group_first_block(fs, group);
 	last_blk = ext2fs_group_last_block(fs, group);
@@ -96,10 +96,14 @@
 				      EXT4_FEATURE_INCOMPAT_FLEX_BG) &&
 	    fs->super->s_log_groups_per_flex) {
 		flexbg_size = 1 << fs->super->s_log_groups_per_flex;
+		last_flexbg_size = fs->group_desc_count -
+				((group / flexbg_size) * flexbg_size);
 		last_grp = group | (flexbg_size - 1);
-		rem_grps = last_grp - group;
 		if (last_grp > fs->group_desc_count)
 			last_grp = fs->group_desc_count;
+		if (last_flexbg_size > flexbg_size)
+			last_flexbg_size = flexbg_size;
+		rem_grps = last_grp - group;
 	}
 	
 	/*
@@ -151,7 +155,8 @@
 		if (group && fs->group_desc[group-1].bg_inode_bitmap)
 			prev_block = fs->group_desc[group-1].bg_inode_bitmap;
 		start_blk = flexbg_offset(fs, group, prev_block, bmap,
-						 flexbg_size, rem_grps);
+						 last_flexbg_size - 1,
+						 rem_grps);
 		last_blk = ext2fs_group_last_block(fs, last_grp);
 	}
 
@@ -182,7 +187,7 @@
 		if (group && fs->group_desc[group-1].bg_inode_table)
 			prev_block = fs->group_desc[group-1].bg_inode_table;
 		group_blk = flexbg_offset(fs, group, prev_block, bmap,
-						 flexbg_size * 2,
+						 last_flexbg_size * 2 - 1,
 						 fs->inode_blocks_per_group *
 						 rem_grps);
 		last_blk = ext2fs_group_last_block(fs, last_grp);

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2008-04-23 16:38 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=20080423163848.GD21318@bourdec \
    --to=celine.bourde@bull.net \
    --cc=Solofo.Ramangalahy@bull.net \
    --cc=jrs@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=valerie.clement@bull.net \
    /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