Bug#346580: mke2fs -O resize_inode fails on large block devices ( 15GB)

2006-03-17 Thread Theodore Ts'o
tags 346580 +pending
thanks

On Sun, Jan 08, 2006 at 11:56:19PM +0100, Tore Anderson wrote:
 [EMAIL PROTECTED] :) sudo mke2fs -O resize_inode -j /dev/pride/rt
 mke2fs 1.39-WIP (31-Dec-2005)
 /dev/pride/rt: Too many reserved group descriptor blocks while setting up 
 superblock
 [EMAIL PROTECTED] :( 

Thanks for reporting this bug.  It was a signed vs unsigned problem
which only shows up on large filesystem.  It will be fixed with the
following patch.

- Ted

# HG changeset patch
# User [EMAIL PROTECTED]
# Node ID 47163421072881af2b98f7d659cfd663fbfb7ba5
# Parent  8539debc19fe0f295e53a78f21c6b701b3a31e2c
Fix a signed vs unsigned bug in calc_reserved_gdt_blocks()

This fixes mke2fs -O resize_inode for very large filesystems (i.e., 20GB).
Addresses Debian Bug #346580

Signed-off-by: Theodore Ts'o [EMAIL PROTECTED]

diff -r 8539debc19fe -r 471634210728 lib/ext2fs/ChangeLog
--- a/lib/ext2fs/ChangeLog  Fri Mar 17 19:45:45 2006 -0500
+++ b/lib/ext2fs/ChangeLog  Fri Mar 17 20:39:52 2006 -0500
@@ -1,4 +1,9 @@
 2006-03-17  Theodore Ts'o  [EMAIL PROTECTED]
+
+   * initialize.c (calc_reserved_gdt_blocks): Fix a signed vs
+   unsigned problem which caused mke2fs -O resize_inode to
+   bomb out on large filesystems.  (Addresses Debian Bug
+   #346580)
 
* ext2_fs.h (EXT2_IOC_GETVERSION_NEW, EXT2_IOC_SETVERSION_NEW,
EXT2_IOC_GROUP_EXTEND, EXT2_IOC_GROUP_ADD): Add ioctl
diff -r 8539debc19fe -r 471634210728 lib/ext2fs/initialize.c
--- a/lib/ext2fs/initialize.c   Fri Mar 17 19:45:45 2006 -0500
+++ b/lib/ext2fs/initialize.c   Fri Mar 17 20:39:52 2006 -0500
@@ -63,14 +63,14 @@
  * The absolute maximum number of GDT blocks we can reserve is determined by
  * the number of block pointers that can fit into a single block.
  */
-static int calc_reserved_gdt_blocks(ext2_filsys fs)
+static unsigned int calc_reserved_gdt_blocks(ext2_filsys fs)
 {
struct ext2_super_block *sb = fs-super;
unsigned long bpg = sb-s_blocks_per_group;
unsigned int gdpb = fs-blocksize / sizeof(struct ext2_group_desc);
unsigned long max_blocks = 0x;
unsigned long rsv_groups;
-   int rsv_gdb;
+   unsigned int rsv_gdb;
 
/* We set it at 1024x the current filesystem size, or
 * the upper block count limit (2^32), whichever is lower.
@@ -79,10 +79,10 @@
max_blocks = sb-s_blocks_count * 1024;
rsv_groups = (max_blocks - sb-s_first_data_block + bpg - 1) / bpg;
rsv_gdb = (rsv_groups + gdpb - 1) / gdpb - fs-desc_blocks;
-   if (rsv_gdb  (int) EXT2_ADDR_PER_BLOCK(sb))
+   if (rsv_gdb  EXT2_ADDR_PER_BLOCK(sb))
rsv_gdb = EXT2_ADDR_PER_BLOCK(sb);
 #ifdef RES_GDT_DEBUG
-   printf(max_blocks %lu, rsv_groups = %lu, rsv_gdb = %lu\n,
+   printf(max_blocks %lu, rsv_groups = %lu, rsv_gdb = %u\n,
   max_blocks, rsv_groups, rsv_gdb);
 #endif
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#346580: mke2fs -O resize_inode fails on large block devices ( 15GB)

2006-01-08 Thread Tore Anderson

Package: e2fsprogs
Version: 1.38+1.39-WIP-2005.12.31-1
Severity: minor

[EMAIL PROTECTED] :) sudo mke2fs -O resize_inode -j /dev/pride/rt
mke2fs 1.39-WIP (31-Dec-2005)
/dev/pride/rt: Too many reserved group descriptor blocks while setting up 
superblock
[EMAIL PROTECTED] :( 

  The block device in question is exactly 20GB large.  It seems I cannot
 use -O resize_inode on block devices larger than 15GB, where it
 reserves space for growing the filesystem up to 15TB.  If there is a
 limitation on how large the resize_inode can be, mkfs should probably
 just reserve as much as it can and leave it at that if the default size
 exceeds the limitation.  It attempts to reserve space so the filesystem
 can grow to 1024 times its initial size, right?

  By the way, -O resize_inode isn't mentioned in the manual page.  I've
 attached a suggested patch.

Kind regards
-- 
Tore Anderson
diff -ru e2fsprogs-1.38+1.39-WIP-2005.12.31/misc/mke2fs.8.in foo/misc/mke2fs.8.in
--- e2fsprogs-1.38+1.39-WIP-2005.12.31/misc/mke2fs.8.in	2006-01-07 03:26:38.0 +0100
+++ foo/misc/mke2fs.8.in	2006-01-08 23:52:15.0 +0100
@@ -375,6 +375,16 @@
 @[EMAIL PROTECTED] be created with the same
 @[EMAIL PROTECTED] size as the filesystems that will be using it.
 .TP
+.B resize_inode
+Reserve space so the block group descriptor table may grow in the future.
+Useful for online resizing using the
+.B ext2online
+tool.  By default it attempts to reserve enough space so that the
+filesystem may grow to 1024 times its initial size.  You may change that
+using
+.B -E resize
+though.
+.TP
 .B sparse_super
 Create a filesystem with fewer superblock backup copies
 (saves space on large filesystems).
@@ -458,4 +468,5 @@
 .BR badblocks (8),
 .BR dumpe2fs (8),
 .BR e2fsck (8),
-.BR tune2fs (8)
+.BR tune2fs (8),
+.BR ext2online (8)