Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 103095 Details for
Bug 156697
Patch e2fsprogs for ext4
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
e2fsprogs-1.39-ext4-use_64bit_block_numbers.patch
e2fsprogs-1.39-ext4-use_64bit_block_numbers.patch (text/plain), 121.64 KB, created by
Conrad Kostecki
on 2006-12-01 00:49:59 UTC
(
hide
)
Description:
e2fsprogs-1.39-ext4-use_64bit_block_numbers.patch
Filename:
MIME Type:
Creator:
Conrad Kostecki
Created:
2006-12-01 00:49:59 UTC
Size:
121.64 KB
patch
obsolete
>add the 64BIT incompat feature (make blk_t 64bit and add "_hi" bits un >super block and descruptors) > >Signed-off-by: Laurent Vivier <laurent.vivier@bull.net> >Signed-off-by: Alexandre Ratchov <alexandre.ratchov@bull.net> > >Index: e2fsprogs-1.39/debugfs/debugfs.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/debugfs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/debugfs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -232,8 +232,8 @@ void do_init_filesys(int argc, char **ar > return; > > memset(¶m, 0, sizeof(struct ext2_super_block)); >- param.s_blocks_count = parse_ullong(argv[2], argv[0], >- "blocks count", &err); >+ EXT2_BLOCKS_COUNT_SET(¶m, parse_ullong(argv[2], argv[0], >+ "blocks count", &err)); > if (err) > return; > retval = ext2fs_initialize(argv[1], 0, ¶m, >@@ -316,14 +316,15 @@ void do_show_super_stats(int argc, char > > gdp = ¤t_fs->group_desc[0]; > for (i = 0; i < current_fs->group_desc_count; i++, gdp++) { >- fprintf(out, " Group %2d: block bitmap at %u, " >- "inode bitmap at %u, " >- "inode table at %u\n" >+ fprintf(out, " Group %2d: block bitmap at %llu, " >+ "inode bitmap at %llu, " >+ "inode table at %llu\n" > " %d free %s, " > "%d free %s, " > "%d used %s\n", >- i, gdp->bg_block_bitmap, >- gdp->bg_inode_bitmap, gdp->bg_inode_table, >+ i, EXT2_BLOCK_BITMAP(gdp), >+ EXT2_INODE_BITMAP(gdp), >+ EXT2_INODE_TABLE(gdp), > gdp->bg_free_blocks_count, > gdp->bg_free_blocks_count != 1 ? "blocks" : "block", > gdp->bg_free_inodes_count, >@@ -377,9 +378,9 @@ static void finish_range(struct list_blo > else > fprintf(lb->f, ", "); > if (lb->first_block == lb->last_block) >- fprintf(lb->f, "(%lld):%u", lb->first_bcnt, lb->first_block); >+ fprintf(lb->f, "(%lld):%llu", lb->first_bcnt, lb->first_block); > else >- fprintf(lb->f, "(%lld-%lld):%u-%u", lb->first_bcnt, >+ fprintf(lb->f, "(%lld-%lld):%llu-%llu", lb->first_bcnt, > lb->last_bcnt, lb->first_block, lb->last_block); > lb->first_block = 0; > } >@@ -421,11 +422,11 @@ static int list_blocks_proc(ext2_filsys > else > fprintf(lb->f, ", "); > if (blockcnt == -1) >- fprintf(lb->f, "(IND):%u", *blocknr); >+ fprintf(lb->f, "(IND):%llu", *blocknr); > else if (blockcnt == -2) >- fprintf(lb->f, "(DIND):%u", *blocknr); >+ fprintf(lb->f, "(DIND):%llu", *blocknr); > else if (blockcnt == -3) >- fprintf(lb->f, "(TIND):%u", *blocknr); >+ fprintf(lb->f, "(TIND):%llu", *blocknr); > return 0; > } > >@@ -730,7 +731,7 @@ void do_freeb(int argc, char *argv[]) > return; > while (count-- > 0) { > if (!ext2fs_test_block_bitmap(current_fs->block_map,block)) >- com_err(argv[0], 0, "Warning: block %u already clear", >+ com_err(argv[0], 0, "Warning: block %llu already clear", > block); > ext2fs_unmark_block_bitmap(current_fs->block_map,block); > block++; >@@ -749,7 +750,7 @@ void do_setb(int argc, char *argv[]) > return; > while (count-- > 0) { > if (ext2fs_test_block_bitmap(current_fs->block_map,block)) >- com_err(argv[0], 0, "Warning: block %u already set", >+ com_err(argv[0], 0, "Warning: block %llu already set", > block); > ext2fs_mark_block_bitmap(current_fs->block_map,block); > block++; >@@ -766,9 +767,9 @@ void do_testb(int argc, char *argv[]) > return; > while (count-- > 0) { > if (ext2fs_test_block_bitmap(current_fs->block_map,block)) >- printf("Block %u marked in use\n", block); >+ printf("Block %llu marked in use\n", block); > else >- printf("Block %u not in use\n", block); >+ printf("Block %llu not in use\n", block); > block++; > } > } >@@ -1178,7 +1179,7 @@ void do_find_free_block(int argc, char * > com_err("ext2fs_new_block", retval, 0); > return; > } else >- printf("%u ", free_blk); >+ printf("%llu ", free_blk); > } > printf("\n"); > } >@@ -1690,10 +1691,10 @@ void do_bmap(int argc, char *argv[]) > errcode = ext2fs_bmap(current_fs, ino, 0, 0, 0, blk, &pblk); > if (errcode) { > com_err("argv[0]", errcode, >- "while mapping logical block %u\n", blk); >+ "while mapping logical block %llu\n", blk); > return; > } >- printf("%u\n", pblk); >+ printf("%llu\n", pblk); > } > > void do_imap(int argc, char *argv[]) >@@ -1713,17 +1714,18 @@ void do_imap(int argc, char *argv[]) > offset = ((ino - 1) % EXT2_INODES_PER_GROUP(current_fs->super)) * > EXT2_INODE_SIZE(current_fs->super); > block = offset >> EXT2_BLOCK_SIZE_BITS(current_fs->super); >- if (!current_fs->group_desc[(unsigned)group].bg_inode_table) { >+ if (!EXT2_IS_USED_INODE_TABLE(¤t_fs->group_desc[(unsigned)group])) { > com_err(argv[0], 0, "Inode table for group %lu is missing\n", > group); > return; > } >- block_nr = current_fs->group_desc[(unsigned)group].bg_inode_table + >+ >+ block_nr = EXT2_INODE_TABLE(¤t_fs->group_desc[(unsigned)group]) + > block; > offset &= (EXT2_BLOCK_SIZE(current_fs->super) - 1); > > printf("Inode %d is part of block group %lu\n" >- "\tlocated at block %u, offset 0x%04lx\n", ino, group, >+ "\tlocated at block %llu, offset 0x%04lx\n", ino, group, > block_nr, offset); > > } >Index: e2fsprogs-1.39/debugfs/htree.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/htree.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/htree.c 2006-09-25 12:56:22.000000000 +0200 >@@ -43,14 +43,14 @@ static void htree_dump_leaf_node(ext2_fi > errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk); > if (errcode) { > com_err("htree_dump_leaf_node", errcode, >- "while mapping logical block %u\n", blk); >+ "while mapping logical block %llu\n", blk); > return; > } > > errcode = ext2fs_read_dir_block2(current_fs, pblk, buf, 0); > if (errcode) { > com_err("htree_dump_leaf_node", errcode, >- "while reading block %u\n", blk); >+ "while reading block %llu\n", blk); > return; > } > >@@ -60,7 +60,7 @@ static void htree_dump_leaf_node(ext2_fi > (dirent->rec_len < 8) || > ((dirent->rec_len % 4) != 0) || > (((dirent->name_len & 0xFF)+8) > dirent->rec_len)) { >- fprintf(pager, "Corrupted directory block (%u)!\n", blk); >+ fprintf(pager, "Corrupted directory block (%llu)!\n", blk); > break; > } > thislen = ((dirent->name_len & 0xFF) < EXT2_NAME_LEN) ? >@@ -155,14 +155,14 @@ static void htree_dump_int_block(ext2_fi > errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk); > if (errcode) { > com_err("htree_dump_int_block", errcode, >- "while mapping logical block %u\n", blk); >+ "while mapping logical block %llu\n", blk); > return; > } > > errcode = io_channel_read_blk(current_fs->io, pblk, 1, buf); > if (errcode) { > com_err("htree_dump_int_block", errcode, >- "while reading block %u\n", blk); >+ "while reading block %llu\n", blk); > return; > } > >@@ -378,7 +378,7 @@ static int search_dir_block(ext2_filsys > strncmp(p->search_name, dirent->name, > p->len) == 0) { > printf("Entry found at logical block %lld, " >- "phys %u, offset %u\n", blockcnt, >+ "phys %llu, offset %u\n", blockcnt, > *blocknr, offset); > printf("offset %u\n", offset); > return BLOCK_ABORT; >Index: e2fsprogs-1.39/debugfs/icheck.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/icheck.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/icheck.c 2006-09-25 12:56:22.000000000 +0200 >@@ -154,10 +154,10 @@ void do_icheck(int argc, char **argv) > printf("Block\tInode number\n"); > for (i=0, binfo = bw.barray; i < bw.num_blocks; i++, binfo++) { > if (binfo->ino == 0) { >- printf("%u\t<block not found>\n", binfo->blk); >+ printf("%llu\t<block not found>\n", binfo->blk); > continue; > } >- printf("%u\t%u\n", binfo->blk, binfo->ino); >+ printf("%llu\t%u\n", binfo->blk, binfo->ino); > } > > error_out: >Index: e2fsprogs-1.39/debugfs/logdump.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/logdump.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/logdump.c 2006-09-25 12:56:22.000000000 +0200 >@@ -158,11 +158,11 @@ void do_logdump(int argc, char **argv) > / sizeof(struct ext2_inode)); > > inode_block_to_dump = >- current_fs->group_desc[inode_group].bg_inode_table + >+ EXT2_INODE_TABLE(¤t_fs->group_desc[inode_group]) + > (group_offset / inodes_per_block); > inode_offset_to_dump = ((group_offset % inodes_per_block) > * sizeof(struct ext2_inode)); >- printf("Inode %u is at group %u, block %u, offset %u\n", >+ printf("Inode %u is at group %u, block %llu, offset %u\n", > inode_to_dump, inode_group, > inode_block_to_dump, inode_offset_to_dump); > } >@@ -183,7 +183,7 @@ void do_logdump(int argc, char **argv) > group_to_dump = ((block_to_dump - > es->s_first_data_block) > / es->s_blocks_per_group); >- bitmap_to_dump = current_fs->group_desc[group_to_dump].bg_block_bitmap; >+ bitmap_to_dump = EXT2_BLOCK_BITMAP(¤t_fs->group_desc[group_to_dump]); > } > > if (!journal_fn && check_fs_open(argv[0])) >@@ -366,8 +366,8 @@ static void dump_journal(char *cmdname, > if (dump_all) { > fprintf(out_file, "\tuuid=%s\n", jsb_buffer); > fprintf(out_file, "\tblocksize=%d\n", blocksize); >- fprintf(out_file, "\tjournal data size %lu\n", >- (unsigned long) sb->s_blocks_count); >+ fprintf(out_file, "\tjournal data size %llu\n", >+ (unsigned long long) EXT2_BLOCKS_COUNT(sb)); > } > } > >@@ -617,7 +617,7 @@ static void dump_metadata_block(FILE *ou > offset = ((fs_blocknr - super->s_first_data_block) % > super->s_blocks_per_group); > >- fprintf(out_file, " (block bitmap for block %u: " >+ fprintf(out_file, " (block bitmap for block %llu: " > "block is %s)\n", > block_to_dump, > ext2fs_test_bit(offset, buf) ? "SET" : "CLEAR"); >Index: e2fsprogs-1.39/debugfs/lsdel.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/lsdel.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/lsdel.c 2006-09-25 12:56:22.000000000 +0200 >@@ -57,7 +57,7 @@ static int lsdel_proc(ext2_filsys fs, > lsd->num_blocks++; > > if (*block_nr < fs->super->s_first_data_block || >- *block_nr >= fs->super->s_blocks_count) { >+ *block_nr >= EXT2_BLOCKS_COUNT(fs->super)) { > lsd->bad_blocks++; > return BLOCK_ABORT; > } >Index: e2fsprogs-1.39/debugfs/set_fields.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/set_fields.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/set_fields.c 2006-09-25 12:56:22.000000000 +0200 >@@ -9,13 +9,13 @@ > * %End-Header% > */ > >+#include <string.h> > #define _XOPEN_SOURCE 500 /* for inclusion of strptime() */ > > #include <stdio.h> > #include <unistd.h> > #include <stdlib.h> > #include <ctype.h> >-#include <string.h> > #include <time.h> > #include <sys/types.h> > #include <sys/stat.h> >@@ -56,8 +56,11 @@ static errcode_t parse_bmap(struct field > static struct field_set_info super_fields[] = { > { "inodes_count", &set_sb.s_inodes_count, 4, parse_uint }, > { "blocks_count", &set_sb.s_blocks_count, 4, parse_uint }, >+ { "blocks_count_hi", &set_sb.s_blocks_count_hi, 4, parse_uint }, > { "r_blocks_count", &set_sb.s_r_blocks_count, 4, parse_uint }, >+ { "r_blocks_count_hi", &set_sb.s_r_blocks_count_hi, 4, parse_uint }, > { "free_blocks_count", &set_sb.s_free_blocks_count, 4, parse_uint }, >+ { "free_blocks_count_hi", &set_sb.s_free_blocks_count_hi, 4, parse_uint }, > { "free_inodes_count", &set_sb.s_free_inodes_count, 4, parse_uint }, > { "first_data_block", &set_sb.s_first_data_block, 4, parse_uint }, > { "log_block_size", &set_sb.s_log_block_size, 4, parse_uint }, >Index: e2fsprogs-1.39/debugfs/unused.c >=================================================================== >--- e2fsprogs-1.39.orig/debugfs/unused.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/debugfs/unused.c 2006-09-25 12:56:22.000000000 +0200 >@@ -32,7 +32,7 @@ void do_dump_unused(int argc EXT2FS_ATTR > errcode_t retval; > > for (blk=current_fs->super->s_first_data_block; >- blk < current_fs->super->s_blocks_count; blk++) { >+ blk < EXT2_BLOCKS_COUNT(current_fs->super); blk++) { > if (ext2fs_test_block_bitmap(current_fs->block_map,blk)) > continue; > retval = io_channel_read_blk(current_fs->io, blk, 1, buf); >Index: e2fsprogs-1.39/e2fsck/badblocks.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/badblocks.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/badblocks.c 2006-09-25 12:56:22.000000000 +0200 >@@ -19,7 +19,7 @@ static int check_bb_inode_blocks(ext2_fi > > static void invalid_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t blk) > { >- printf(_("Bad block %u out of range; ignored.\n"), blk); >+ printf(_("Bad block %llu out of range; ignored.\n"), blk); > return; > } > >@@ -72,10 +72,10 @@ void read_bad_blocks_file(e2fsck_t ctx, > goto fatal; > } > } else { >- sprintf(buf, "badblocks -b %d -X %s%s%s %d", fs->blocksize, >+ sprintf(buf, "badblocks -b %d -X %s%s%s %llu", fs->blocksize, > (ctx->options & E2F_OPT_PREEN) ? "" : "-s ", > (ctx->options & E2F_OPT_WRITECHECK) ? "-n " : "", >- fs->device_name, fs->super->s_blocks_count); >+ fs->device_name, EXT2_BLOCKS_COUNT(fs->super)); > f = popen(buf, "r"); > if (!f) { > com_err("read_bad_blocks_file", errno, >@@ -124,9 +124,9 @@ static int check_bb_inode_blocks(ext2_fi > /* > * If the block number is outrageous, clear it and ignore it. > */ >- if (*block_nr >= fs->super->s_blocks_count || >+ if (*block_nr >= EXT2_BLOCKS_COUNT(fs->super)|| > *block_nr < fs->super->s_first_data_block) { >- printf(_("Warning: illegal block %u found in bad block inode. " >+ printf(_("Warning: illegal block %llu found in bad block inode. " > "Cleared.\n"), *block_nr); > *block_nr = 0; > return BLOCK_CHANGED; >Index: e2fsprogs-1.39/e2fsck/ehandler.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/ehandler.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/ehandler.c 2006-09-25 12:56:22.000000000 +0200 >@@ -50,10 +50,10 @@ static errcode_t e2fsck_handle_read_erro > return 0; > } > if (operation) >- printf(_("Error reading block %lu (%s) while %s. "), block, >+ printf(_("Error reading block %llu (%s) while %s. "), block, > error_message(error), operation); > else >- printf(_("Error reading block %lu (%s). "), block, >+ printf(_("Error reading block %llu (%s). "), block, > error_message(error)); > preenhalt(ctx); > if (ask(ctx, _("Ignore error"), 1)) { >@@ -97,10 +97,10 @@ static errcode_t e2fsck_handle_write_err > } > > if (operation) >- printf(_("Error writing block %lu (%s) while %s. "), block, >+ printf(_("Error writing block %llu (%s) while %s. "), block, > error_message(error), operation); > else >- printf(_("Error writing block %lu (%s). "), block, >+ printf(_("Error writing block %llu (%s). "), block, > error_message(error)); > preenhalt(ctx); > if (ask(ctx, _("Ignore error"), 1)) >Index: e2fsprogs-1.39/e2fsck/journal.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/journal.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/journal.c 2006-09-25 12:56:22.000000000 +0200 >@@ -276,7 +276,7 @@ static errcode_t e2fsck_get_journal(e2fs > continue; > } > if (blk < sb->s_first_data_block || >- blk >= sb->s_blocks_count) { >+ blk >= EXT2_BLOCKS_COUNT(sb)) { > retval = EXT2_ET_BAD_BLOCK_NUM; > goto try_backup_journal; > } >@@ -367,7 +367,7 @@ static errcode_t e2fsck_get_journal(e2fs > goto errout; > } > >- journal->j_maxlen = jsuper.s_blocks_count; >+ journal->j_maxlen = EXT2_BLOCKS_COUNT(&jsuper); > start++; > } > >@@ -969,8 +969,6 @@ int e2fsck_fix_ext3_journal_hint(e2fsck_ > struct problem_context pctx; > char uuid[37], *journal_name; > struct stat st; >- problem_t problem; >- int retval; > > if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) || > uuid_is_null(sb->s_journal_uuid)) >Index: e2fsprogs-1.39/e2fsck/message.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/message.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/message.c 2006-09-25 12:56:22.000000000 +0200 >@@ -370,7 +370,7 @@ static _INLINE_ void expand_percent_expr > fputc('%', stdout); > break; > case 'b': >- printf("%u", ctx->blk); >+ printf("%llu", ctx->blk); > break; > case 'B': > #ifdef EXT2_NO_64_TYPE >@@ -380,7 +380,7 @@ static _INLINE_ void expand_percent_expr > #endif > break; > case 'c': >- printf("%u", ctx->blk2); >+ printf("%llu", ctx->blk2); > break; > case 'd': > printf("%u", ctx->dir); >@@ -418,7 +418,7 @@ static _INLINE_ void expand_percent_expr > print_pathname(fs, ctx->dir, ctx->ino); > break; > case 'S': >- printf("%u", get_backup_sb(NULL, fs, NULL, NULL)); >+ printf("%llu", get_backup_sb(NULL, fs, NULL, NULL)); > break; > case 's': > printf("%s", ctx->str ? ctx->str : "NULL"); >Index: e2fsprogs-1.39/e2fsck/pass1.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/pass1.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/pass1.c 2006-09-25 12:56:22.000000000 +0200 >@@ -181,7 +181,7 @@ int e2fsck_pass1_check_symlink(ext2_fils > if ((inode->i_size >= fs->blocksize) || > (blocks != fs->blocksize >> 9) || > (inode->i_block[0] < fs->super->s_first_data_block) || >- (inode->i_block[0] >= fs->super->s_blocks_count)) >+ (inode->i_block[0] >= EXT2_BLOCKS_COUNT(fs->super))) > return 0; > > for (i = 1; i < EXT2_N_BLOCKS; i++) >@@ -332,7 +332,7 @@ fix: > > /* simple remove all remaining EA(s) */ > *((__u32 *)start) = 0UL; >- e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode, >+ e2fsck_write_inode_full(ctx, pctx->ino, (struct ext2_inode * )pctx->inode, > EXT2_INODE_SIZE(sb), "pass1"); > } > >@@ -922,7 +922,6 @@ void e2fsck_pass1(e2fsck_t ctx) > > if (ctx->flags & E2F_FLAG_RESIZE_INODE) { > ext2fs_block_bitmap save_bmap; >- errcode_t retval; > > save_bmap = fs->block_map; > fs->block_map = ctx->block_found_map; >@@ -1233,7 +1232,7 @@ static int check_ext_attr(e2fsck_t ctx, > */ > if (!(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) || > (blk < fs->super->s_first_data_block) || >- (blk >= fs->super->s_blocks_count)) { >+ (blk >= EXT2_BLOCKS_COUNT(fs->super))) { > mark_inode_bad(ctx, ino); > return 0; > } >@@ -1416,7 +1415,7 @@ static int handle_htree(e2fsck_t ctx, st > block_buf, htree_blk_iter_cb, &blk); > if (((blk == 0) || > (blk < fs->super->s_first_data_block) || >- (blk >= fs->super->s_blocks_count)) && >+ (blk >= EXT2_BLOCKS_COUNT(fs->super))) && > fix_problem(ctx, PR_1_HTREE_BADROOT, pctx)) > return 1; > >@@ -1776,8 +1775,8 @@ static char *describe_illegal_block(ext2 > if (block < super) { > sprintf(problem, "< FIRSTBLOCK (%u)", super); > return(problem); >- } else if (block >= fs->super->s_blocks_count) { >- sprintf(problem, "> BLOCKS (%lu)", fs->super->s_blocks_count); >+ } else if (block >= EXT2_BLOCKS_COUNT(fs->super)) { >+ sprintf(problem, "> BLOCKS (%llu)", EXT2_BLOCKS_COUNT(fs->super)); > return(problem); > } > for (i = 0; i < fs->group_desc_count; i++) { >@@ -1791,16 +1790,16 @@ static char *describe_illegal_block(ext2 > "of group %d", i); > break; > } >- if (block == fs->group_desc[i].bg_block_bitmap) { >+ if (block == EXT2_BLOCK_BITMAP(&fs->group_desc[i])) { > sprintf(problem, "is the block bitmap of group %d", i); > break; > } >- if (block == fs->group_desc[i].bg_inode_bitmap) { >+ if (block == EXT2_INODE_BITMAP(&fs->group_desc[i])) { > sprintf(problem, "is the inode bitmap of group %d", i); > break; > } >- if (block >= fs->group_desc[i].bg_inode_table && >- (block < fs->group_desc[i].bg_inode_table >+ if (block >= EXT2_INODE_TABLE(&fs->group_desc[i]) && >+ (block < EXT2_INODE_TABLE(&fs->group_desc[i]) > + fs->inode_blocks_per_group)) { > sprintf(problem, "is in the inode table of group %d", > i); >@@ -1908,7 +1907,7 @@ static int process_block(ext2_filsys fs, > problem = PR_1_TOOBIG_SYMLINK; > > if (blk < fs->super->s_first_data_block || >- blk >= fs->super->s_blocks_count) >+ blk >= EXT2_BLOCKS_COUNT(fs->super)) > problem = PR_1_ILLEGAL_BLOCK_NUM; > > if (!problem && IND_BLKCNT(blockcnt) && p->ino != EXT2_RESIZE_INO) { >@@ -2022,7 +2021,7 @@ static int process_bad_block(ext2_filsys > pctx->blkcount = blockcnt; > > if ((blk < fs->super->s_first_data_block) || >- (blk >= fs->super->s_blocks_count)) { >+ (blk >= EXT2_BLOCKS_COUNT(fs->super))) { > if (fix_problem(ctx, PR_1_BB_ILLEGAL_BLOCK_NUM, pctx)) { > *block_nr = 0; > return BLOCK_CHANGED; >@@ -2103,22 +2102,22 @@ static int process_bad_block(ext2_filsys > return 0; > } > skip_super: >- if (blk == fs->group_desc[i].bg_block_bitmap) { >+ if (blk == EXT2_BLOCK_BITMAP(&fs->group_desc[i])) { > if (fix_problem(ctx, PR_1_BB_BAD_BLOCK, pctx)) { > ctx->invalid_block_bitmap_flag[i]++; > ctx->invalid_bitmaps++; > } > return 0; > } >- if (blk == fs->group_desc[i].bg_inode_bitmap) { >+ if (blk == EXT2_INODE_BITMAP(&fs->group_desc[i])) { > if (fix_problem(ctx, PR_1_IB_BAD_BLOCK, pctx)) { > ctx->invalid_inode_bitmap_flag[i]++; > ctx->invalid_bitmaps++; > } > return 0; > } >- if ((blk >= fs->group_desc[i].bg_inode_table) && >- (blk < (fs->group_desc[i].bg_inode_table + >+ if ((blk >= EXT2_INODE_TABLE(&fs->group_desc[i])) && >+ (blk < (EXT2_INODE_TABLE(&fs->group_desc[i]) + > fs->inode_blocks_per_group))) { > /* > * If there are bad blocks in the inode table, >@@ -2230,22 +2229,22 @@ static void handle_fs_bad_blocks(e2fsck_ > first_block = ext2fs_group_first_block(fs, i); > > if (ctx->invalid_block_bitmap_flag[i]) { >- blk = fs->group_desc[i].bg_block_bitmap; >+ blk = EXT2_BLOCK_BITMAP(&fs->group_desc[i]); > new_table_block(ctx, first_block, i, _("block bitmap"), > 1, &blk); >- fs->group_desc[i].bg_block_bitmap = blk; >+ EXT2_BLOCK_BITMAP_SET(&fs->group_desc[i], blk); > } > if (ctx->invalid_inode_bitmap_flag[i]) { >- blk = fs->group_desc[i].bg_inode_bitmap; >+ blk = EXT2_INODE_BITMAP(&fs->group_desc[i]); > new_table_block(ctx, first_block, i, _("inode bitmap"), > 1, &blk); >- fs->group_desc[i].bg_inode_bitmap = blk; >+ EXT2_INODE_BITMAP_SET(&fs->group_desc[i], blk); > } > if (ctx->invalid_inode_table_flag[i]) { >- blk = fs->group_desc[i].bg_inode_table; >+ blk = EXT2_INODE_TABLE(&fs->group_desc[i]); > new_table_block(ctx, first_block, i, _("inode table"), > fs->inode_blocks_per_group, &blk); >- fs->group_desc[i].bg_inode_table = blk; >+ EXT2_INODE_TABLE_SET(&fs->group_desc[i], blk); > ctx->flags |= E2F_FLAG_RESTART; > } > } >@@ -2274,8 +2273,8 @@ static void mark_table_blocks(e2fsck_t c > /* > * Mark the blocks used for the inode table > */ >- if (fs->group_desc[i].bg_inode_table) { >- for (j = 0, b = fs->group_desc[i].bg_inode_table; >+ if (EXT2_IS_USED_INODE_TABLE(&fs->group_desc[i])) { >+ for (j = 0, b = EXT2_INODE_TABLE(&fs->group_desc[i]); > j < fs->inode_blocks_per_group; > j++, b++) { > if (ext2fs_test_block_bitmap(ctx->block_found_map, >@@ -2296,34 +2295,34 @@ static void mark_table_blocks(e2fsck_t c > /* > * Mark block used for the block bitmap > */ >- if (fs->group_desc[i].bg_block_bitmap) { >+ if (EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[i])) { > if (ext2fs_test_block_bitmap(ctx->block_found_map, >- fs->group_desc[i].bg_block_bitmap)) { >- pctx.blk = fs->group_desc[i].bg_block_bitmap; >+ EXT2_BLOCK_BITMAP(&fs->group_desc[i]))) { >+ pctx.blk = EXT2_BLOCK_BITMAP(&fs->group_desc[i]); > if (fix_problem(ctx, PR_1_BB_CONFLICT, &pctx)) { > ctx->invalid_block_bitmap_flag[i]++; > ctx->invalid_bitmaps++; > } > } else { > ext2fs_mark_block_bitmap(ctx->block_found_map, >- fs->group_desc[i].bg_block_bitmap); >+ EXT2_BLOCK_BITMAP(&fs->group_desc[i])); > } > > } > /* > * Mark block used for the inode bitmap > */ >- if (fs->group_desc[i].bg_inode_bitmap) { >+ if (EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[i])) { > if (ext2fs_test_block_bitmap(ctx->block_found_map, >- fs->group_desc[i].bg_inode_bitmap)) { >- pctx.blk = fs->group_desc[i].bg_inode_bitmap; >+ EXT2_INODE_BITMAP(&fs->group_desc[i]))) { >+ pctx.blk = EXT2_INODE_BITMAP(&fs->group_desc[i]); > if (fix_problem(ctx, PR_1_IB_CONFLICT, &pctx)) { > ctx->invalid_inode_bitmap_flag[i]++; > ctx->invalid_bitmaps++; > } > } else { > ext2fs_mark_block_bitmap(ctx->block_found_map, >- fs->group_desc[i].bg_inode_bitmap); >+ EXT2_INODE_BITMAP(&fs->group_desc[i])); > } > } > } >Index: e2fsprogs-1.39/e2fsck/pass1b.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/pass1b.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/pass1b.c 2006-09-25 12:56:22.000000000 +0200 >@@ -558,7 +558,7 @@ static int delete_file_block(ext2_filsys > decrement_badcount(ctx, *block_nr, p); > } else > com_err("delete_file_block", 0, >- _("internal error; can't find dup_blk for %u\n"), >+ _("internal error; can't find dup_blk for %llu\n"), > *block_nr); > } else { > ext2fs_unmark_block_bitmap(ctx->block_found_map, *block_nr); >@@ -698,7 +698,7 @@ static int clone_file_block(ext2_filsys > return BLOCK_CHANGED; > } else > com_err("clone_file_block", 0, >- _("internal error; can't find dup_blk for %u\n"), >+ _("internal error; can't find dup_blk for %llu\n"), > *block_nr); > } > return 0; >@@ -802,15 +802,15 @@ static int check_if_fs_block(e2fsck_t ct > } > > /* Check the inode table */ >- if ((fs->group_desc[i].bg_inode_table) && >- (test_block >= fs->group_desc[i].bg_inode_table) && >- (test_block < (fs->group_desc[i].bg_inode_table + >- fs->inode_blocks_per_group))) >+ if ((EXT2_INODE_TABLE(&fs->group_desc[i]) && >+ (test_block >= EXT2_INODE_TABLE(&fs->group_desc[i])) && >+ (test_block < (EXT2_INODE_TABLE(&fs->group_desc[i]) + >+ fs->inode_blocks_per_group)))) > return 1; > > /* Check the bitmap blocks */ >- if ((test_block == fs->group_desc[i].bg_block_bitmap) || >- (test_block == fs->group_desc[i].bg_inode_bitmap)) >+ if ((test_block == EXT2_BLOCK_BITMAP(&fs->group_desc[i])) || >+ (test_block == EXT2_INODE_BITMAP(&fs->group_desc[i]))) > return 1; > > first_block += fs->super->s_blocks_per_group; >Index: e2fsprogs-1.39/e2fsck/pass2.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/pass2.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/pass2.c 2006-09-25 12:56:22.000000000 +0200 >@@ -1086,7 +1086,7 @@ static int deallocate_inode_block(ext2_f > if (HOLE_BLKADDR(*block_nr)) > return 0; > if ((*block_nr < fs->super->s_first_data_block) || >- (*block_nr >= fs->super->s_blocks_count)) >+ (*block_nr >= EXT2_BLOCKS_COUNT(fs->super))) > return 0; > ext2fs_unmark_block_bitmap(ctx->block_found_map, *block_nr); > ext2fs_block_alloc_stats(fs, *block_nr, -1); >@@ -1295,7 +1295,7 @@ extern int e2fsck_process_bad_inode(e2fs > > if (inode.i_file_acl && > ((inode.i_file_acl < fs->super->s_first_data_block) || >- (inode.i_file_acl >= fs->super->s_blocks_count))) { >+ (inode.i_file_acl >= EXT2_BLOCKS_COUNT(fs->super)))) { > if (fix_problem(ctx, PR_2_FILE_ACL_BAD, &pctx)) { > inode.i_file_acl = 0; > inode_modified++; >Index: e2fsprogs-1.39/e2fsck/pass5.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/pass5.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/pass5.c 2006-09-25 12:56:22.000000000 +0200 >@@ -130,11 +130,11 @@ static void check_block_bitmaps(e2fsck_t > > if ((fs->super->s_first_data_block < > ext2fs_get_block_bitmap_start(ctx->block_found_map)) || >- (fs->super->s_blocks_count-1 > >+ (EXT2_BLOCKS_COUNT(fs->super)-1 > > ext2fs_get_block_bitmap_end(ctx->block_found_map))) { > pctx.num = 1; > pctx.blk = fs->super->s_first_data_block; >- pctx.blk2 = fs->super->s_blocks_count -1; >+ pctx.blk2 = EXT2_BLOCKS_COUNT(fs->super) -1; > pctx.ino = ext2fs_get_block_bitmap_start(ctx->block_found_map); > pctx.ino2 = ext2fs_get_block_bitmap_end(ctx->block_found_map); > fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); >@@ -145,11 +145,11 @@ static void check_block_bitmaps(e2fsck_t > > if ((fs->super->s_first_data_block < > ext2fs_get_block_bitmap_start(fs->block_map)) || >- (fs->super->s_blocks_count-1 > >+ (EXT2_BLOCKS_COUNT(fs->super)-1 > > ext2fs_get_block_bitmap_end(fs->block_map))) { > pctx.num = 2; > pctx.blk = fs->super->s_first_data_block; >- pctx.blk2 = fs->super->s_blocks_count -1; >+ pctx.blk2 = EXT2_BLOCKS_COUNT(fs->super) -1; > pctx.ino = ext2fs_get_block_bitmap_start(fs->block_map); > pctx.ino2 = ext2fs_get_block_bitmap_end(fs->block_map); > fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); >@@ -171,7 +171,7 @@ redo_counts: > skip_group++; > super = fs->super->s_first_data_block; > for (i = fs->super->s_first_data_block; >- i < fs->super->s_blocks_count; >+ i < EXT2_BLOCKS_COUNT(fs->super); > i++) { > actual = ext2fs_fast_test_block_bitmap(ctx->block_found_map, i); > >@@ -180,12 +180,12 @@ redo_counts: > (i <= super + fs->desc_blocks) && > ext2fs_bg_has_super(fs, group)) > bitmap = 1; >- else if (i == fs->group_desc[group].bg_block_bitmap) >+ else if (i == EXT2_BLOCK_BITMAP(&fs->group_desc[group])) > bitmap = 1; >- else if (i == fs->group_desc[group].bg_inode_bitmap) >+ else if (i == EXT2_INODE_BITMAP(&fs->group_desc[group])) > bitmap = 1; >- else if (i >= fs->group_desc[group].bg_inode_table && >- (i < fs->group_desc[group].bg_inode_table >+ else if (i >= EXT2_INODE_TABLE(&fs->group_desc[group]) && >+ (i < EXT2_INODE_TABLE(&fs->group_desc[group]) > + fs->inode_blocks_per_group)) > bitmap = 1; > else >@@ -231,7 +231,7 @@ redo_counts: > } > blocks ++; > if ((blocks == fs->super->s_blocks_per_group) || >- (i == fs->super->s_blocks_count-1)) { >+ (i == EXT2_BLOCKS_COUNT(fs->super)-1)) { > free_array[group] = group_free; > group ++; > blocks = 0; >@@ -243,7 +243,7 @@ redo_counts: > fs->group_desc_count*2)) > return; > if (lazy_bg && >- (i != fs->super->s_blocks_count-1) && >+ (i != EXT2_BLOCKS_COUNT(fs->super)-1) && > (fs->group_desc[group].bg_flags & > EXT2_BG_BLOCK_UNINIT)) > skip_group++; >@@ -292,13 +292,13 @@ redo_counts: > ext2fs_unmark_valid(fs); > } > } >- if (free_blocks != fs->super->s_free_blocks_count) { >+ if (free_blocks != EXT2_FREE_BLOCKS_COUNT(fs->super)) { > pctx.group = 0; >- pctx.blk = fs->super->s_free_blocks_count; >+ pctx.blk = EXT2_FREE_BLOCKS_COUNT(fs->super); > pctx.blk2 = free_blocks; > > if (fix_problem(ctx, PR_5_FREE_BLOCK_COUNT, &pctx)) { >- fs->super->s_free_blocks_count = free_blocks; >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, free_blocks); > ext2fs_mark_super_dirty(fs); > } else > ext2fs_unmark_valid(fs); >Index: e2fsprogs-1.39/e2fsck/super.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/super.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/super.c 2006-09-25 12:56:22.000000000 +0200 >@@ -90,7 +90,7 @@ static int release_inode_block(ext2_fils > return 0; > > if ((blk < fs->super->s_first_data_block) || >- (blk >= fs->super->s_blocks_count)) { >+ (blk >= EXT2_BLOCKS_COUNT(fs->super))) { > fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx); > return_abort: > pb->abort = 1; >@@ -387,7 +387,7 @@ void check_resize_inode(e2fsck_t ctx) > if ((i < EXT2_N_BLOCKS) || !blk || !inode.i_links_count || > !(inode.i_mode & LINUX_S_IFREG) || > (blk < fs->super->s_first_data_block || >- blk >= fs->super->s_blocks_count)) { >+ blk >= EXT2_BLOCKS_COUNT(fs->super))) { > resize_inode_invalid: > if (fix_problem(ctx, PR_0_RESIZE_INODE_INVALID, &pctx)) { > memset(&inode, 0, sizeof(inode)); >@@ -450,7 +450,8 @@ void check_super_block(e2fsck_t ctx) > dgrp_t i; > blk_t should_be; > struct problem_context pctx; >- __u32 free_blocks = 0, free_inodes = 0; >+ blk_t free_blocks = 0; >+ ino_t free_inodes = 0; > > inodes_per_block = EXT2_INODES_PER_BLOCK(fs->super); > ipg_max = inodes_per_block * (blocks_per_group - 4); >@@ -474,10 +475,10 @@ void check_super_block(e2fsck_t ctx) > */ > check_super_value(ctx, "inodes_count", sb->s_inodes_count, > MIN_CHECK, 1, 0); >- check_super_value(ctx, "blocks_count", sb->s_blocks_count, >+ check_super_value(ctx, "blocks_count", EXT2_BLOCKS_COUNT(sb), > MIN_CHECK, 1, 0); > check_super_value(ctx, "first_data_block", sb->s_first_data_block, >- MAX_CHECK, 0, sb->s_blocks_count); >+ MAX_CHECK, 0, EXT2_BLOCKS_COUNT(sb)); > check_super_value(ctx, "log_block_size", sb->s_log_block_size, > MIN_CHECK | MAX_CHECK, 0, > EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE); >@@ -490,8 +491,8 @@ void check_super_block(e2fsck_t ctx) > MIN_CHECK | MAX_CHECK, 8, bpg_max); > check_super_value(ctx, "inodes_per_group", sb->s_inodes_per_group, > MIN_CHECK | MAX_CHECK, inodes_per_block, ipg_max); >- check_super_value(ctx, "r_blocks_count", sb->s_r_blocks_count, >- MAX_CHECK, 0, sb->s_blocks_count / 2); >+ check_super_value(ctx, "r_blocks_count", EXT2_R_BLOCKS_COUNT(sb), >+ MAX_CHECK, 0, EXT2_BLOCKS_COUNT(sb) / 2); > check_super_value(ctx, "reserved_gdt_blocks", > sb->s_reserved_gdt_blocks, MAX_CHECK, 0, > fs->blocksize/4); >@@ -515,8 +516,8 @@ void check_super_block(e2fsck_t ctx) > return; > } > if ((pctx.errcode != EXT2_ET_UNIMPLEMENTED) && >- (ctx->num_blocks < sb->s_blocks_count)) { >- pctx.blk = sb->s_blocks_count; >+ (ctx->num_blocks < EXT2_BLOCKS_COUNT(sb))) { >+ pctx.blk = EXT2_BLOCKS_COUNT(sb); > pctx.blk2 = ctx->num_blocks; > if (fix_problem(ctx, PR_0_FS_SIZE_WRONG, &pctx)) { > ctx->flags |= E2F_FLAG_ABORT; >@@ -573,34 +574,34 @@ void check_super_block(e2fsck_t ctx) > first_block = ext2fs_group_first_block(fs, i); > last_block = ext2fs_group_last_block(fs, i); > >- if ((gd->bg_block_bitmap < first_block) || >- (gd->bg_block_bitmap > last_block)) { >- pctx.blk = gd->bg_block_bitmap; >+ if ((EXT2_BLOCK_BITMAP(gd) < first_block) || >+ (EXT2_BLOCK_BITMAP(gd) > last_block)) { >+ pctx.blk = EXT2_BLOCK_BITMAP(gd); > if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx)) >- gd->bg_block_bitmap = 0; >+ EXT2_BLOCK_BITMAP_SET(gd, 0ULL); > } >- if (gd->bg_block_bitmap == 0) { >+ if (!EXT2_IS_USED_BLOCK_BITMAP(gd)) { > ctx->invalid_block_bitmap_flag[i]++; > ctx->invalid_bitmaps++; > } >- if ((gd->bg_inode_bitmap < first_block) || >- (gd->bg_inode_bitmap > last_block)) { >- pctx.blk = gd->bg_inode_bitmap; >+ if ((EXT2_INODE_BITMAP(gd) < first_block) || >+ (EXT2_INODE_BITMAP(gd) > last_block)) { >+ pctx.blk = EXT2_INODE_BITMAP(gd); > if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx)) >- gd->bg_inode_bitmap = 0; >+ EXT2_INODE_BITMAP_SET(gd, 0ULL); > } >- if (gd->bg_inode_bitmap == 0) { >+ if (!EXT2_IS_USED_INODE_BITMAP(gd)) { > ctx->invalid_inode_bitmap_flag[i]++; > ctx->invalid_bitmaps++; > } >- if ((gd->bg_inode_table < first_block) || >- ((gd->bg_inode_table + >+ if ((EXT2_INODE_TABLE(gd) < first_block) || >+ ((EXT2_INODE_TABLE(gd) + > fs->inode_blocks_per_group - 1) > last_block)) { >- pctx.blk = gd->bg_inode_table; >+ pctx.blk = EXT2_INODE_TABLE(gd); > if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx)) >- gd->bg_inode_table = 0; >+ EXT2_INODE_TABLE_SET(gd, 0ULL); > } >- if (gd->bg_inode_table == 0) { >+ if (!EXT2_IS_USED_INODE_TABLE(gd)) { > ctx->invalid_inode_table_flag[i]++; > ctx->invalid_bitmaps++; > } >@@ -621,18 +622,18 @@ void check_super_block(e2fsck_t ctx) > * inodes; if the filesystem is not unmounted cleanly, the > * global counts may not be accurate. > */ >- if ((free_blocks != sb->s_free_blocks_count) || >+ if ((free_blocks != EXT2_FREE_BLOCKS_COUNT(sb)) || > (free_inodes != sb->s_free_inodes_count)) { > if (ctx->options & E2F_OPT_READONLY) > ext2fs_unmark_valid(fs); > else { >- sb->s_free_blocks_count = free_blocks; >+ EXT2_FREE_BLOCKS_COUNT_SET(sb, free_blocks); > sb->s_free_inodes_count = free_inodes; > ext2fs_mark_super_dirty(fs); > } > } > >- if ((sb->s_free_blocks_count > sb->s_blocks_count) || >+ if ((EXT2_FREE_BLOCKS_COUNT(sb) > EXT2_BLOCKS_COUNT(sb)) || > (sb->s_free_inodes_count > sb->s_inodes_count)) > ext2fs_unmark_valid(fs); > >Index: e2fsprogs-1.39/e2fsck/swapfs.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/swapfs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/swapfs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -131,7 +131,7 @@ static void swap_inodes(e2fsck_t ctx) > "block interate buffer"); > for (group = 0; group < fs->group_desc_count; group++) { > retval = io_channel_read_blk(fs->io, >- fs->group_desc[group].bg_inode_table, >+ EXT2_INODE_TABLE(&fs->group_desc[group]), > fs->inode_blocks_per_group, buf); > if (retval) { > com_err("swap_inodes", retval, >@@ -169,7 +169,7 @@ static void swap_inodes(e2fsck_t ctx) > ext2fs_swap_inode(fs, inode, inode, 1); > } > retval = io_channel_write_blk(fs->io, >- fs->group_desc[group].bg_inode_table, >+ EXT2_INODE_TABLE(&fs->group_desc[group]), > fs->inode_blocks_per_group, buf); > if (retval) { > com_err("swap_inodes", retval, >Index: e2fsprogs-1.39/e2fsck/unix.c >=================================================================== >--- e2fsprogs-1.39.orig/e2fsck/unix.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/e2fsck/unix.c 2006-09-25 12:56:22.000000000 +0200 >@@ -110,15 +110,15 @@ static void show_stats(e2fsck_t ctx) > inodes = fs->super->s_inodes_count; > inodes_used = (fs->super->s_inodes_count - > fs->super->s_free_inodes_count); >- blocks = fs->super->s_blocks_count; >- blocks_used = (fs->super->s_blocks_count - >- fs->super->s_free_blocks_count); >+ blocks = EXT2_BLOCKS_COUNT(fs->super); >+ blocks_used = (EXT2_BLOCKS_COUNT(fs->super) - >+ EXT2_FREE_BLOCKS_COUNT(fs->super)); > > frag_percent = (10000 * ctx->fs_fragmented) / inodes_used; > frag_percent = (frag_percent + 5) / 10; > > if (!verbose) { >- printf(_("%s: %u/%u files (%0d.%d%% non-contiguous), %u/%u blocks\n"), >+ printf(_("%s: %u/%u files (%0d.%d%% non-contiguous), %llu/%llu blocks\n"), > ctx->device_name, inodes_used, inodes, > frag_percent / 10, frag_percent % 10, > blocks_used, blocks); >@@ -132,7 +132,7 @@ static void show_stats(e2fsck_t ctx) > ctx->fs_fragmented, frag_percent / 10, frag_percent % 10); > printf (_(" # of inodes with ind/dind/tind blocks: %u/%u/%u\n"), > ctx->fs_ind_count, ctx->fs_dind_count, ctx->fs_tind_count); >- printf (P_("%8u block used (%2.2f%%)\n", "%8u blocks used (%2.2f%%)\n", >+ printf (P_("%8llu block used (%f2.2%%)\n", "%8llu blocks used (%2.2f%%)\n", > blocks_used), blocks_used, 100.0 * blocks_used / blocks); > printf (P_("%8u bad block\n", "%8u bad blocks\n", > ctx->fs_badblocks_count), ctx->fs_badblocks_count); >@@ -299,11 +299,11 @@ static void check_if_skip(e2fsck_t ctx) > fputs(_(", check forced.\n"), stdout); > return; > } >- printf(_("%s: clean, %u/%u files, %u/%u blocks"), ctx->device_name, >+ printf(_("%s: clean, %u/%u files, %llu/%llu blocks"), ctx->device_name, > fs->super->s_inodes_count - fs->super->s_free_inodes_count, > fs->super->s_inodes_count, >- fs->super->s_blocks_count - fs->super->s_free_blocks_count, >- fs->super->s_blocks_count); >+ EXT2_BLOCKS_COUNT(fs->super) - EXT2_FREE_BLOCKS_COUNT(fs->super), >+ EXT2_BLOCKS_COUNT(fs->super)); > next_check = 100000; > if (fs->super->s_max_mnt_count > 0) { > next_check = fs->super->s_max_mnt_count - fs->super->s_mnt_count; >Index: e2fsprogs-1.39/ext2ed/group_com.c >=================================================================== >--- e2fsprogs-1.39.orig/ext2ed/group_com.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/ext2ed/group_com.c 2006-09-25 12:56:22.000000000 +0200 >@@ -134,11 +134,12 @@ void type_ext2_group_desc___show (char * > void type_ext2_group_desc___inode (char *command_line) > > { >- blk_t inode_offset; >+ long inode_offset; > char buffer [80]; > >- inode_offset=type_data.u.t_ext2_group_desc.bg_inode_table; >- sprintf (buffer,"setoffset block %lu",inode_offset);dispatch (buffer); >+ inode_offset=EXT2_INODE_TABLE(&type_data.u.t_ext2_group_desc); >+ >+ sprintf (buffer,"setoffset block %llu",inode_offset);dispatch (buffer); > sprintf (buffer,"settype ext2_inode");dispatch (buffer); > } > >@@ -151,8 +152,8 @@ void type_ext2_group_desc___blockbitmap > block_bitmap_info.entry_num=0; > block_bitmap_info.group_num=group_info.group_num; > >- block_bitmap_offset=type_data.u.t_ext2_group_desc.bg_block_bitmap; >- sprintf (buffer,"setoffset block %lu",block_bitmap_offset);dispatch (buffer); >+ block_bitmap_offset=EXT2_BLOCK_BITMAP(&type_data.u.t_ext2_group_desc); >+ sprintf (buffer,"setoffset block %lld",block_bitmap_offset);dispatch (buffer); > sprintf (buffer,"settype block_bitmap");dispatch (buffer); > } > >@@ -165,8 +166,8 @@ void type_ext2_group_desc___inodebitmap > inode_bitmap_info.entry_num=0; > inode_bitmap_info.group_num=group_info.group_num; > >- inode_bitmap_offset=type_data.u.t_ext2_group_desc.bg_inode_bitmap; >- sprintf (buffer,"setoffset block %lu",inode_bitmap_offset);dispatch (buffer); >+ inode_bitmap_offset=EXT2_INODE_BITMAP(&type_data.u.t_ext2_group_desc); >+ sprintf (buffer,"setoffset block %lld",inode_bitmap_offset);dispatch (buffer); > sprintf (buffer,"settype inode_bitmap");dispatch (buffer); > } > >Index: e2fsprogs-1.39/ext2ed/init.c >=================================================================== >--- e2fsprogs-1.39.orig/ext2ed/init.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/ext2ed/init.c 2006-09-25 12:56:22.000000000 +0200 >@@ -422,13 +422,13 @@ int set_file_system_info (void) > file_system_info.first_group_desc_offset=2*EXT2_MIN_BLOCK_SIZE; > else > file_system_info.first_group_desc_offset=file_system_info.block_size; >- file_system_info.groups_count = div_ceil(sb->s_blocks_count, >+ file_system_info.groups_count = div_ceil(EXT2_BLOCKS_COUNT(sb), > sb->s_blocks_per_group); > > file_system_info.inodes_per_block=file_system_info.block_size/sizeof (struct ext2_inode); > file_system_info.blocks_per_group=sb->s_inodes_per_group/file_system_info.inodes_per_block; > file_system_info.no_blocks_in_group=sb->s_blocks_per_group; >- file_system_info.file_system_size=(sb->s_blocks_count-1)*file_system_info.block_size; >+ file_system_info.file_system_size=(EXT2_BLOCKS_COUNT(sb)-1)*file_system_info.block_size; > } > > else { >Index: e2fsprogs-1.39/ext2ed/inode_com.c >=================================================================== >--- e2fsprogs-1.39.orig/ext2ed/inode_com.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/ext2ed/inode_com.c 2006-09-25 12:56:22.000000000 +0200 >@@ -41,10 +41,11 @@ void type_ext2_inode___prev (char *comma > > group_num=inode_offset_to_group_num (device_offset); > group_offset=file_system_info.first_group_desc_offset+group_num*sizeof (struct ext2_group_desc); >- > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); > >- entry_num=(device_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof (struct ext2_inode); >+ entry_num=(device_offset-EXT2_INODE_TABLE(&desc)* >+ file_system_info.block_size)/ >+ sizeof (struct ext2_inode); > > first_entry=0;last_entry=file_system_info.super_block.s_inodes_per_group-1; > inode_num=0; >@@ -53,7 +54,7 @@ void type_ext2_inode___prev (char *comma > device_offset-=sizeof (struct ext2_inode)*mult; > entry_num-=mult; > >- sprintf (buffer,"setoffset %lu",device_offset);dispatch (buffer); >+ sprintf (buffer,"setoffset %lld",device_offset);dispatch (buffer); > strcpy (buffer,"show");dispatch (buffer); > } > >@@ -93,7 +94,9 @@ void type_ext2_inode___next (char *comma > > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); > >- entry_num=(device_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof (struct ext2_inode); >+ entry_num=(device_offset-EXT2_INODE_TABLE(&desc)* >+ file_system_info.block_size)/ >+ sizeof (struct ext2_inode); > > first_entry=0;last_entry=file_system_info.super_block.s_inodes_per_group-1; > inode_num=0; >@@ -136,7 +139,8 @@ void type_ext2_inode___show (char *comma > > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); > >- entry_num=(device_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof (struct ext2_inode); >+ entry_num=(device_offset-EXT2_INODE_TABLE(&desc)*file_system_info.block_size)/ >+ sizeof (struct ext2_inode); > first_entry=0;last_entry=file_system_info.super_block.s_inodes_per_group-1; > inode_num=group_num*file_system_info.super_block.s_inodes_per_group+1; > inode_num+=entry_num; >@@ -303,7 +307,9 @@ void type_ext2_inode___entry (char *comm > > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); > >- entry_num=(device_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof (struct ext2_inode); >+ entry_num=(device_offset-EXT2_INODE_TABLE(&desc)* >+ file_system_info.block_size)/ >+ sizeof (struct ext2_inode); > > if (wanted_entry > entry_num) { > sprintf (buffer,"next %ld",wanted_entry-entry_num); >@@ -386,7 +392,8 @@ long inode_offset_to_group_num (long ino > > while (!found && group_num>=0 && group_num<file_system_info.groups_count) { > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); >- if (block_num>=desc.bg_inode_table && block_num<desc.bg_inode_table+file_system_info.blocks_per_group) >+ if (block_num>=EXT2_INODE_TABLE(&desc) && >+ block_num<EXT2_INODE_TABLE(&desc)+file_system_info.blocks_per_group) > found=1; > else > group_offset+=sizeof (struct ext2_group_desc); >@@ -415,7 +422,7 @@ long int inode_offset_to_inode_num (long > > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); > >- entry_num=((inode_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof(struct ext2_inode); >+ entry_num=(inode_offset-EXT2_INODE_TABLE(&desc)* > file_system_info.block_size)/ > sizeof (struct ext2_inode); > first_entry=0;last_entry=file_system_info.super_block.s_inodes_per_group-1; >@@ -439,7 +446,7 @@ long int inode_num_to_inode_offset (long > group_offset=file_system_info.first_group_desc_offset+group_num*sizeof (struct ext2_group_desc); > low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset); > >- inode_offset=desc.bg_inode_table*file_system_info.block_size+inode_entry*sizeof (struct ext2_inode); >+ inode_offset=EXT2_INODE_TABLE(&desc)*file_system_info.block_size+inode_entry*sizeof (struct ext2_inode); > > return (inode_offset); > } >Index: e2fsprogs-1.39/ext2ed/super_com.c >=================================================================== >--- e2fsprogs-1.39.orig/ext2ed/super_com.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/ext2ed/super_com.c 2006-09-25 12:56:22.000000000 +0200 >@@ -29,9 +29,9 @@ void type_ext2_super_block___show (char > > show (command_line); > >- if (super->s_blocks_count != 0) { >- wmove (show_pad,2,40);wprintw (show_pad,"%2.2f%%",100*(float) super->s_r_blocks_count/ (float) super->s_blocks_count); >- wmove (show_pad,3,40);wprintw (show_pad,"%2.2f%%",100*(float) super->s_free_blocks_count/ (float) super->s_blocks_count); >+ if (EXT2_BLOCKS_COUNT(super) != 0) { >+ wmove (show_pad,2,40);wprintw (show_pad,"%2.2f%%",100*(float) EXT2_R_BLOCKS_COUNT(super) / (float) EXT2_BLOCKS_COUNT(super)); >+ wmove (show_pad,3,40);wprintw (show_pad,"%2.2f%%",100*(float) EXT2_FREE_BLOCKS_COUNT(super)/ (float) EXT2_BLOCKS_COUNT(super)); > } > > if (super->s_inodes_count != 0) { >Index: e2fsprogs-1.39/lib/e2p/feature.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/e2p/feature.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/e2p/feature.c 2006-09-25 12:56:22.000000000 +0200 >@@ -41,6 +41,8 @@ static struct feature feature_list[] = { > "sparse_super" }, > { E2P_FEATURE_RO_INCOMPAT, EXT2_FEATURE_RO_COMPAT_LARGE_FILE, > "large_file" }, >+ { E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_64BIT, >+ "64bit" }, > { E2P_FEATURE_INCOMPAT, EXT2_FEATURE_INCOMPAT_COMPRESSION, > "compression" }, > { E2P_FEATURE_INCOMPAT, EXT2_FEATURE_INCOMPAT_FILETYPE, >Index: e2fsprogs-1.39/lib/e2p/ls.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/e2p/ls.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/e2p/ls.c 2006-09-25 12:56:22.000000000 +0200 >@@ -192,9 +192,11 @@ void list_super2(struct ext2_super_block > fprintf(f, "Filesystem OS type: %s\n", str); > free(str); > fprintf(f, "Inode count: %u\n", sb->s_inodes_count); >- fprintf(f, "Block count: %u\n", sb->s_blocks_count); >- fprintf(f, "Reserved block count: %u\n", sb->s_r_blocks_count); >- fprintf(f, "Free blocks: %u\n", sb->s_free_blocks_count); >+ fprintf(f, "Block count: %llu\n", EXT2_BLOCKS_COUNT(sb)); >+ fprintf(f, "Reserved block count: %llu\n", >+ EXT2_R_BLOCKS_COUNT(sb)); >+ fprintf(f, "Free blocks: %llu\n", >+ EXT2_FREE_BLOCKS_COUNT(sb)); > fprintf(f, "Free inodes: %u\n", sb->s_free_inodes_count); > fprintf(f, "First block: %u\n", sb->s_first_data_block); > fprintf(f, "Block size: %u\n", EXT2_BLOCK_SIZE(sb)); >Index: e2fsprogs-1.39/lib/ext2fs/alloc.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/alloc.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/alloc.c 2006-09-25 12:56:22.000000000 +0200 >@@ -84,7 +84,7 @@ errcode_t ext2fs_new_block(ext2_filsys f > map = fs->block_map; > if (!map) > return EXT2_ET_NO_BLOCK_BITMAP; >- if (!goal || (goal >= fs->super->s_blocks_count)) >+ if (!goal || (goal >= EXT2_BLOCKS_COUNT(fs->super))) > goal = fs->super->s_first_data_block; > i = goal; > do { >@@ -93,7 +93,7 @@ errcode_t ext2fs_new_block(ext2_filsys f > return 0; > } > i++; >- if (i >= fs->super->s_blocks_count) >+ if (i >= EXT2_BLOCKS_COUNT(fs->super)) > i = fs->super->s_first_data_block; > } while (i != goal); > return EXT2_ET_BLOCK_ALLOC_FAIL; >@@ -160,7 +160,7 @@ errcode_t ext2fs_get_free_blocks(ext2_fi > if (!num) > num = 1; > do { >- if (b+num-1 > fs->super->s_blocks_count) >+ if (b+num-1 > EXT2_BLOCKS_COUNT(fs->super)) > b = fs->super->s_first_data_block; > if (ext2fs_fast_test_block_bitmap_range(map, b, num)) { > *ret = b; >Index: e2fsprogs-1.39/lib/ext2fs/alloc_stats.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/alloc_stats.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/alloc_stats.c 2006-09-25 12:56:22.000000000 +0200 >@@ -46,7 +46,7 @@ void ext2fs_block_alloc_stats(ext2_filsy > else > ext2fs_unmark_block_bitmap(fs->block_map, blk); > fs->group_desc[group].bg_free_blocks_count -= inuse; >- fs->super->s_free_blocks_count -= inuse; >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, EXT2_FREE_BLOCKS_COUNT(fs->super) - inuse); > ext2fs_mark_super_dirty(fs); > ext2fs_mark_bb_dirty(fs); > } >Index: e2fsprogs-1.39/lib/ext2fs/alloc_tables.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/alloc_tables.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/alloc_tables.c 2006-09-25 12:56:22.000000000 +0200 >@@ -56,7 +56,7 @@ errcode_t ext2fs_allocate_group_table(ex > } else > start_blk = group_blk; > >- if (!fs->group_desc[group].bg_block_bitmap) { >+ if (!EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[group])) { > retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, > 1, bmap, &new_blk); > if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) >@@ -65,10 +65,10 @@ errcode_t ext2fs_allocate_group_table(ex > if (retval) > return retval; > ext2fs_mark_block_bitmap(bmap, new_blk); >- fs->group_desc[group].bg_block_bitmap = new_blk; >+ EXT2_BLOCK_BITMAP_SET(&fs->group_desc[group], new_blk); > } > >- if (!fs->group_desc[group].bg_inode_bitmap) { >+ if (!EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[group])) { > retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, > 1, bmap, &new_blk); > if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) >@@ -77,13 +77,13 @@ errcode_t ext2fs_allocate_group_table(ex > if (retval) > return retval; > ext2fs_mark_block_bitmap(bmap, new_blk); >- fs->group_desc[group].bg_inode_bitmap = new_blk; >+ EXT2_INODE_BITMAP_SET(&fs->group_desc[group], new_blk); > } > > /* > * Allocate the inode table > */ >- if (!fs->group_desc[group].bg_inode_table) { >+ if (!EXT2_IS_USED_INODE_TABLE(&fs->group_desc[group])) { > retval = ext2fs_get_free_blocks(fs, group_blk, last_blk, > fs->inode_blocks_per_group, > bmap, &new_blk); >@@ -93,7 +93,7 @@ errcode_t ext2fs_allocate_group_table(ex > j < fs->inode_blocks_per_group; > j++, blk++) > ext2fs_mark_block_bitmap(bmap, blk); >- fs->group_desc[group].bg_inode_table = new_blk; >+ EXT2_INODE_TABLE_SET(&fs->group_desc[group], new_blk); > } > > >Index: e2fsprogs-1.39/lib/ext2fs/bb_inode.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/bb_inode.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/bb_inode.c 2006-09-25 12:56:22.000000000 +0200 >@@ -166,7 +166,7 @@ static int clear_bad_block_proc(ext2_fil > /* > * If the block number is outrageous, clear it and ignore it. > */ >- if (*block_nr >= fs->super->s_blocks_count || >+ if (*block_nr >= EXT2_BLOCKS_COUNT(fs->super) || > *block_nr < fs->super->s_first_data_block) { > *block_nr = 0; > return BLOCK_CHANGED; >Index: e2fsprogs-1.39/lib/ext2fs/bitmaps.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/bitmaps.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/bitmaps.c 2006-09-25 12:56:22.000000000 +0200 >@@ -153,7 +153,7 @@ errcode_t ext2fs_allocate_block_bitmap(e > fs->write_bitmaps = ext2fs_write_bitmaps; > > start = fs->super->s_first_data_block; >- end = fs->super->s_blocks_count-1; >+ end = EXT2_BLOCKS_COUNT(fs->super)-1; > real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) > * fs->group_desc_count)-1 + start; > >Index: e2fsprogs-1.39/lib/ext2fs/block.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/block.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/block.c 2006-09-25 12:56:22.000000000 +0200 >@@ -45,7 +45,7 @@ static int block_iterate_ind(blk_t *ind_ > ctx->bcount += limit; > return ret; > } >- if (*ind_block >= ctx->fs->super->s_blocks_count || >+ if (*ind_block >= EXT2_BLOCKS_COUNT(ctx->fs->super) || > *ind_block < ctx->fs->super->s_first_data_block) { > ctx->errcode = EXT2_ET_BAD_IND_BLOCK; > ret |= BLOCK_ERROR; >@@ -124,7 +124,7 @@ static int block_iterate_dind(blk_t *din > ctx->bcount += limit*limit; > return ret; > } >- if (*dind_block >= ctx->fs->super->s_blocks_count || >+ if (*dind_block >= EXT2_BLOCKS_COUNT(ctx->fs->super) || > *dind_block < ctx->fs->super->s_first_data_block) { > ctx->errcode = EXT2_ET_BAD_DIND_BLOCK; > ret |= BLOCK_ERROR; >@@ -206,7 +206,7 @@ static int block_iterate_tind(blk_t *tin > ctx->bcount += limit*limit*limit; > return ret; > } >- if (*tind_block >= ctx->fs->super->s_blocks_count || >+ if (*tind_block >= EXT2_BLOCKS_COUNT(ctx->fs->super) || > *tind_block < ctx->fs->super->s_first_data_block) { > ctx->errcode = EXT2_ET_BAD_TIND_BLOCK; > ret |= BLOCK_ERROR; >Index: e2fsprogs-1.39/lib/ext2fs/bmove.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/bmove.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/bmove.c 2006-09-25 12:56:22.000000000 +0200 >@@ -50,7 +50,7 @@ static int process_block(ext2_filsys fs, > */ > if (ext2fs_test_block_bitmap(pb->reserve, block)) { > do { >- if (++block >= fs->super->s_blocks_count) >+ if (++block >= EXT2_BLOCKS_COUNT(fs->super)) > block = fs->super->s_first_data_block; > if (block == orig) { > pb->error = EXT2_ET_BLOCK_ALLOC_FAIL; >Index: e2fsprogs-1.39/lib/ext2fs/check_desc.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/check_desc.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/check_desc.c 2006-09-25 12:56:22.000000000 +0200 >@@ -45,22 +45,22 @@ errcode_t ext2fs_check_desc(ext2_filsys > * Check to make sure block bitmap for group is > * located within the group. > */ >- if (fs->group_desc[i].bg_block_bitmap < first_block || >- fs->group_desc[i].bg_block_bitmap > last_block) >+ if (EXT2_BLOCK_BITMAP(&fs->group_desc[i]) < first_block || >+ EXT2_BLOCK_BITMAP(&fs->group_desc[i]) > last_block) > return EXT2_ET_GDESC_BAD_BLOCK_MAP; > /* > * Check to make sure inode bitmap for group is > * located within the group > */ >- if (fs->group_desc[i].bg_inode_bitmap < first_block || >- fs->group_desc[i].bg_inode_bitmap > last_block) >+ if (EXT2_INODE_BITMAP(&fs->group_desc[i]) < first_block || >+ EXT2_INODE_BITMAP(&fs->group_desc[i]) > last_block) > return EXT2_ET_GDESC_BAD_INODE_MAP; > /* > * Check to make sure inode table for group is located > * within the group > */ >- if (fs->group_desc[i].bg_inode_table < first_block || >- ((fs->group_desc[i].bg_inode_table + >+ if (EXT2_INODE_TABLE(&fs->group_desc[i]) < first_block || >+ ((EXT2_INODE_TABLE(&fs->group_desc[i]) + > fs->inode_blocks_per_group) > last_block)) > return EXT2_ET_GDESC_BAD_INODE_TABLE; > } >Index: e2fsprogs-1.39/lib/ext2fs/closefs.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/closefs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/closefs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -54,11 +54,10 @@ int ext2fs_super_and_bgd_loc(ext2_filsys > { > blk_t group_block, super_blk = 0, old_desc_blk = 0, new_desc_blk = 0; > unsigned int meta_bg, meta_bg_size; >- int numblocks, has_super; >- int old_desc_blocks; >+ blk_t numblocks, old_desc_blocks; >+ int has_super; > >- group_block = fs->super->s_first_data_block + >- (group * fs->super->s_blocks_per_group); >+ group_block = EXT2_GROUP_BASE(fs->super, group); > > if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) > old_desc_blocks = fs->super->s_first_meta_bg; >@@ -67,7 +66,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys > fs->desc_blocks + fs->super->s_reserved_gdt_blocks; > > if (group == fs->group_desc_count-1) { >- numblocks = (fs->super->s_blocks_count - >+ numblocks = (EXT2_BLOCKS_COUNT(fs->super) - > fs->super->s_first_data_block) % > fs->super->s_blocks_per_group; > if (!numblocks) >Index: e2fsprogs-1.39/lib/ext2fs/ext2_fs.h >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/ext2_fs.h 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/ext2_fs.h 2006-09-25 12:56:22.000000000 +0200 >@@ -137,19 +137,54 @@ struct ext2_acl_entry /* Access Control > */ > struct ext2_group_desc > { >- __u32 bg_block_bitmap; /* Blocks bitmap block */ >- __u32 bg_inode_bitmap; /* Inodes bitmap block */ >+ __u32 bg_block_bitmap; /* Blocks bitmap block */ >+ __u32 bg_inode_bitmap; /* Inodes bitmap block */ > __u32 bg_inode_table; /* Inodes table block */ > __u16 bg_free_blocks_count; /* Free blocks count */ > __u16 bg_free_inodes_count; /* Free inodes count */ > __u16 bg_used_dirs_count; /* Directories count */ > __u16 bg_flags; >- __u32 bg_reserved[3]; >+ __u16 bg_block_bitmap_hi; /* Blocks bitmap block */ >+ __u16 bg_inode_bitmap_hi; /* Inodes bitmap block */ >+ __u16 bg_inode_table_hi; /* Inodes table block */ >+ __u16 bg_reserved[3]; > }; > > #define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */ > #define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */ > >+#define EXT2_GROUP_BASE(s,g) ((__u64)(s)->s_first_data_block + \ >+ (__u64)(s)->s_blocks_per_group * (g)) >+ >+#define EXT2_BLOCK_BITMAP(bg) \ >+ ((bg)->bg_block_bitmap + ((__u64)(bg)->bg_block_bitmap_hi << 32)) >+#define EXT2_INODE_BITMAP(bg) \ >+ ((bg)->bg_inode_bitmap + ((__u64)(bg)->bg_inode_bitmap_hi << 32)) >+#define EXT2_INODE_TABLE(bg) \ >+ ((bg)->bg_inode_table + ((__u64)(bg)->bg_inode_table_hi << 32)) >+ >+#define EXT2_BLOCK_BITMAP_SET(bg, value) \ >+ do { \ >+ (bg)->bg_block_bitmap = (__u32)(value); \ >+ (bg)->bg_block_bitmap_hi = (value) >> 32; \ >+ } while(0) >+#define EXT2_INODE_BITMAP_SET(bg, value) \ >+ do { \ >+ (bg)->bg_inode_bitmap = (__u32)(value); \ >+ (bg)->bg_inode_bitmap_hi = (value) >> 32; \ >+ } while(0) >+#define EXT2_INODE_TABLE_SET(bg, value) \ >+ do { \ >+ (bg)->bg_inode_table = (__u32)(value); \ >+ (bg)->bg_inode_table_hi = (value) >> 32; \ >+ } while(0) >+ >+#define EXT2_IS_USED_BLOCK_BITMAP(bg) \ >+ ((bg)->bg_block_bitmap != 0 || (bg)->bg_block_bitmap_hi != 0) >+#define EXT2_IS_USED_INODE_BITMAP(bg) \ >+ ((bg)->bg_inode_bitmap != 0 || (bg)->bg_inode_bitmap_hi != 0) >+#define EXT2_IS_USED_INODE_TABLE(bg) \ >+ ((bg)->bg_inode_table != 0 || (bg)->bg_inode_table_hi != 0) > /* > * Data structures used by the directory indexing feature > * >@@ -190,7 +225,7 @@ struct ext2_dx_countlimit { > /* > * Macro-instructions used to manage group descriptors > */ >-#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) >+#define EXT2_BLOCKS_PER_GROUP(s) ((__u64)EXT2_SB(s)->s_blocks_per_group) > #define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) > #define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) > /* limits imposed by 16-bit value gd_free_{blocks,inode}_count */ >@@ -526,9 +561,49 @@ struct ext2_super_block { > __u32 s_first_meta_bg; /* First metablock group */ > __u32 s_mkfs_time; /* When the filesystem was created */ > __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ >- __u32 s_reserved[172]; /* Padding to the end of the block */ >+ /* 64bit support valid if EXT3_FEATURE_INCOMPAT_64BIT */ >+ __u32 s_blocks_count_hi; /* Blocks count */ >+ __u32 s_r_blocks_count_hi; /* Reserved blocks count */ >+ __u32 s_free_blocks_count_hi; /* Free blocks count */ >+ __u32 s_reserved[169]; /* Padding to the end of the block */ > }; > >+#define EXT2_BLOCKS_COUNT(s) \ >+ ((s)->s_blocks_count + \ >+ ((s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ? \ >+ (__u64)(s)->s_blocks_count_hi << 32 : 0)) >+ >+#define EXT2_BLOCKS_COUNT_SET(s, v) \ >+ do { \ >+ (s)->s_blocks_count = (v); \ >+ if ((s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) \ >+ (s)->s_blocks_count_hi = (v) >> 32; \ >+ } while (0) >+ >+#define EXT2_R_BLOCKS_COUNT(s) \ >+ ((s)->s_r_blocks_count + \ >+ ((s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ? \ >+ (__u64)(s)->s_r_blocks_count_hi << 32 : 0)) >+ >+#define EXT2_R_BLOCKS_COUNT_SET(s, v) \ >+ do { \ >+ (s)->s_r_blocks_count = (v); \ >+ if ((s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) \ >+ (s)->s_r_blocks_count_hi = (v) >> 32; \ >+ } while (0) >+ >+#define EXT2_FREE_BLOCKS_COUNT(s) \ >+ ((s)->s_free_blocks_count + \ >+ ((s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT ? \ >+ (__u64)(s)->s_free_blocks_count_hi << 32 : 0)) >+ >+#define EXT2_FREE_BLOCKS_COUNT_SET(s, v) \ >+ do { \ >+ (s)->s_free_blocks_count = (v); \ >+ if ((s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) \ >+ (s)->s_free_blocks_count_hi = (v) >> 32; \ >+ } while (0) >+ > /* > * Codes for operating systems > */ >@@ -583,10 +658,11 @@ struct ext2_super_block { > #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ > #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 > #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 >- >+#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 > > #define EXT2_FEATURE_COMPAT_SUPP 0 >-#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE) >+#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ >+ EXT4_FEATURE_INCOMPAT_64BIT) > #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ > EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ > EXT2_FEATURE_RO_COMPAT_BTREE_DIR) >Index: e2fsprogs-1.39/lib/ext2fs/ext2fs.h >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/ext2fs.h 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/ext2fs.h 2006-09-25 12:56:22.000000000 +0200 >@@ -73,13 +73,15 @@ extern "C" { > #endif /* EXT2_FLAT_INCLUDES */ > > typedef __u32 ext2_ino_t; >-typedef __u32 blk_t; >+typedef __u64 blk_t; > typedef __u32 pblk_t; > typedef __u32 dgrp_t; > typedef __u32 ext2_off_t; > typedef __s64 e2_blkcnt_t; > typedef __u32 ext2_dirhash_t; > >+#define _EXT2_64BIT_BLK_T 1 >+ > #if EXT2_FLAT_INCLUDES > #include "com_err.h" > #include "ext2_io.h" >@@ -455,13 +457,15 @@ typedef struct ext2_icount *ext2_icount_ > EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ > EXT2_FEATURE_INCOMPAT_META_BG|\ > EXT3_FEATURE_INCOMPAT_RECOVER|\ >- EXT4_FEATURE_INCOMPAT_EXTENTS) >+ EXT4_FEATURE_INCOMPAT_EXTENTS|\ >+ EXT4_FEATURE_INCOMPAT_64BIT) > #else > #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ > EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ > EXT2_FEATURE_INCOMPAT_META_BG|\ > EXT3_FEATURE_INCOMPAT_RECOVER|\ >- EXT4_FEATURE_INCOMPAT_EXTENTS) >+ EXT4_FEATURE_INCOMPAT_EXTENTS|\ >+ EXT4_FEATURE_INCOMPAT_64BIT) > #endif > #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\ > EXT2_FEATURE_RO_COMPAT_LARGE_FILE) >@@ -993,7 +997,7 @@ extern blk_t ext2fs_group_first_block(ex > extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group); > extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, > struct ext2_inode *inode); >-extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); >+extern unsigned long long ext2fs_div_ceil(unsigned long long a, unsigned long long b); > > /* > * The actual inlined functions definitions themselves... >@@ -1160,8 +1164,8 @@ _INLINE_ int ext2fs_group_of_ino(ext2_fi > */ > _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group) > { >- return fs->super->s_first_data_block + >- (group * fs->super->s_blocks_per_group); >+ /* XXX remove EXT2_GROUP_BASE macro */ >+ return EXT2_GROUP_BASE(fs->super, group); > } > > /* >@@ -1170,7 +1174,7 @@ _INLINE_ blk_t ext2fs_group_first_block( > _INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group) > { > return (group == fs->group_desc_count - 1 ? >- fs->super->s_blocks_count - 1 : >+ EXT2_BLOCKS_COUNT(fs->super) - 1 : > ext2fs_group_first_block(fs, group) + > (fs->super->s_blocks_per_group - 1)); > } >@@ -1185,7 +1189,7 @@ _INLINE_ blk_t ext2fs_inode_data_blocks( > /* > * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b) > */ >-_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b) >+_INLINE_ unsigned long long ext2fs_div_ceil(unsigned long long a, unsigned long long b) > { > if (!a) > return 0; >Index: e2fsprogs-1.39/lib/ext2fs/ext_attr.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/ext_attr.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/ext_attr.c 2006-09-25 12:56:22.000000000 +0200 >@@ -110,7 +110,7 @@ errcode_t ext2fs_adjust_ea_refcount(ext2 > struct ext2_ext_attr_header *header; > char *buf = 0; > >- if ((blk >= fs->super->s_blocks_count) || >+ if ((blk >= EXT2_BLOCKS_COUNT(fs->super)) || > (blk < fs->super->s_first_data_block)) > return EXT2_ET_BAD_EA_BLOCK_NUM; > >Index: e2fsprogs-1.39/lib/ext2fs/imager.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/imager.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/imager.c 2006-09-25 12:56:22.000000000 +0200 >@@ -71,9 +71,9 @@ errcode_t ext2fs_image_inode_write(ext2_ > return ENOMEM; > > for (group = 0; group < fs->group_desc_count; group++) { >- blk = fs->group_desc[(unsigned)group].bg_inode_table; >- if (!blk) >+ if (!EXT2_IS_USED_INODE_TABLE(&fs->group_desc[(unsigned)group])) > return EXT2_ET_MISSING_INODE_TABLE; >+ blk = EXT2_INODE_TABLE(&fs->group_desc[(unsigned)group]); > left = fs->inode_blocks_per_group; > while (left) { > c = BUF_BLOCKS; >@@ -143,11 +143,11 @@ errcode_t ext2fs_image_inode_read(ext2_f > return ENOMEM; > > for (group = 0; group < fs->group_desc_count; group++) { >- blk = fs->group_desc[(unsigned)group].bg_inode_table; >- if (!blk) { >+ if (!EXT2_IS_USED_INODE_TABLE(&fs->group_desc[(unsigned)group])) { > retval = EXT2_ET_MISSING_INODE_TABLE; > goto errout; > } >+ blk = EXT2_INODE_TABLE(&fs->group_desc[(unsigned)group]); > left = fs->inode_blocks_per_group; > while (left) { > c = BUF_BLOCKS; >Index: e2fsprogs-1.39/lib/ext2fs/initialize.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/initialize.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/initialize.c 2006-09-25 12:56:58.000000000 +0200 >@@ -75,8 +75,8 @@ static unsigned int calc_reserved_gdt_bl > /* We set it at 1024x the current filesystem size, or > * the upper block count limit (2^32), whichever is lower. > */ >- if (sb->s_blocks_count < max_blocks / 1024) >- max_blocks = sb->s_blocks_count * 1024; >+ if (EXT2_BLOCKS_COUNT(sb) < max_blocks / 1024) >+ max_blocks = EXT2_BLOCKS_COUNT(sb) * 1024; > rsv_groups = ext2fs_div_ceil(max_blocks - sb->s_first_data_block, bpg); > rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - fs->desc_blocks; > if (rsv_gdb > EXT2_ADDR_PER_BLOCK(sb)) >@@ -105,8 +105,9 @@ errcode_t ext2fs_initialize(const char * > int rsv_gdt; > int io_flags; > char *buf; >+ blk_t inodes; > >- if (!param || !param->s_blocks_count) >+ if (!param || !EXT2_BLOCKS_COUNT(param)) > return EXT2_ET_INVALID_ARGUMENT; > > retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); >@@ -179,15 +180,16 @@ errcode_t ext2fs_initialize(const char * > fs->fragsize = EXT2_FRAG_SIZE(super); > frags_per_block = fs->blocksize / fs->fragsize; > >- /* default: (fs->blocksize*8) blocks/group, up to 2^16 (GDT limit) */ > set_field(s_blocks_per_group, fs->blocksize * 8); >+ /* default: (fs->blocksize*8) blocks/group, up to 2^16 (GDT limit) */ > if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) > super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); >+ > super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; > >- super->s_blocks_count = param->s_blocks_count; >- super->s_r_blocks_count = param->s_r_blocks_count; >- if (super->s_r_blocks_count >= param->s_blocks_count) { >+ EXT2_BLOCKS_COUNT_SET(super, EXT2_BLOCKS_COUNT(param)); >+ EXT2_R_BLOCKS_COUNT_SET(super, EXT2_R_BLOCKS_COUNT(param)); >+ if (EXT2_R_BLOCKS_COUNT(super) >= EXT2_BLOCKS_COUNT(param)) { > retval = EXT2_ET_INVALID_ARGUMENT; > goto cleanup; > } >@@ -204,7 +206,7 @@ errcode_t ext2fs_initialize(const char * > } > > retry: >- fs->group_desc_count = ext2fs_div_ceil(super->s_blocks_count - >+ fs->group_desc_count = ext2fs_div_ceil(EXT2_BLOCKS_COUNT(super) - > super->s_first_data_block, > EXT2_BLOCKS_PER_GROUP(super)); > if (fs->group_desc_count == 0) { >@@ -215,7 +217,7 @@ retry: > EXT2_DESC_PER_BLOCK(super)); > > i = fs->blocksize >= 4096 ? 1 : 4096 / fs->blocksize; >- set_field(s_inodes_count, super->s_blocks_count / i); >+ set_field(s_inodes_count, EXT2_BLOCKS_COUNT(super) / i); > > /* > * Make sure we have at least EXT2_FIRST_INO + 1 inodes, so >@@ -235,7 +237,7 @@ retry: > if (super->s_blocks_per_group >= 256) { > /* Try again with slightly different parameters */ > super->s_blocks_per_group -= 8; >- super->s_blocks_count = param->s_blocks_count; >+ EXT2_BLOCKS_COUNT_SET(super, EXT2_BLOCKS_COUNT(param)); > super->s_frags_per_group = super->s_blocks_per_group * > frags_per_block; > goto retry; >@@ -317,12 +319,12 @@ ipg_retry: > * necessary data structures. If not, we need to get rid of > * it. > */ >- rem = ((super->s_blocks_count - super->s_first_data_block) % >+ rem = ((EXT2_BLOCKS_COUNT(super) - super->s_first_data_block) % > super->s_blocks_per_group); > if ((fs->group_desc_count == 1) && rem && (rem < overhead)) > return EXT2_ET_TOOSMALL; > if (rem && (rem < overhead+50)) { >- super->s_blocks_count -= rem; >+ EXT2_BLOCKS_COUNT_SET(super, EXT2_BLOCKS_COUNT(super) - rem); > goto retry; > } > >@@ -362,11 +364,11 @@ ipg_retry: > * inode table have not been allocated (and in fact won't be > * by this routine), they are accounted for nevertheless. > */ >- super->s_free_blocks_count = 0; >+ EXT2_FREE_BLOCKS_COUNT_SET(super, 0ULL); > for (i = 0; i < fs->group_desc_count; i++) { > numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map); > >- super->s_free_blocks_count += numblocks; >+ EXT2_FREE_BLOCKS_COUNT_SET(super, EXT2_FREE_BLOCKS_COUNT(super) + numblocks); > fs->group_desc[i].bg_free_blocks_count = numblocks; > fs->group_desc[i].bg_free_inodes_count = > fs->super->s_inodes_per_group; >Index: e2fsprogs-1.39/lib/ext2fs/inode.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/inode.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/inode.c 2006-09-25 12:56:22.000000000 +0200 >@@ -142,8 +142,7 @@ errcode_t ext2fs_open_inode_scan(ext2_fi > scan->current_group = 0; > scan->groups_left = fs->group_desc_count - 1; > scan->inode_buffer_blocks = buffer_blocks ? buffer_blocks : 8; >- scan->current_block = scan->fs-> >- group_desc[scan->current_group].bg_inode_table; >+ scan->current_block = EXT2_INODE_TABLE(&scan->fs->group_desc[scan->current_group]); > scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); > scan->blocks_left = scan->fs->inode_blocks_per_group; > retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * >@@ -221,8 +220,7 @@ static errcode_t get_next_blockgroup(ext > scan->current_group++; > scan->groups_left--; > >- scan->current_block = scan->fs-> >- group_desc[scan->current_group].bg_inode_table; >+ scan->current_block = EXT2_INODE_TABLE(&scan->fs->group_desc[scan->current_group]); > > scan->current_inode = scan->current_group * > EXT2_INODES_PER_GROUP(scan->fs->super); >@@ -547,9 +545,9 @@ errcode_t ext2fs_read_inode_full(ext2_fi > offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * > EXT2_INODE_SIZE(fs->super); > block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); >- if (!fs->group_desc[(unsigned)group].bg_inode_table) >+ if (!EXT2_IS_USED_INODE_TABLE(&fs->group_desc[(unsigned)group])) > return EXT2_ET_MISSING_INODE_TABLE; >- block_nr = fs->group_desc[(unsigned)group].bg_inode_table + >+ block_nr = EXT2_INODE_TABLE(&fs->group_desc[(unsigned)group]) + > block; > io = fs->io; > } >@@ -671,9 +669,9 @@ errcode_t ext2fs_write_inode_full(ext2_f > offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * > EXT2_INODE_SIZE(fs->super); > block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); >- if (!fs->group_desc[(unsigned) group].bg_inode_table) >+ if (!EXT2_IS_USED_INODE_TABLE(&fs->group_desc[(unsigned) group])) > return EXT2_ET_MISSING_INODE_TABLE; >- block_nr = fs->group_desc[(unsigned) group].bg_inode_table + block; >+ block_nr = EXT2_INODE_TABLE(&fs->group_desc[(unsigned) group]) + block; > > offset &= (EXT2_BLOCK_SIZE(fs->super) - 1); > >Index: e2fsprogs-1.39/lib/ext2fs/openfs.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/openfs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/openfs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -42,8 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_f > bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; > if (ext2fs_bg_has_super(fs, bg)) > has_super = 1; >- ret_blk = (fs->super->s_first_data_block + has_super + >- (bg * fs->super->s_blocks_per_group)); >+ ret_blk = EXT2_GROUP_BASE(fs->super, bg) + has_super; > /* > * If group_block is not the normal value, we're trying to use > * the backup group descriptors and superblock --- so use the >@@ -54,7 +53,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_f > */ > if (group_block != fs->super->s_first_data_block && > ((ret_blk + fs->super->s_blocks_per_group) < >- fs->super->s_blocks_count)) >+ EXT2_BLOCKS_COUNT(fs->super))) > ret_blk += fs->super->s_blocks_per_group; > return ret_blk; > } >@@ -258,7 +257,7 @@ errcode_t ext2fs_open2(const char *name, > retval = EXT2_ET_CORRUPT_SUPERBLOCK; > goto cleanup; > } >- fs->group_desc_count = ext2fs_div_ceil(fs->super->s_blocks_count - >+ fs->group_desc_count = ext2fs_div_ceil(EXT2_BLOCKS_COUNT(fs->super) - > fs->super->s_first_data_block, > blocks_per_group); > fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count, >Index: e2fsprogs-1.39/lib/ext2fs/read_bb.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/read_bb.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/read_bb.c 2006-09-25 12:56:22.000000000 +0200 >@@ -49,7 +49,7 @@ static int mark_bad_block(ext2_filsys fs > return 0; > > if ((*block_nr < fs->super->s_first_data_block) || >- (*block_nr >= fs->super->s_blocks_count)) >+ (*block_nr >= EXT2_BLOCKS_COUNT(fs->super))) > return 0; /* Ignore illegal blocks */ > > rb->err = ext2fs_badblocks_list_add(rb->bb_list, *block_nr); >Index: e2fsprogs-1.39/lib/ext2fs/read_bb_file.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/read_bb_file.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/read_bb_file.c 2006-09-25 12:56:22.000000000 +0200 >@@ -54,12 +54,12 @@ errcode_t ext2fs_read_bb_FILE2(ext2_fils > while (!feof (f)) { > if (fgets(buf, sizeof(buf), f) == NULL) > break; >- count = sscanf(buf, "%u", &blockno); >+ count = sscanf(buf, "%llu", &blockno); > if (count <= 0) > continue; > if (fs && > ((blockno < fs->super->s_first_data_block) || >- (blockno >= fs->super->s_blocks_count))) { >+ (blockno >= EXT2_BLOCKS_COUNT(fs->super)))) { > if (invalid) > (invalid)(fs, blockno, buf, priv_data); > continue; >Index: e2fsprogs-1.39/lib/ext2fs/rw_bitmaps.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/rw_bitmaps.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/rw_bitmaps.c 2006-09-25 12:56:22.000000000 +0200 >@@ -101,15 +101,15 @@ static errcode_t write_bitmaps(ext2_fils > memcpy(block_buf, block_bitmap, block_nbytes); > if (i == fs->group_desc_count - 1) { > /* Force bitmap padding for the last group */ >- nbits = ((fs->super->s_blocks_count >+ nbits = ((EXT2_BLOCKS_COUNT(fs->super) > - fs->super->s_first_data_block) > % EXT2_BLOCKS_PER_GROUP(fs->super)); > if (nbits) > for (j = nbits; j < fs->blocksize * 8; j++) > ext2fs_set_bit(j, block_buf); > } >- blk = fs->group_desc[i].bg_block_bitmap; >- if (blk) { >+ if (EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[i])) { >+ blk = EXT2_BLOCK_BITMAP(&fs->group_desc[i]); > #ifdef EXT2_BIG_ENDIAN_BITMAPS > if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) || > (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))) >@@ -133,8 +133,8 @@ static errcode_t write_bitmaps(ext2_fils > goto skip_this_inode_bitmap; > > memcpy(inode_buf, inode_bitmap, inode_nbytes); >- blk = fs->group_desc[i].bg_inode_bitmap; >- if (blk) { >+ if (EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[i])) { >+ blk = EXT2_INODE_BITMAP(&fs->group_desc[i]); > #ifdef EXT2_BIG_ENDIAN_BITMAPS > if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) || > (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))) >@@ -227,11 +227,11 @@ static errcode_t read_bitmaps(ext2_filsy > > for (i = 0; i < fs->group_desc_count; i++) { > if (block_bitmap) { >- blk = fs->group_desc[i].bg_block_bitmap; >+ if (EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[i])) { >+ blk = EXT2_BLOCK_BITMAP(&fs->group_desc[i]); > if (lazy_flag && fs->group_desc[i].bg_flags & > EXT2_BG_BLOCK_UNINIT) > blk = 0; >- if (blk) { > retval = io_channel_read_blk(fs->io, blk, > -block_nbytes, block_bitmap); > if (retval) { >@@ -248,11 +248,11 @@ static errcode_t read_bitmaps(ext2_filsy > block_bitmap += block_nbytes; > } > if (inode_bitmap) { >- blk = fs->group_desc[i].bg_inode_bitmap; >+ if (EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[i])) { >+ blk = EXT2_INODE_BITMAP(&fs->group_desc[i]); > if (lazy_flag && fs->group_desc[i].bg_flags & > EXT2_BG_INODE_UNINIT) > blk = 0; >- if (blk) { > retval = io_channel_read_blk(fs->io, blk, > -inode_nbytes, inode_bitmap); > if (retval) { >Index: e2fsprogs-1.39/lib/ext2fs/swapfs.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/swapfs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/swapfs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -26,8 +26,11 @@ void ext2fs_swap_super(struct ext2_super > int i; > sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); > sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); >+ sb->s_blocks_count_hi = ext2fs_swab32(sb->s_blocks_count_hi); > sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); >+ sb->s_r_blocks_count_hi = ext2fs_swab32(sb->s_r_blocks_count_hi); > sb->s_free_blocks_count = ext2fs_swab32(sb->s_free_blocks_count); >+ sb->s_free_blocks_count_hi = ext2fs_swab32(sb->s_free_blocks_count_hi); > sb->s_free_inodes_count = ext2fs_swab32(sb->s_free_inodes_count); > sb->s_first_data_block = ext2fs_swab32(sb->s_first_data_block); > sb->s_log_block_size = ext2fs_swab32(sb->s_log_block_size); >Index: e2fsprogs-1.39/lib/ext2fs/tst_badblocks.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/tst_badblocks.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/tst_badblocks.c 2006-09-25 12:56:22.000000000 +0200 >@@ -227,7 +227,7 @@ int file_test_invalid(badblocks_list bb) > fs->super = malloc(SUPERBLOCK_SIZE); > memset(fs->super, 0, SUPERBLOCK_SIZE); > fs->super->s_first_data_block = 1; >- fs->super->s_blocks_count = 100; >+ EXT2_BLOCKS_COUNT_SET(fs->super, 100); > > f = tmpfile(); > if (!f) { >Index: e2fsprogs-1.39/lib/ext2fs/tst_iscan.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/tst_iscan.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/tst_iscan.c 2006-09-25 12:56:22.000000000 +0200 >@@ -71,7 +71,7 @@ static void setup(void) > initialize_ext2_error_table(); > > memset(¶m, 0, sizeof(param)); >- param.s_blocks_count = 12000; >+ EXT2_BLOCKS_COUNT_SET(¶m, 12000); > > > test_io_cb_read_blk = test_read_blk; >@@ -182,7 +182,7 @@ static void check_map(void) > ext2fs_mark_block_bitmap(touched_map, test_vec[i]); > } > for (i = 0; i < test_fs->group_desc_count; i++) { >- for (j=0, blk = test_fs->group_desc[i].bg_inode_table; >+ for (j=0, blk = EXT2_INODE_TABLE(&test_fs->group_desc[i]); > j < test_fs->inode_blocks_per_group; > j++, blk++) { > if (!ext2fs_test_block_bitmap(touched_map, blk) && >Index: e2fsprogs-1.39/lib/ext2fs/write_bb_file.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/write_bb_file.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/write_bb_file.c 2006-09-25 12:56:22.000000000 +0200 >@@ -27,7 +27,7 @@ errcode_t ext2fs_write_bb_FILE(ext2_badb > return retval; > > while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) { >- fprintf(f, "%u\n", blk); >+ fprintf(f, "%llu\n", blk); > } > ext2fs_badblocks_list_iterate_end(bb_iter); > return 0; >Index: e2fsprogs-1.39/misc/badblocks.c >=================================================================== >--- e2fsprogs-1.39.orig/misc/badblocks.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/misc/badblocks.c 2006-09-25 12:56:22.000000000 +0200 >@@ -1057,7 +1057,7 @@ int main (int argc, char ** argv) > > if (in) { > for(;;) { >- switch(fscanf (in, "%u\n", &next_bad)) { >+ switch(fscanf (in, "%llu\n", &next_bad)) { > case 0: > com_err (program_name, 0, "input file - bad format"); > exit (1); >Index: e2fsprogs-1.39/misc/dumpe2fs.c >=================================================================== >--- e2fsprogs-1.39.orig/misc/dumpe2fs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/misc/dumpe2fs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -58,17 +58,17 @@ static void usage(void) > static void print_number(blk_t num) > { > if (hex_format) >- printf("0x%04x", num); >+ printf("0x%04llx", num); > else >- printf("%u", num); >+ printf("%llu", num); > } > > static void print_range(blk_t a, blk_t b) > { > if (hex_format) >- printf("0x%04x-0x%04x", a, b); >+ printf("0x%04llx-0x%04llx", a, b); > else >- printf("%u-%u", a, b); >+ printf("%llu-%llu", a, b); > } > > static void print_free (unsigned long group, char * bitmap, >@@ -188,20 +188,20 @@ static void list_desc (ext2_filsys fs) > if (has_super) > fputc('\n', stdout); > fputs(_(" Block bitmap at "), stdout); >- print_number(fs->group_desc[i].bg_block_bitmap); >- diff = fs->group_desc[i].bg_block_bitmap - first_block; >+ print_number(EXT2_BLOCK_BITMAP(&fs->group_desc[i])); >+ diff = EXT2_BLOCK_BITMAP(&fs->group_desc[i]) - first_block; > if (diff >= 0) > printf(" (+%ld)", diff); > fputs(_(", Inode bitmap at "), stdout); >- print_number(fs->group_desc[i].bg_inode_bitmap); >- diff = fs->group_desc[i].bg_inode_bitmap - first_block; >+ print_number(EXT2_INODE_BITMAP(&fs->group_desc[i])); >+ diff = EXT2_INODE_BITMAP(&fs->group_desc[i]) - first_block; > if (diff >= 0) > printf(" (+%ld)", diff); > fputs(_("\n Inode table at "), stdout); >- print_range(fs->group_desc[i].bg_inode_table, >- fs->group_desc[i].bg_inode_table + >+ print_range(EXT2_INODE_TABLE(&fs->group_desc[i]), >+ EXT2_INODE_TABLE(&fs->group_desc[i]) + > inode_blocks_per_group - 1); >- diff = fs->group_desc[i].bg_inode_table - first_block; >+ diff = EXT2_INODE_TABLE(&fs->group_desc[i]) - first_block; > if (diff > 0) > printf(" (+%ld)", diff); > printf (_("\n %d free blocks, %d free inodes, " >Index: e2fsprogs-1.39/misc/e2image.c >=================================================================== >--- e2fsprogs-1.39.orig/misc/e2image.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/misc/e2image.c 2006-09-25 12:56:22.000000000 +0200 >@@ -265,8 +265,8 @@ static void mark_table_blocks(ext2_filsy > /* > * Mark the blocks used for the inode table > */ >- if (fs->group_desc[i].bg_inode_table) { >- for (j = 0, b = fs->group_desc[i].bg_inode_table; >+ if (EXT2_IS_USED_INODE_TABLE(&fs->group_desc[i])) { >+ for (j = 0, b = EXT2_INODE_TABLE(&fs->group_desc[i]); > j < (unsigned) fs->inode_blocks_per_group; > j++, b++) > ext2fs_mark_block_bitmap(meta_block_map, b); >@@ -275,17 +275,17 @@ static void mark_table_blocks(ext2_filsy > /* > * Mark block used for the block bitmap > */ >- if (fs->group_desc[i].bg_block_bitmap) { >+ if (EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[i])) { > ext2fs_mark_block_bitmap(meta_block_map, >- fs->group_desc[i].bg_block_bitmap); >+ EXT2_BLOCK_BITMAP(&fs->group_desc[i])); > } > > /* > * Mark block used for the inode bitmap > */ >- if (fs->group_desc[i].bg_inode_bitmap) { >+ if (EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[i])) { > ext2fs_mark_block_bitmap(meta_block_map, >- fs->group_desc[i].bg_inode_bitmap); >+ EXT2_INODE_BITMAP(&fs->group_desc[i])); > } > } > } >@@ -328,7 +328,7 @@ static void write_block(int fd, char *bu > err = errno; > else > err = 0; >- com_err(program_name, err, "error writing block %u", >+ com_err(program_name, err, "error writing block %llu", > block); > } > } >@@ -411,13 +411,13 @@ static void output_meta_data_blocks(ext2 > exit(1); > } > memset(zero_buf, 0, fs->blocksize); >- for (blk = 0; blk < fs->super->s_blocks_count; blk++) { >+ for (blk = 0; blk < EXT2_BLOCKS_COUNT(fs->super); blk++) { > if ((blk >= fs->super->s_first_data_block) && > ext2fs_test_block_bitmap(meta_block_map, blk)) { > retval = io_channel_read_blk(fs->io, blk, 1, buf); > if (retval) { > com_err(program_name, retval, >- "error reading block %u", blk); >+ "error reading block %llu", blk); > } > if (scramble_block_map && > ext2fs_test_block_bitmap(scramble_block_map, blk)) >Index: e2fsprogs-1.39/misc/mke2fs.c >=================================================================== >--- e2fsprogs-1.39.orig/misc/mke2fs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/misc/mke2fs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -152,7 +152,7 @@ static int parse_version_number(const ch > */ > static void invalid_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t blk) > { >- fprintf(stderr, _("Bad block %u out of range; ignored.\n"), blk); >+ fprintf(stderr, _("Bad block %llu out of range; ignored.\n"), blk); > return; > } > >@@ -189,9 +189,9 @@ static void test_disk(ext2_filsys fs, ba > errcode_t retval; > char buf[1024]; > >- sprintf(buf, "badblocks -b %d -X %s%s%s %u", fs->blocksize, >+ sprintf(buf, "badblocks -b %d -X %s%s%s %llu", fs->blocksize, > quiet ? "" : "-s ", (cflag > 1) ? "-w " : "", >- fs->device_name, fs->super->s_blocks_count); >+ fs->device_name, EXT2_BLOCKS_COUNT(fs->super)); > if (verbose) > printf(_("Running command: %s\n"), buf); > f = popen(buf, "r"); >@@ -256,13 +256,13 @@ static void handle_bad_blocks(ext2_filsy > group_block + j)) { > if (!group_bad) > fprintf(stderr, >-_("Warning: the backup superblock/group descriptors at block %u contain\n" >+_("Warning: the backup superblock/group descriptors at block %llu contain\n" > " bad blocks.\n\n"), > group_block); > group_bad++; > group = ext2fs_group_of_blk(fs, group_block+j); > fs->group_desc[group].bg_free_blocks_count++; >- fs->super->s_free_blocks_count++; >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, EXT2_FREE_BLOCKS_COUNT(fs->super) + 1); > } > } > group_block += fs->super->s_blocks_per_group; >@@ -419,7 +419,7 @@ static void write_inode_tables(ext2_fils > for (i = 0; i < fs->group_desc_count; i++) { > progress_update(&progress, i); > >- blk = fs->group_desc[i].bg_inode_table; >+ blk = EXT2_INODE_TABLE(&fs->group_desc[i]); > num = fs->inode_blocks_per_group; > > if (!(lazy_flag && >@@ -427,7 +427,7 @@ static void write_inode_tables(ext2_fils > retval = zero_blocks(fs, blk, num, 0, &blk, &num); > if (retval) { > fprintf(stderr, _("\nCould not write %d " >- "blocks in inode table starting at %u: %s\n"), >+ "blocks in inode table starting at %llu: %s\n"), > num, blk, error_message(retval)); > exit(1); > } >@@ -467,7 +467,8 @@ static void setup_lazy_bg(ext2_filsys fs > if (bg->bg_free_blocks_count == blks) { > bg->bg_free_blocks_count = 0; > bg->bg_flags |= EXT2_BG_BLOCK_UNINIT; >- sb->s_free_blocks_count -= blks; >+ EXT2_FREE_BLOCKS_COUNT_SET(sb, >+ EXT2_FREE_BLOCKS_COUNT(sb) - blks); > } > } > } >@@ -526,6 +527,7 @@ static void create_lost_and_found(ext2_f > exit(1); > } > >+ if (!(fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)) { > for (i=1; i < EXT2_NDIR_BLOCKS; i++) { > if ((lpf_size += fs->blocksize) >= 16*1024) > break; >@@ -536,6 +538,7 @@ static void create_lost_and_found(ext2_f > exit(1); > } > } >+ } > } > > static void create_bad_block_inode(ext2_filsys fs, badblocks_list bb_list) >@@ -619,7 +622,7 @@ static void create_journal_dev(ext2_fils > int count; > > retval = ext2fs_create_journal_superblock(fs, >- fs->super->s_blocks_count, 0, &buf); >+ EXT2_BLOCKS_COUNT(fs->super), 0, &buf); > if (retval) { > com_err("create_journal_dev", retval, > _("while initializing journal superblock")); >@@ -629,13 +632,13 @@ static void create_journal_dev(ext2_fils > memset(&progress, 0, sizeof(progress)); > else > progress_init(&progress, _("Zeroing journal device: "), >- fs->super->s_blocks_count); >+ EXT2_BLOCKS_COUNT(fs->super)); > >- retval = zero_blocks(fs, 0, fs->super->s_blocks_count, >+ retval = zero_blocks(fs, 0, EXT2_BLOCKS_COUNT(fs->super), > &progress, &blk, &count); > if (retval) { > com_err("create_journal_dev", retval, >- _("while zeroing journal device (block %u, count %d)"), >+ _("while zeroing journal device (block %llu, count %d)"), > blk, count); > exit(1); > } >@@ -661,9 +664,9 @@ static void show_stats(ext2_filsys fs) > dgrp_t i; > int need, col_left; > >- if (fs_param.s_blocks_count != s->s_blocks_count) >- fprintf(stderr, _("warning: %u blocks unused.\n\n"), >- fs_param.s_blocks_count - s->s_blocks_count); >+ if (EXT2_BLOCKS_COUNT(&fs_param) != EXT2_BLOCKS_COUNT(s)) >+ fprintf(stderr, _("warning: %llu blocks unused.\n\n"), >+ EXT2_BLOCKS_COUNT(&fs_param) - EXT2_BLOCKS_COUNT(s)); > > memset(buf, 0, sizeof(buf)); > strncpy(buf, s->s_volume_name, sizeof(s->s_volume_name)); >@@ -677,14 +680,14 @@ static void show_stats(ext2_filsys fs) > s->s_log_block_size); > printf(_("Fragment size=%u (log=%u)\n"), fs->fragsize, > s->s_log_frag_size); >- printf(_("%u inodes, %u blocks\n"), s->s_inodes_count, >- s->s_blocks_count); >- printf(_("%u blocks (%2.2f%%) reserved for the super user\n"), >- s->s_r_blocks_count, >- 100.0 * s->s_r_blocks_count / s->s_blocks_count); >+ printf(_("%u inodes, %llu blocks\n"), s->s_inodes_count, >+ EXT2_BLOCKS_COUNT(s)); >+ printf(_("%llu blocks (%2.2f%%) reserved for the super user\n"), >+ EXT2_R_BLOCKS_COUNT(s), >+ 100.0 * EXT2_R_BLOCKS_COUNT(s) / EXT2_BLOCKS_COUNT(s)); > printf(_("First data block=%u\n"), s->s_first_data_block); > if (s->s_reserved_gdt_blocks) >- printf(_("Maximum filesystem blocks=%u\n"), >+ printf(_("Maximum filesystem blocks=%llu\n"), > (blk_t)((s->s_reserved_gdt_blocks + fs->desc_blocks) * > (fs->blocksize / sizeof(struct ext2_group_desc)) * > s->s_blocks_per_group)); >@@ -716,7 +719,7 @@ static void show_stats(ext2_filsys fs) > col_left = 72; > } > col_left -= need; >- printf("%u", group_block); >+ printf("%llu", group_block); > } > printf("\n\n"); > } >@@ -807,7 +810,7 @@ static void parse_extended_opts(struct e > r_usage++; > continue; > } >- if (resize <= param->s_blocks_count) { >+ if (resize <= EXT2_BLOCKS_COUNT(param)) { > fprintf(stderr, > _("The resize maximum must be greater " > "than the filesystem size.\n")); >@@ -821,7 +824,7 @@ static void parse_extended_opts(struct e > bpg = blocksize * 8; > gdpb = blocksize / sizeof(struct ext2_group_desc); > group_desc_count = >- ext2fs_div_ceil(param->s_blocks_count, bpg); >+ ext2fs_div_ceil(EXT2_BLOCKS_COUNT(param), bpg); > desc_blocks = (group_desc_count + > gdpb - 1) / gdpb; > rsv_groups = ext2fs_div_ceil(resize, bpg); >@@ -1188,9 +1191,10 @@ static void PRS(int argc, char *argv[]) > blocksize, sys_page_size); > } > if (optind < argc) { >- fs_param.s_blocks_count = parse_num_blocks(argv[optind++], >- fs_param.s_log_block_size); >- if (!fs_param.s_blocks_count) { >+ EXT2_BLOCKS_COUNT_SET(&fs_param, >+ parse_num_blocks(argv[optind++], >+ fs_param.s_log_block_size)); >+ if (!EXT2_BLOCKS_COUNT(&fs_param)) { > com_err(program_name, 0, _("invalid blocks count - %s"), > argv[optind - 1]); > exit(1); >@@ -1205,8 +1209,8 @@ static void PRS(int argc, char *argv[]) > > fs_param.s_log_frag_size = fs_param.s_log_block_size; > >- if (noaction && fs_param.s_blocks_count) { >- dev_size = fs_param.s_blocks_count; >+ if (noaction && (EXT2_BLOCKS_COUNT(&fs_param))) { >+ dev_size = EXT2_BLOCKS_COUNT(&fs_param); > retval = 0; > } else { > retry: >@@ -1227,7 +1231,7 @@ static void PRS(int argc, char *argv[]) > _("while trying to determine filesystem size")); > exit(1); > } >- if (!fs_param.s_blocks_count) { >+ if (!EXT2_BLOCKS_COUNT(&fs_param)) { > if (retval == EXT2_ET_UNIMPLEMENTED) { > com_err(program_name, 0, > _("Couldn't determine device size; you " >@@ -1247,20 +1251,25 @@ static void PRS(int argc, char *argv[]) > )); > exit(1); > } >- fs_param.s_blocks_count = dev_size; >+ if (dev_size >> 31) { >+ fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT; >+ } >+ EXT2_BLOCKS_COUNT_SET(&fs_param, dev_size); > if (sys_page_size > EXT2_BLOCK_SIZE(&fs_param)) >- fs_param.s_blocks_count &= ~((sys_page_size / >- EXT2_BLOCK_SIZE(&fs_param))-1); >+ EXT2_BLOCKS_COUNT_SET(&fs_param, >+ EXT2_BLOCKS_COUNT(&fs_param) & >+ ~((sys_page_size / >+ EXT2_BLOCK_SIZE(&fs_param))-1)); > } > >- } else if (!force && (fs_param.s_blocks_count > dev_size)) { >+ } else if (!force && (EXT2_BLOCKS_COUNT(&fs_param) > dev_size)) { > com_err(program_name, 0, > _("Filesystem larger than apparent device size.")); > proceed_question(); > } > > if (!fs_type) { >- int megs = (__u64)fs_param.s_blocks_count * >+ int megs = EXT2_BLOCKS_COUNT(&fs_param) * > (EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024; > > if (megs <= 3) >@@ -1357,7 +1366,7 @@ static void PRS(int argc, char *argv[]) > if ((blocksize < 0) && (use_bsize < (-blocksize))) > use_bsize = -blocksize; > blocksize = use_bsize; >- fs_param.s_blocks_count /= blocksize / 1024; >+ EXT2_BLOCKS_COUNT_SET(&fs_param, EXT2_BLOCKS_COUNT(&fs_param) / (blocksize / 1024)); > } > > if (inode_ratio == 0) { >@@ -1433,7 +1442,7 @@ static void PRS(int argc, char *argv[]) > /* Make sure number of inodes specified will fit in 32 bits */ > if (num_inodes == 0) { > __u64 n; >- n = (__u64) fs_param.s_blocks_count * blocksize / inode_ratio; >+ n = EXT2_BLOCKS_COUNT(&fs_param) * blocksize / inode_ratio; > if (n > ~0U) { > com_err(program_name, 0, > _("too many inodes (%llu), raise inode ratio?"), n); >@@ -1449,14 +1458,15 @@ static void PRS(int argc, char *argv[]) > * Calculate number of inodes based on the inode ratio > */ > fs_param.s_inodes_count = num_inodes ? num_inodes : >- ((__u64) fs_param.s_blocks_count * blocksize) >+ ((__u64) EXT2_BLOCKS_COUNT(&fs_param) * blocksize) > / inode_ratio; > > /* > * Calculate number of blocks to reserve > */ >- fs_param.s_r_blocks_count = e2p_percent(reserved_ratio, >- fs_param.s_blocks_count); >+ EXT2_R_BLOCKS_COUNT_SET( >+ &fs_param, e2p_percent( >+ reserved_ratio, EXT2_BLOCKS_COUNT(&fs_param))); > } > > int main (int argc, char *argv[]) >@@ -1587,7 +1597,7 @@ int main (int argc, char *argv[]) > } else { > /* rsv must be a power of two (64kB is MD RAID sb alignment) */ > unsigned int rsv = 65536 / fs->blocksize; >- unsigned long blocks = fs->super->s_blocks_count; >+ unsigned long blocks = EXT2_BLOCKS_COUNT(fs->super); > unsigned long start; > blk_t ret_blk; > >@@ -1609,7 +1619,7 @@ int main (int argc, char *argv[]) > > if (retval) { > com_err(program_name, retval, >- _("while zeroing block %u at end of filesystem"), >+ _("while zeroing block %llu at end of filesystem"), > ret_blk); > } > setup_lazy_bg(fs); >Index: e2fsprogs-1.39/misc/tune2fs.c >=================================================================== >--- e2fsprogs-1.39.orig/misc/tune2fs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/misc/tune2fs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -214,7 +214,7 @@ static int release_blocks_proc(ext2_fils > ext2fs_unmark_block_bitmap(fs->block_map,block); > group = ext2fs_group_of_blk(fs, block); > fs->group_desc[group].bg_free_blocks_count++; >- fs->super->s_free_blocks_count++; >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, EXT2_FREE_BLOCKS_COUNT(fs->super) + 1); > return 0; > } > >@@ -824,22 +824,23 @@ int main (int argc, char ** argv) > printf (_("Setting interval between checks to %lu seconds\n"), interval); > } > if (m_flag) { >- sb->s_r_blocks_count = e2p_percent(reserved_ratio, >- sb->s_blocks_count); >+ EXT2_R_BLOCKS_COUNT_SET( >+ sb, e2p_percent( >+ reserved_ratio, EXT2_BLOCKS_COUNT(sb))); > ext2fs_mark_super_dirty(fs); >- printf (_("Setting reserved blocks percentage to %g%% (%u blocks)\n"), >- reserved_ratio, sb->s_r_blocks_count); >+ printf (_("Setting reserved blocks percentage to %g%% (%llu blocks)\n"), >+ reserved_ratio, EXT2_R_BLOCKS_COUNT(sb)); > } > if (r_flag) { >- if (reserved_blocks >= sb->s_blocks_count/2) { >+ if (reserved_blocks >= EXT2_BLOCKS_COUNT(sb)/2) { > com_err (program_name, 0, >- _("reserved blocks count is too big (%u)"), >+ _("reserved blocks count is too big (%llu)"), > reserved_blocks); > exit (1); > } >- sb->s_r_blocks_count = reserved_blocks; >+ EXT2_R_BLOCKS_COUNT_SET(sb, reserved_blocks); > ext2fs_mark_super_dirty(fs); >- printf (_("Setting reserved blocks count to %u\n"), >+ printf (_("Setting reserved blocks count to %llu\n"), > reserved_blocks); > } > if (s_flag == 1) { >Index: e2fsprogs-1.39/misc/util.c >=================================================================== >--- e2fsprogs-1.39.orig/misc/util.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/misc/util.c 2006-09-25 12:56:22.000000000 +0200 >@@ -251,7 +251,7 @@ int figure_journal_size(int size, ext2_f > { > blk_t j_blocks; > >- if (fs->super->s_blocks_count < 2048) { >+ if (EXT2_BLOCKS_COUNT(fs->super) < 2048) { > fputs(_("\nFilesystem too small for a journal\n"), stderr); > return 0; > } >@@ -260,13 +260,13 @@ int figure_journal_size(int size, ext2_f > j_blocks = size * 1024 / (fs->blocksize / 1024); > if (j_blocks < 1024 || j_blocks > 102400) { > fprintf(stderr, _("\nThe requested journal " >- "size is %d blocks; it must be\n" >+ "size is %llu blocks; it must be\n" > "between 1024 and 102400 blocks. " > "Aborting.\n"), > j_blocks); > exit(1); > } >- if (j_blocks > fs->super->s_free_blocks_count) { >+ if (j_blocks > EXT2_FREE_BLOCKS_COUNT(fs->super)) { > fputs(_("\nJournal size too big for filesystem.\n"), > stderr); > exit(1); >@@ -274,13 +274,13 @@ int figure_journal_size(int size, ext2_f > return j_blocks; > } > >- if (fs->super->s_blocks_count < 32768) >+ if (EXT2_BLOCKS_COUNT(fs->super) < 32768) > j_blocks = 1024; >- else if (fs->super->s_blocks_count < 256*1024) >+ else if (EXT2_BLOCKS_COUNT(fs->super) < 256*1024) > j_blocks = 4096; >- else if (fs->super->s_blocks_count < 512*1024) >+ else if (EXT2_BLOCKS_COUNT(fs->super) < 512*1024) > j_blocks = 8192; >- else if (fs->super->s_blocks_count < 1024*1024) >+ else if (EXT2_BLOCKS_COUNT(fs->super) < 1024*1024) > j_blocks = 16384; > else > j_blocks = 32768; >Index: e2fsprogs-1.39/resize/main.c >=================================================================== >--- e2fsprogs-1.39.orig/resize/main.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/resize/main.c 2006-09-25 12:56:22.000000000 +0200 >@@ -106,11 +106,11 @@ static void determine_fs_stride(ext2_fil > has_sb = ext2fs_bg_has_super(fs, group); > if (group == 0 || has_sb != prev_has_sb) > goto next; >- b_stride = fs->group_desc[group].bg_block_bitmap - >- fs->group_desc[group-1].bg_block_bitmap - >+ b_stride = EXT2_BLOCK_BITMAP(&fs->group_desc[group]) - >+ EXT2_BLOCK_BITMAP(&fs->group_desc[group-1]) - > fs->super->s_blocks_per_group; >- i_stride = fs->group_desc[group].bg_inode_bitmap - >- fs->group_desc[group-1].bg_inode_bitmap - >+ i_stride = EXT2_INODE_BITMAP(&fs->group_desc[group]) - >+ EXT2_INODE_BITMAP(&fs->group_desc[group-1]) - > fs->super->s_blocks_per_group; > if (b_stride != i_stride || > b_stride < 0) >@@ -369,13 +369,13 @@ int main (int argc, char ** argv) > } > if (!force && (new_size > max_size)) { > fprintf(stderr, _("The containing partition (or device)" >- " is only %u (%dk) blocks.\nYou requested a new size" >- " of %u blocks.\n\n"), max_size, >+ " is only %llu (%dk) blocks.\nYou requested a new size" >+ " of %llu blocks.\n\n"), max_size, > fs->blocksize / 1024, new_size); > exit(1); > } >- if (new_size == fs->super->s_blocks_count) { >- fprintf(stderr, _("The filesystem is already %u blocks " >+ if (new_size == EXT2_BLOCKS_COUNT(fs->super)) { >+ fprintf(stderr, _("The filesystem is already %llu blocks " > "long. Nothing to do!\n\n"), new_size); > exit(0); > } >@@ -390,7 +390,7 @@ int main (int argc, char ** argv) > device_name); > exit(1); > } >- printf("Resizing the filesystem on %s to %u (%dk) blocks.\n", >+ printf("Resizing the filesystem on %s to %llu (%dk) blocks.\n", > device_name, new_size, fs->blocksize / 1024); > retval = resize_fs(fs, &new_size, flags, > ((flags & RESIZE_PERCENT_COMPLETE) ? >@@ -402,7 +402,7 @@ int main (int argc, char ** argv) > ext2fs_close (fs); > exit(1); > } >- printf(_("The filesystem on %s is now %u blocks long.\n\n"), >+ printf(_("The filesystem on %s is now %llu blocks long.\n\n"), > device_name, new_size); > > if ((st_buf.st_size > new_file_size) && >Index: e2fsprogs-1.39/resize/online.c >=================================================================== >--- e2fsprogs-1.39.orig/resize/online.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/resize/online.c 2006-09-25 12:56:22.000000000 +0200 >@@ -10,6 +10,7 @@ > */ > > #include "resize2fs.h" >+#include "e2p/e2p.h" > #ifdef HAVE_SYS_IOCTL_H > #include <sys/ioctl.h> > #endif >@@ -32,9 +33,9 @@ errcode_t online_resize_fs(ext2_filsys f > printf(_("Filesystem at %s is mounted on %s; " > "on-line resizing required\n"), fs->device_name, mtpt); > >- if (*new_size < sb->s_blocks_count) { >- printf(_("On-line shrinking from %u to %u not supported.\n"), >- sb->s_blocks_count, *new_size); >+ if (*new_size < EXT2_BLOCKS_COUNT(sb)) { >+ printf(_("On-line shrinking from %llu to %llu not supported.\n"), >+ EXT2_BLOCKS_COUNT(sb), *new_size); > exit(1); > } > >@@ -45,7 +46,7 @@ errcode_t online_resize_fs(ext2_filsys f > exit(1); > } > >- size=sb->s_blocks_count; >+ size=EXT2_BLOCKS_COUNT(sb); > if (ioctl(fd, EXT2_IOC_GROUP_EXTEND, &size)) { > if (errno == EPERM) > com_err(program_name, 0, >@@ -59,7 +60,8 @@ errcode_t online_resize_fs(ext2_filsys f > exit(1); > } > >- r_frac = ext2fs_div_ceil(100 * sb->s_r_blocks_count, sb->s_blocks_count); >+ r_frac = ext2fs_div_ceil(100 * EXT2_R_BLOCKS_COUNT(sb), >+ EXT2_BLOCKS_COUNT(sb)); > > retval = ext2fs_read_bitmaps(fs); > if (retval) >@@ -73,7 +75,7 @@ errcode_t online_resize_fs(ext2_filsys f > if (retval) > return retval; > >- printf(_("Performing an on-line resize of %s to %u (%dk) blocks.\n"), >+ printf(_("Performing an on-line resize of %s to %llu (%dk) blocks.\n"), > fs->device_name, *new_size, fs->blocksize / 1024); > > size = fs->group_desc_count * sb->s_blocks_per_group + >@@ -89,7 +91,6 @@ errcode_t online_resize_fs(ext2_filsys f > > for (i = fs->group_desc_count; > i < new_fs->group_desc_count; i++) { >- > overhead = (int) (2 + new_fs->inode_blocks_per_group); > > if (ext2fs_bg_has_super(new_fs, new_fs->group_desc_count - 1)) >@@ -97,12 +98,12 @@ errcode_t online_resize_fs(ext2_filsys f > new_fs->super->s_reserved_gdt_blocks; > > input.group = i; >- input.block_bitmap = new_fs->group_desc[i].bg_block_bitmap; >- input.inode_bitmap = new_fs->group_desc[i].bg_inode_bitmap; >- input.inode_table = new_fs->group_desc[i].bg_inode_table; >+ input.block_bitmap = EXT2_BLOCK_BITMAP(&new_fs->group_desc[i]); >+ input.inode_bitmap = EXT2_INODE_BITMAP(&new_fs->group_desc[i]); >+ input.inode_table = EXT2_INODE_TABLE(&new_fs->group_desc[i]); > input.blocks_count = sb->s_blocks_per_group; > if (i == new_fs->group_desc_count-1) { >- input.blocks_count = new_fs->super->s_blocks_count - >+ input.blocks_count = EXT2_BLOCKS_COUNT(new_fs->super) - > sb->s_first_data_block - > (i * sb->s_blocks_per_group); > } >Index: e2fsprogs-1.39/resize/resize2fs.c >=================================================================== >--- e2fsprogs-1.39.orig/resize/resize2fs.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/resize/resize2fs.c 2006-09-25 12:56:22.000000000 +0200 >@@ -34,6 +34,7 @@ > */ > > #include "resize2fs.h" >+#include "e2p/e2p.h" > #include <time.h> > > #ifdef __linux__ /* Kludge for debugging */ >@@ -100,7 +101,7 @@ errcode_t resize_fs(ext2_filsys fs, blk_ > if (retval) > goto errout; > >- *new_size = rfs->new_fs->super->s_blocks_count; >+ *new_size = EXT2_BLOCKS_COUNT(rfs->new_fs->super); > > retval = blocks_to_move(rfs); > if (retval) >@@ -108,9 +109,9 @@ errcode_t resize_fs(ext2_filsys fs, blk_ > > #ifdef RESIZE2FS_DEBUG > if (rfs->flags & RESIZE_DEBUG_BMOVE) >- printf("Number of free blocks: %u/%u, Needed: %d\n", >- rfs->old_fs->super->s_free_blocks_count, >- rfs->new_fs->super->s_free_blocks_count, >+ printf("Number of free blocks: %llu/%llu, Needed: %d\n", >+ EXT2_FREE_BLOCKS_COUNT(rfs->old_fs->super), >+ EXT2_FREE_BLOCKS_COUNT(rfs->new_fs->super), > rfs->needed_blocks); > #endif > >@@ -188,10 +189,10 @@ errcode_t adjust_fs_info(ext2_filsys fs, > int has_super; > __u64 new_inodes; /* u64 to check for overflow */ > >- fs->super->s_blocks_count = new_size; >+ EXT2_BLOCKS_COUNT_SET(fs->super, new_size); > > retry: >- fs->group_desc_count = ext2fs_div_ceil(fs->super->s_blocks_count - >+ fs->group_desc_count = ext2fs_div_ceil(EXT2_BLOCKS_COUNT(fs->super) - > fs->super->s_first_data_block, > EXT2_BLOCKS_PER_GROUP(fs->super)); > if (fs->group_desc_count == 0) >@@ -216,12 +217,12 @@ retry: > * necessary data structures. If not, we need to get rid of > * it. > */ >- rem = (fs->super->s_blocks_count - fs->super->s_first_data_block) % >+ rem = (EXT2_BLOCKS_COUNT(fs->super) - fs->super->s_first_data_block) % > fs->super->s_blocks_per_group; > if ((fs->group_desc_count == 1) && rem && (rem < overhead)) > return EXT2_ET_TOOSMALL; > if (rem && (rem < overhead+50)) { >- fs->super->s_blocks_count -= rem; >+ EXT2_BLOCKS_COUNT_SET(fs->super, EXT2_BLOCKS_COUNT(fs->super) - rem); > goto retry; > } > /* >@@ -239,21 +240,21 @@ retry: > /* > * Adjust the number of free blocks > */ >- blk = old_fs->super->s_blocks_count; >- if (blk > fs->super->s_blocks_count) >- fs->super->s_free_blocks_count -= >- (blk - fs->super->s_blocks_count); >+ blk = EXT2_BLOCKS_COUNT(old_fs->super); >+ if (blk > EXT2_BLOCKS_COUNT(fs->super)) >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, EXT2_FREE_BLOCKS_COUNT(fs->super) - >+ (blk - EXT2_BLOCKS_COUNT(fs->super))); > else >- fs->super->s_free_blocks_count += >- (fs->super->s_blocks_count - blk); >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, EXT2_FREE_BLOCKS_COUNT(fs->super) + >+ (EXT2_BLOCKS_COUNT(fs->super) - blk)); > > /* > * Adjust the number of reserved blocks > */ >- blk = (__u64)old_fs->super->s_r_blocks_count * 100 / >- old_fs->super->s_blocks_count; >- fs->super->s_r_blocks_count = e2p_percent(blk, >- fs->super->s_blocks_count); >+ blk = EXT2_R_BLOCKS_COUNT(old_fs->super) * 100 / >+ EXT2_BLOCKS_COUNT(old_fs->super); >+ EXT2_R_BLOCKS_COUNT_SET( >+ fs->super, e2p_percent(blk, EXT2_BLOCKS_COUNT(fs->super))); > > /* > * Adjust the bitmaps for size >@@ -266,7 +267,7 @@ retry: > real_end = ((EXT2_BLOCKS_PER_GROUP(fs->super) > * fs->group_desc_count)) - 1 + > fs->super->s_first_data_block; >- retval = ext2fs_resize_block_bitmap(fs->super->s_blocks_count-1, >+ retval = ext2fs_resize_block_bitmap(EXT2_BLOCKS_COUNT(fs->super)-1, > real_end, fs->block_map); > > if (retval) goto errout; >@@ -323,13 +324,13 @@ retry: > /* > * Fix the count of the last (old) block group > */ >- old_numblocks = (old_fs->super->s_blocks_count - >+ old_numblocks = (EXT2_BLOCKS_COUNT(old_fs->super) - > old_fs->super->s_first_data_block) % > old_fs->super->s_blocks_per_group; > if (!old_numblocks) > old_numblocks = old_fs->super->s_blocks_per_group; > if (old_fs->group_desc_count == fs->group_desc_count) { >- numblocks = (fs->super->s_blocks_count - >+ numblocks = (EXT2_BLOCKS_COUNT(fs->super) - > fs->super->s_first_data_block) % > fs->super->s_blocks_per_group; > if (!numblocks) >@@ -369,7 +370,7 @@ retry: > adjblocks = 0; > > if (i == fs->group_desc_count-1) { >- numblocks = (fs->super->s_blocks_count - >+ numblocks = (EXT2_BLOCKS_COUNT(fs->super) - > fs->super->s_first_data_block) % > fs->super->s_blocks_per_group; > if (!numblocks) >@@ -407,7 +408,7 @@ retry: > adjblocks += 2 + fs->inode_blocks_per_group; > > numblocks -= adjblocks; >- fs->super->s_free_blocks_count -= adjblocks; >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, EXT2_FREE_BLOCKS_COUNT(fs->super) - adjblocks); > fs->super->s_free_inodes_count += > fs->super->s_inodes_per_group; > fs->group_desc[i].bg_free_blocks_count = numblocks; >@@ -503,7 +504,7 @@ static errcode_t adjust_superblock(ext2_ > * Write out the new inode table > */ > retval = io_channel_write_blk(fs->io, >- fs->group_desc[i].bg_inode_table, >+ EXT2_INODE_TABLE(&fs->group_desc[i]), > fs->inode_blocks_per_group, > rfs->itable_buf); > if (retval) goto errout; >@@ -561,7 +562,7 @@ static errcode_t mark_table_blocks(ext2_ > /* > * Mark the blocks used for the inode table > */ >- for (j = 0, b = fs->group_desc[i].bg_inode_table; >+ for (j = 0, b = EXT2_INODE_TABLE(&fs->group_desc[i]); > j < (unsigned int) fs->inode_blocks_per_group; > j++, b++) > ext2fs_mark_block_bitmap(bmap, b); >@@ -570,13 +571,13 @@ static errcode_t mark_table_blocks(ext2_ > * Mark block used for the block bitmap > */ > ext2fs_mark_block_bitmap(bmap, >- fs->group_desc[i].bg_block_bitmap); >+ EXT2_BLOCK_BITMAP(&fs->group_desc[i])); > > /* > * Mark block used for the inode bitmap > */ > ext2fs_mark_block_bitmap(bmap, >- fs->group_desc[i].bg_inode_bitmap); >+ EXT2_INODE_BITMAP(&fs->group_desc[i])); > } > return 0; > } >@@ -635,7 +636,7 @@ static errcode_t blocks_to_move(ext2_res > > fs = rfs->new_fs; > old_fs = rfs->old_fs; >- if (old_fs->super->s_blocks_count > fs->super->s_blocks_count) >+ if (EXT2_BLOCKS_COUNT(old_fs->super) > EXT2_BLOCKS_COUNT(fs->super)) > fs = rfs->old_fs; > > retval = ext2fs_allocate_block_bitmap(fs, _("reserved blocks"), >@@ -663,8 +664,8 @@ static errcode_t blocks_to_move(ext2_res > * If we're shrinking the filesystem, we need to move all of > * the blocks that don't fit any more > */ >- for (blk = fs->super->s_blocks_count; >- blk < old_fs->super->s_blocks_count; blk++) { >+ for (blk = EXT2_BLOCKS_COUNT(fs->super); >+ blk < EXT2_BLOCKS_COUNT(old_fs->super); blk++) { > if (ext2fs_test_block_bitmap(old_fs->block_map, blk) && > !ext2fs_test_block_bitmap(meta_bmap, blk)) { > ext2fs_mark_block_bitmap(rfs->move_blocks, blk); >@@ -742,23 +743,23 @@ static errcode_t blocks_to_move(ext2_res > group_blk + has_super); > } > >- if (fs->group_desc[i].bg_inode_table && >- fs->group_desc[i].bg_inode_bitmap && >- fs->group_desc[i].bg_block_bitmap) >+ if (EXT2_IS_USED_INODE_TABLE(&fs->group_desc[i]) && >+ EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[i]) && >+ EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[i])) > goto next_group; > > /* > * Reserve the existing meta blocks that we know > * aren't to be moved. > */ >- if (fs->group_desc[i].bg_block_bitmap) >+ if (EXT2_IS_USED_BLOCK_BITMAP(&fs->group_desc[i])) > ext2fs_mark_block_bitmap(rfs->reserve_blocks, >- fs->group_desc[i].bg_block_bitmap); >- if (fs->group_desc[i].bg_inode_bitmap) >+ EXT2_BLOCK_BITMAP(&fs->group_desc[i])); >+ if (EXT2_IS_USED_INODE_BITMAP(&fs->group_desc[i])) > ext2fs_mark_block_bitmap(rfs->reserve_blocks, >- fs->group_desc[i].bg_inode_bitmap); >- if (fs->group_desc[i].bg_inode_table) >- for (blk = fs->group_desc[i].bg_inode_table, j=0; >+ EXT2_INODE_BITMAP(&fs->group_desc[i])); >+ if (EXT2_IS_USED_INODE_TABLE(&fs->group_desc[i])) >+ for (blk = EXT2_INODE_TABLE(&fs->group_desc[i]), j=0; > j < fs->inode_blocks_per_group ; j++, blk++) > ext2fs_mark_block_bitmap(rfs->reserve_blocks, > blk); >@@ -809,7 +810,7 @@ static errcode_t blocks_to_move(ext2_res > * allocation bitmap, and move any blocks that might > * be necessary. > */ >- for (blk = fs->group_desc[i].bg_inode_table, j=0; >+ for (blk = EXT2_INODE_TABLE(&fs->group_desc[i]), j=0; > j < fs->inode_blocks_per_group ; j++, blk++) { > ext2fs_mark_block_bitmap(fs->block_map, blk); > if (ext2fs_test_block_bitmap(old_fs->block_map, blk) && >@@ -822,7 +823,7 @@ static errcode_t blocks_to_move(ext2_res > * Make sure the old inode table is reserved in the > * block reservation bitmap. > */ >- for (blk = rfs->old_fs->group_desc[i].bg_inode_table, j=0; >+ for (blk = EXT2_INODE_TABLE(&rfs->old_fs->group_desc[i]), j=0; > j < fs->inode_blocks_per_group ; j++, blk++) > ext2fs_mark_block_bitmap(rfs->reserve_blocks, blk); > >@@ -861,9 +862,9 @@ static void init_block_alloc(ext2_resize > rfs->new_blk = rfs->new_fs->super->s_first_data_block; > #if 0 > /* HACK for testing */ >- if (rfs->new_fs->super->s_blocks_count > >- rfs->old_fs->super->s_blocks_count) >- rfs->new_blk = rfs->old_fs->super->s_blocks_count; >+ if (EXT2_BLOCKS_COUNT(rfs->new_fs->super) > >+ EXT2_BLOCKS_COUNT(rfs->old_fs->super)) >+ rfs->new_blk = EXT2_BLOCKS_COUNT(rfs->old_fs->super); > #endif > } > >@@ -872,7 +873,7 @@ static blk_t get_new_block(ext2_resize_t > ext2_filsys fs = rfs->new_fs; > > while (1) { >- if (rfs->new_blk >= fs->super->s_blocks_count) { >+ if (rfs->new_blk >= EXT2_BLOCKS_COUNT(fs->super)) { > if (rfs->alloc_state == DESPERATION) > return 0; > >@@ -889,7 +890,7 @@ static blk_t get_new_block(ext2_resize_t > ext2fs_test_block_bitmap(rfs->reserve_blocks, > rfs->new_blk) || > ((rfs->alloc_state == AVOID_OLD) && >- (rfs->new_blk < rfs->old_fs->super->s_blocks_count) && >+ (rfs->new_blk < EXT2_BLOCKS_COUNT(rfs->old_fs->super)) && > ext2fs_test_block_bitmap(rfs->old_fs->block_map, > rfs->new_blk))) { > rfs->new_blk++; >@@ -934,7 +935,7 @@ static errcode_t block_mover(ext2_resize > to_move = moved = 0; > init_block_alloc(rfs); > for (blk = old_fs->super->s_first_data_block; >- blk < old_fs->super->s_blocks_count; blk++) { >+ blk < EXT2_BLOCKS_COUNT(old_fs->super); blk++) { > if (!ext2fs_test_block_bitmap(old_fs->block_map, blk)) > continue; > if (!ext2fs_test_block_bitmap(rfs->move_blocks, blk)) >@@ -1060,7 +1061,7 @@ static int process_block(ext2_filsys fs, > pb->changed = 1; > #ifdef RESIZE2FS_DEBUG > if (pb->rfs->flags & RESIZE_DEBUG_BMOVE) >- printf("ino=%u, blockcnt=%lld, %u->%u\n", >+ printf("ino=%u, blockcnt=%lld, %llu->%llu\n", > pb->ino, blockcnt, block, new_block); > #endif > block = new_block; >@@ -1128,10 +1129,10 @@ static errcode_t inode_scan_and_fix(ext2 > * is larger. We need to do this to avoid catching an error > * by the block iterator routines > */ >- orig_size = rfs->old_fs->super->s_blocks_count; >- if (orig_size < rfs->new_fs->super->s_blocks_count) >- rfs->old_fs->super->s_blocks_count = >- rfs->new_fs->super->s_blocks_count; >+ orig_size = EXT2_BLOCKS_COUNT(rfs->old_fs->super); >+ if (orig_size < EXT2_BLOCKS_COUNT(rfs->new_fs->super)) >+ EXT2_BLOCKS_COUNT_SET(rfs->old_fs->super, >+ EXT2_BLOCKS_COUNT(rfs->new_fs->super)); > > retval = ext2fs_open_inode_scan(rfs->old_fs, 0, &scan); > if (retval) goto errout; >@@ -1240,7 +1241,7 @@ static errcode_t inode_scan_and_fix(ext2 > io_channel_flush(rfs->old_fs->io); > > errout: >- rfs->old_fs->super->s_blocks_count = orig_size; >+ EXT2_BLOCKS_COUNT_SET(rfs->old_fs->super, orig_size); > if (rfs->bmap) { > ext2fs_free_extent_table(rfs->bmap); > rfs->bmap = 0; >@@ -1399,10 +1400,11 @@ static errcode_t move_itables(ext2_resiz > * Figure out how many inode tables we need to move > */ > to_move = moved = 0; >- for (i=0; i < max_groups; i++) >- if (rfs->old_fs->group_desc[i].bg_inode_table != >- fs->group_desc[i].bg_inode_table) >+ for (i=0; i < max_groups; i++) { >+ if (EXT2_INODE_TABLE(&rfs->old_fs->group_desc[i]) != >+ EXT2_INODE_TABLE(&fs->group_desc[i])) > to_move++; >+ } > > if (to_move == 0) > return 0; >@@ -1417,13 +1419,13 @@ static errcode_t move_itables(ext2_resiz > rfs->old_fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; > > for (i=0; i < max_groups; i++) { >- old_blk = rfs->old_fs->group_desc[i].bg_inode_table; >- new_blk = fs->group_desc[i].bg_inode_table; >+ old_blk = EXT2_INODE_TABLE(&rfs->old_fs->group_desc[i]); >+ new_blk = EXT2_INODE_TABLE(&fs->group_desc[i]); > diff = new_blk - old_blk; > > #ifdef RESIZE2FS_DEBUG > if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE) >- printf("Itable move group %d block %u->%u (diff %d)\n", >+ printf("Itable move group %d block %llu->%llu (diff %d)\n", > i, old_blk, new_blk, diff); > #endif > >@@ -1471,11 +1473,11 @@ static errcode_t move_itables(ext2_resiz > goto errout; > } > >- for (blk = rfs->old_fs->group_desc[i].bg_inode_table, j=0; >+ for (blk = EXT2_INODE_TABLE(&rfs->old_fs->group_desc[i]), j=0; > j < fs->inode_blocks_per_group ; j++, blk++) > ext2fs_unmark_block_bitmap(fs->block_map, blk); > >- rfs->old_fs->group_desc[i].bg_inode_table = new_blk; >+ EXT2_INODE_TABLE_SET(&rfs->old_fs->group_desc[i], new_blk); > ext2fs_mark_super_dirty(rfs->old_fs); > ext2fs_flush(rfs->old_fs); > >@@ -1556,30 +1558,30 @@ static errcode_t ext2fs_calculate_summar > { > blk_t blk; > ext2_ino_t ino; >- unsigned int group = 0; >- unsigned int count = 0; >- int total_free = 0; >- int group_free = 0; >+ blk_t count = 0; >+ dgrp_t group; >+ blk_t total_free = 0; >+ blk_t group_free = 0; > > /* > * First calculate the block statistics > */ > for (blk = fs->super->s_first_data_block; >- blk < fs->super->s_blocks_count; blk++) { >+ blk < EXT2_BLOCKS_COUNT(fs->super); blk++) { > if (!ext2fs_fast_test_block_bitmap(fs->block_map, blk)) { > group_free++; > total_free++; > } > count++; > if ((count == fs->super->s_blocks_per_group) || >- (blk == fs->super->s_blocks_count-1)) { >+ (blk == EXT2_BLOCKS_COUNT(fs->super)-1)) { > fs->group_desc[group++].bg_free_blocks_count = > group_free; > count = 0; > group_free = 0; > } > } >- fs->super->s_free_blocks_count = total_free; >+ EXT2_FREE_BLOCKS_COUNT_SET(fs->super, total_free); > > /* > * Next, calculate the inode statistics >Index: e2fsprogs-1.39/tests/progs/test_icount.c >=================================================================== >--- e2fsprogs-1.39.orig/tests/progs/test_icount.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/tests/progs/test_icount.c 2006-09-25 12:56:22.000000000 +0200 >@@ -307,7 +307,7 @@ int main(int argc, char **argv) > * Create a sample filesystem structure > */ > memset(¶m, 0, sizeof(struct ext2_super_block)); >- param.s_blocks_count = 80000; >+ EXT2_BLOCKS_COUNT_SET(¶m, 80000ULL); > param.s_inodes_count = 20000; > retval = ext2fs_initialize("/dev/null", 0, ¶m, > unix_io_manager, &test_fs); >Index: e2fsprogs-1.39/lib/e2p/percent.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/e2p/percent.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/e2p/percent.c 2006-09-25 12:56:22.000000000 +0200 >@@ -19,7 +19,7 @@ > * > * -- "Yes there is, as in hair-splitting and nit-picking" > */ >-unsigned int e2p_percent(int percent, unsigned int base) >+unsigned long long e2p_percent(int percent, unsigned long long base) > { > unsigned hi, lo, q, r; > >Index: e2fsprogs-1.39/lib/e2p/e2p.h >=================================================================== >--- e2fsprogs-1.39.orig/lib/e2p/e2p.h 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/e2p/e2p.h 2006-09-25 12:56:22.000000000 +0200 >@@ -51,4 +51,4 @@ unsigned long long parse_num_blocks(cons > char *e2p_os2string(int os_type); > int e2p_string2os(char *str); > >-unsigned int e2p_percent(int percent, unsigned int base); >+unsigned long long e2p_percent(int percent, unsigned long long base); >Index: e2fsprogs-1.39/lib/ext2fs/gen_bitmap.c >=================================================================== >--- e2fsprogs-1.39.orig/lib/ext2fs/gen_bitmap.c 2006-09-25 12:56:18.000000000 +0200 >+++ e2fsprogs-1.39/lib/ext2fs/gen_bitmap.c 2006-09-25 12:56:22.000000000 +0200 >@@ -37,8 +37,7 @@ int ext2fs_mark_generic_bitmap(ext2fs_ge > return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap); > } > >-int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, >- blk_t bitno) >+int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno) > { > if ((bitno < bitmap->start) || (bitno > bitmap->end)) { > ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 156697
:
103083
|
103084
|
103085
|
103087
|
103088
|
103089
|
103090
|
103091
|
103092
|
103093
|
103094
|
103095
|
103096
|
103859