From 53829ddd1fc9980fc4a1ca797a711ef28ef48ef5 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Sun, 16 Apr 1995 23:51:31 +0000 Subject: Formerly hyper.c.~6~ --- ext2fs/hyper.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c index f6bfb8ac..b2ec88a4 100644 --- a/ext2fs/hyper.c +++ b/ext2fs/hyper.c @@ -48,13 +48,21 @@ get_hypermetadata (void) "Block size %ld is too small (min is %ld bytes)", block_size, SBLOCK_SIZE); - assert ((vm_page_size % DEV_BSIZE) == 0); - assert ((block_size % DEV_BSIZE) == 0); - - if (block_size < vm_page_size) - ext2_panic ("get_hypermetadata", - "Block size (%d) isn't a multiple of page size (%ld)", - block_size, vm_page_size); + log2_dev_blocks_per_fs_block = 0; + while ((device_block_size << log2_dev_blocks_per_fs_block) < block_size) + log2_dev_blocks_per_fs_block++; + if ((device_block_size << log2_dev_blocks_per_fs_block) != block_size) + ext2_panic("get_hypermetadata", + "Block size %ld isn't a power-of-two multiple of the device" + " block size (%d)!", + block_size, device_block_size); + + log2_block_size = 0; + while ((1 << log2_block_size) < block_size) + log2_block_size++; + if ((1 << log2_block_size) != block_size) + ext2_panic("get_hypermetadata", + "Block size %ld isn't a power of two!", block_size); /* Set these handy variables. */ inodes_per_block = block_size / sizeof (struct ext2_inode); -- cgit v1.2.3