From: "Jose R. Santos" <jrs@us.ibm.com>
To: linux-ext4@vger.kernel.org
Subject: [PATCH 07/13][e2fsprogs] Make resize2fs uninit block group aware.
Date: Thu, 11 Oct 2007 14:16:41 -0500 [thread overview]
Message-ID: <20071011191641.4599.51500.stgit@gara> (raw)
In-Reply-To: <20071011191559.4599.69332.stgit@gara>
From: Jose R. Santos <jrs@us.ibm.com>
Make resize2fs uninit block group aware.
Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
--
resize/main.c | 7 +++++++
resize/resize2fs.c | 29 ++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/resize/main.c b/resize/main.c
index 7db4ebc..7c1d0c1 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -298,6 +298,13 @@ int main (int argc, char ** argv)
printf (_("Couldn't find valid filesystem superblock.\n"));
exit (1);
}
+
+ if (fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) {
+ com_err(program_name, EXT2_ET_RO_UNSUPP_FEATURE,
+ ":- uninit_groups");
+ exit(1);
+ }
+
/*
* Check for compatibility with the feature sets. We need to
* be more stringent than ext2fs_open().
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 0d6a082..ce0111c 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -339,7 +339,9 @@ retry:
numblocks = fs->super->s_blocks_per_group;
i = old_fs->group_desc_count - 1;
fs->group_desc[i].bg_free_blocks_count += (numblocks-old_numblocks);
-
+ fs->group_desc[i].bg_checksum =
+ ext2fs_group_desc_csum(fs->super, i, &fs->group_desc[i]);
+
/*
* If the number of block groups is staying the same, we're
* done and can exit now. (If the number block groups is
@@ -415,6 +417,8 @@ retry:
fs->group_desc[i].bg_free_inodes_count =
fs->super->s_inodes_per_group;
fs->group_desc[i].bg_used_dirs_count = 0;
+ fs->group_desc[i].bg_checksum =
+ ext2fs_group_desc_csum(fs->super, i,&fs->group_desc[i]);
retval = ext2fs_allocate_group_table(fs, i, 0);
if (retval) goto errout;
@@ -1223,9 +1227,13 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
if (retval) goto errout;
group = (new_inode-1) / EXT2_INODES_PER_GROUP(rfs->new_fs->super);
- if (LINUX_S_ISDIR(inode.i_mode))
+ if (LINUX_S_ISDIR(inode.i_mode)) {
rfs->new_fs->group_desc[group].bg_used_dirs_count++;
-
+ rfs->new_fs->group_desc[group].bg_checksum =
+ ext2fs_group_desc_csum(rfs->new_fs->super,group,
+ &rfs->new_fs->group_desc[group]);
+ }
+
#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_INODEMAP)
printf("Inode moved %u->%u\n", ino, new_inode);
@@ -1478,6 +1486,9 @@ static errcode_t move_itables(ext2_resize_t rfs)
ext2fs_unmark_block_bitmap(fs->block_map, blk);
rfs->old_fs->group_desc[i].bg_inode_table = new_blk;
+ rfs->old_fs->group_desc[i].bg_checksum =
+ ext2fs_group_desc_csum(rfs->old_fs->super, i,
+ &rfs->old_fs->group_desc[i]);
ext2fs_mark_super_dirty(rfs->old_fs);
ext2fs_flush(rfs->old_fs);
@@ -1575,8 +1586,12 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
count++;
if ((count == fs->super->s_blocks_per_group) ||
(blk == fs->super->s_blocks_count-1)) {
- fs->group_desc[group++].bg_free_blocks_count =
+ fs->group_desc[group].bg_free_blocks_count =
group_free;
+ fs->group_desc[group].bg_checksum =
+ ext2fs_group_desc_csum(fs->super, group,
+ &fs->group_desc[group]);
+ group++;
count = 0;
group_free = 0;
}
@@ -1600,8 +1615,12 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
count++;
if ((count == fs->super->s_inodes_per_group) ||
(ino == fs->super->s_inodes_count)) {
- fs->group_desc[group++].bg_free_inodes_count =
+ fs->group_desc[group].bg_free_inodes_count =
group_free;
+ fs->group_desc[group].bg_checksum =
+ ext2fs_group_desc_csum(fs->super, group,
+ &fs->group_desc[group]);
+ group++;
count = 0;
group_free = 0;
}
next prev parent reply other threads:[~2007-10-11 19:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-11 19:15 [PATCH 00/13][e2fsprogs] Uninit block group break down Jose R. Santos
2007-10-11 19:16 ` [PATCH 01/13][e2fsprogs] Add initial checksum support Jose R. Santos
2007-10-15 2:46 ` Theodore Tso
2007-10-15 9:43 ` Jose R. Santos
2007-10-15 11:55 ` Theodore Tso
2007-11-13 23:04 ` Karel Zak
2007-10-15 20:53 ` Theodore Tso
2007-10-11 19:16 ` [PATCH 02/13][e2fsprogs] Add uninit block group support on libe2fs Jose R. Santos
2007-10-11 19:16 ` [PATCH 03/13][e2fsprogs] Rename feature name from gdt_checksum to uninit_groups Jose R. Santos
2007-10-11 19:16 ` [PATCH 04/13][e2fsprogs] Add support for creating filesystems using uninit block group Jose R. Santos
2007-10-11 19:16 ` [PATCH 05/13][e2fsprogs] Make tune2fs uninit block group aware Jose R. Santos
2007-10-11 19:16 ` [PATCH 06/13][e2fsprogs] Make dumpe2fs " Jose R. Santos
2007-10-11 19:16 ` Jose R. Santos [this message]
2007-10-11 19:16 ` [PATCH 08/13][e2fsprogs] Make debugfs " Jose R. Santos
2007-10-11 19:16 ` [PATCH 09/13][e2fsprogs] Make e2fsck " Jose R. Santos
2007-10-11 19:17 ` [PATCH 10/13][e2fsprogs] Update uninit block group documetation for some of the utilities Jose R. Santos
2007-10-11 19:17 ` [PATCH 11/13][e2fsprogs] Fix test cases Jose R. Santos
2007-10-11 19:17 ` [PATCH 12/13][e2fsprogs] Add new mm_lazy test case Jose R. Santos
2007-10-11 19:17 ` [PATCH 13/13][e2fsprogs] Add m_uninit " Jose R. Santos
2007-11-01 9:48 ` Coly Li
2007-11-01 9:58 ` Coly Li
2007-11-01 11:03 ` Jose R. Santos
2007-11-01 11:26 ` Jose R. Santos
2007-11-01 12:11 ` Coly Li
2007-11-01 12:10 ` Coly Li
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=20071011191641.4599.51500.stgit@gara \
--to=jrs@us.ibm.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).