Re: [ext2resize] Patches for ext2resize?
Status: Inactive
Brought to you by:
adilger
From: Petter R. <pe...@hu...> - 2006-06-10 14:30:44
|
[Takashi Sato] > Sure, I have checked ext2resize in CVS. > The patch to fix calculation of offsets wasn't applied. Right. I see part of it was applied. This part is commited already: diff -Nurp ext2resize-1.1.19/src/ext2_meta.c ../a/ext2resize-1.1.19/src/ext2_meta.c --- ext2resize-1.1.19/src/ext2_meta.c 2004-09-30 22:01:41.000000000 +0800 +++ ../a/ext2resize-1.1.19/src/ext2_meta.c 2006-03-24 12:05:00.000000000 +0800 @@ -109,6 +109,12 @@ int ext2_metadata_push(struct ext2_fs *f int has_sb; int diff; + has_sb = ext2_bg_has_super(fs, group); + if(!has_sb) + new_itoffset = 2; + else + new_itoffset = fs->newgdblocks +3; + diff = start + new_itoffset - fs->gd[group].bg_inode_table; old_itend =fs->gd[group].bg_inode_table +fs->inodeblocks -start ; new_itend = new_itoffset + fs->inodeblocks; @@ -116,8 +122,6 @@ int ext2_metadata_push(struct ext2_fs *f if (start + bpg > fs->sb.s_blocks_count) bpg = fs->sb.s_blocks_count - start; - has_sb = ext2_bg_has_super(fs, group); - bb = fs->gd[group].bg_block_bitmap - start; ib = fs->gd[group].bg_inode_bitmap - start; if (fs->stride) { > You can get it from following URL. > > http://marc.theaimsgroup.com/?l=linux-kernel&m=114856199101617&w=1 > > This patch is small so you can apply manually if you cannot apply > automatically by patch command. I had to, yes. :( > If you have some questions, feel free to ask me. Can you explain why the rest of the patch is needed? This is the patch updated to the current CVS version. Index: src/ext2.h =================================================================== RCS file: /cvsroot/ext2resize/ext2resize/src/ext2.h,v retrieving revision 1.28 diff -u -3 -p -u -r1.28 ext2.h --- src/ext2.h 10 Jun 2006 07:45:55 -0000 1.28 +++ src/ext2.h 10 Jun 2006 14:27:56 -0000 @@ -264,7 +264,7 @@ static __inline__ int ext2_is_data_block group = blk / fs->sb.s_blocks_per_group; blk %= fs->sb.s_blocks_per_group; - if (ext2_bg_has_super(fs, group) && blk <= fs->gdblocks) + if (ext2_bg_has_super(fs, group) && blk <= fs->gdblocks + fs->resgdblocks) return 0; if (block == fs->gd[group].bg_block_bitmap || Index: src/ext2_block_relocator.c =================================================================== RCS file: /cvsroot/ext2resize/ext2resize/src/ext2_block_relocator.c,v retrieving revision 1.22 diff -u -3 -p -u -r1.22 ext2_block_relocator.c --- src/ext2_block_relocator.c 10 Jun 2006 07:45:55 -0000 1.22 +++ src/ext2_block_relocator.c 10 Jun 2006 14:27:56 -0000 @@ -497,6 +497,10 @@ static int ext2_block_relocator_grab_blo int raid_bb, raid_ib; int itend = state->new_alloc_offset; + if (!ext2_bg_has_super(fs, group)) + itend = fs->gd[group].bg_inode_table + +fs->inodeblocks - start; + bpg = fs->sb.s_blocks_per_group; if (start + bpg > fs->newblocks) bpg = fs->newblocks - start; Index: src/ext2_meta.c =================================================================== RCS file: /cvsroot/ext2resize/ext2resize/src/ext2_meta.c,v retrieving revision 1.14 diff -u -3 -p -u -r1.14 ext2_meta.c --- src/ext2_meta.c 17 Feb 2006 12:04:09 -0000 1.14 +++ src/ext2_meta.c 10 Jun 2006 14:27:56 -0000 @@ -192,7 +192,8 @@ int ext2_metadata_push(struct ext2_fs *f group + 1, fs->numgroups); } - fs->itoffset = new_itoffset; + fs->itoffset = fs->newgdblocks + 3; + if (fs->flags & FL_VERBOSE) printf("\n"); Index: src/ext2_resize.c =================================================================== RCS file: /cvsroot/ext2resize/ext2resize/src/ext2_resize.c,v retrieving revision 1.19 diff -u -3 -p -u -r1.19 ext2_resize.c --- src/ext2_resize.c 10 Jun 2006 06:45:22 -0000 1.19 +++ src/ext2_resize.c 10 Jun 2006 14:27:56 -0000 @@ -157,7 +157,7 @@ static int ext2_add_group(struct ext2_fs return 1; } -static int ext2_del_group(struct ext2_fs *fs) +static int ext2_del_group(struct ext2_fs *fs, int old_gdblocks) { blk_t admin; int group = fs->numgroups - 1; @@ -170,7 +170,7 @@ static int ext2_del_group(struct ext2_fs has_sb = ext2_bg_has_super(fs, group); - admin = fs->inodeblocks + (has_sb ? fs->gdblocks + 3 : 2); + admin = fs->inodeblocks + (has_sb ? old_gdblocks + 3 : 2); bpg = fs->sb.s_blocks_count - fs->sb.s_first_data_block - group * fs->sb.s_blocks_per_group; @@ -407,6 +407,7 @@ static int ext2_grow_fs(struct ext2_fs * static int ext2_shrink_fs(struct ext2_fs *fs) { + int old_gdblocks; if (fs->flags & FL_DEBUG) printf("%s\n", __FUNCTION__); @@ -432,8 +433,7 @@ static int ext2_shrink_fs(struct ext2_fs if (!ext2_inode_relocate(fs)) return 0; - if (!ext2_block_relocate(fs)) - return 0; + old_gdblocks = fs->gdblocks; while (fs->sb.s_blocks_count > fs->newblocks) { blk_t sizelast = (fs->sb.s_blocks_count - @@ -445,7 +445,7 @@ static int ext2_shrink_fs(struct ext2_fs fs->sb.s_blocks_count)) return 0; } else { - if (!ext2_del_group(fs)) + if (!ext2_del_group(fs, old_gdblocks)) return 0; } } |