Thread: [ext2resize] Patches for ext2resize?
Status: Inactive
Brought to you by:
adilger
From: Petter R. <pe...@hu...> - 2006-06-10 09:08:24
|
Hi. I am working on a new release of ext2resize, and have noticed your patches for <URL:http://www.ussg.iu.edu/hypermail/linux/kernel/0604.1/date.html#1090>. I believe some of the area already applied to the ext2resize CVS, <URL:http://sourceforge.net/projects/ext2resize/>, but am unsure which remain. As the patches available from the mailing list archives fail to apply, it is a bit hard for me to verify this. Do you have time to check which of your patches are missing from the ext2resize CVS, and submit updated versions relative to the current CVS to the ext2resize-devel at lists.sourceforge.net mailing list? I hope to make a new release of ext2resize this weekend, so it would be nice if you managed to reply soon. Cc to the ext2resize-devel mailing list, to keep the rest of the ext2resize team updated. Friendly, -- Petter Reinholdtsen |
From: Takashi S. <sh...@tn...> - 2006-06-10 12:33:49
|
Hi, > Hi. > > I am working on a new release of ext2resize, and have noticed your > patches for > <URL:http://www.ussg.iu.edu/hypermail/linux/kernel/0604.1/date.html#1090>. > I believe some of the area already applied to the ext2resize CVS, > <URL:http://sourceforge.net/projects/ext2resize/>, but am unsure which > remain. As the patches available from the mailing list archives fail > to apply, it is a bit hard for me to verify this. > > Do you have time to check which of your patches are missing from the > ext2resize CVS, and submit updated versions relative to the current > CVS to the ext2resize-devel at lists.sourceforge.net mailing list? Sure, I have checked ext2resize in CVS. The patch to fix calculation of offsets wasn't applied. 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. If you have some questions, feel free to ask me. Cheers, sho |
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; } } |
From: Takashi S. <sh...@tn...> - 2006-06-16 09:53:46
|
Hi, I had gone out for three days so the reply to you was delayed. > Can you explain why the rest of the patch is needed? This is the > patch updated to the current CVS version. OK, I described comments below. > 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 blk belongs to group descriptor blocks(GDB) or reserved GDB, ext2_is_data_block should return 0. Without this fix, it would return 1 though blk belongs to reserved GDB. > 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; > + state->new_alloc_offset is set to the offset of the first data block in the block group which has a super block. So, if the target group doesn't have a super block, it should be re-calculated. > 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; > + fs->itoffset should be set to the offset of an inode table in a group which has a super block. Without this fix, fs->itoffset is possible to be set to the offset in a group which doesn't have a super block and following procedure runs incorrectly. > 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; Until the size of a filesystem becomes the expected size, groups will be removed at the following loop. 1. ext2_del_group() decreases the number of GDB(fs->gdblocks) after deleting all groups on one GBD. 2. When ext2_del_group() is called at the next iteration, it calculates the number of meta-data blocks in a group by using fs->gdblocks, so the result of the calculation is less than the actual meta-data blocks and following procedure runs incorrectly. So we fixed this to save the original number of GDB(fs->gdblocks) before deleting groups and passed the saved number to ext2_del_group() as an argument. > 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; > } > } Cheers, sho |