Contents of /trunk/grub/patches/grub-0.97-inode-size.patch
Parent Directory | Revision Log
Revision 1054 -
(show annotations)
(download)
Fri Jun 25 10:58:40 2010 UTC (14 years, 3 months ago) by niro
File size: 4814 byte(s)
Fri Jun 25 10:58:40 2010 UTC (14 years, 3 months ago) by niro
File size: 4814 byte(s)
added dynamic inodes patch
1 | diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c |
2 | --- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600 |
3 | +++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600 |
4 | @@ -79,7 +79,52 @@ |
5 | __u32 s_rev_level; /* Revision level */ |
6 | __u16 s_def_resuid; /* Default uid for reserved blocks */ |
7 | __u16 s_def_resgid; /* Default gid for reserved blocks */ |
8 | - __u32 s_reserved[235]; /* Padding to the end of the block */ |
9 | + /* |
10 | + * These fields are for EXT2_DYNAMIC_REV superblocks only. |
11 | + * |
12 | + * Note: the difference between the compatible feature set and |
13 | + * the incompatible feature set is that if there is a bit set |
14 | + * in the incompatible feature set that the kernel doesn't |
15 | + * know about, it should refuse to mount the filesystem. |
16 | + * |
17 | + * e2fsck's requirements are more strict; if it doesn't know |
18 | + * about a feature in either the compatible or incompatible |
19 | + * feature set, it must abort and not try to meddle with |
20 | + * things it doesn't understand... |
21 | + */ |
22 | + __u32 s_first_ino; /* First non-reserved inode */ |
23 | + __u16 s_inode_size; /* size of inode structure */ |
24 | + __u16 s_block_group_nr; /* block group # of this superblock */ |
25 | + __u32 s_feature_compat; /* compatible feature set */ |
26 | + __u32 s_feature_incompat; /* incompatible feature set */ |
27 | + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ |
28 | + __u8 s_uuid[16]; /* 128-bit uuid for volume */ |
29 | + char s_volume_name[16]; /* volume name */ |
30 | + char s_last_mounted[64]; /* directory where last mounted */ |
31 | + __u32 s_algorithm_usage_bitmap; /* For compression */ |
32 | + /* |
33 | + * Performance hints. Directory preallocation should only |
34 | + * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. |
35 | + */ |
36 | + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ |
37 | + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ |
38 | + __u16 s_reserved_gdt_blocks;/* Per group table for online growth */ |
39 | + /* |
40 | + * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. |
41 | + */ |
42 | + __u8 s_journal_uuid[16]; /* uuid of journal superblock */ |
43 | + __u32 s_journal_inum; /* inode number of journal file */ |
44 | + __u32 s_journal_dev; /* device number of journal file */ |
45 | + __u32 s_last_orphan; /* start of list of inodes to delete */ |
46 | + __u32 s_hash_seed[4]; /* HTREE hash seed */ |
47 | + __u8 s_def_hash_version; /* Default hash version to use */ |
48 | + __u8 s_jnl_backup_type; /* Default type of journal backup */ |
49 | + __u16 s_reserved_word_pad; |
50 | + __u32 s_default_mount_opts; |
51 | + __u32 s_first_meta_bg; /* First metablock group */ |
52 | + __u32 s_mkfs_time; /* When the filesystem was created */ |
53 | + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ |
54 | + __u32 s_reserved[172]; /* Padding to the end of the block */ |
55 | }; |
56 | |
57 | struct ext2_group_desc |
58 | @@ -218,6 +263,14 @@ |
59 | #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) |
60 | #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s))) |
61 | |
62 | +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ |
63 | +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ |
64 | +#define EXT2_GOOD_OLD_INODE_SIZE 128 |
65 | +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ |
66 | + EXT2_GOOD_OLD_INODE_SIZE : \ |
67 | + (s)->s_inode_size) |
68 | +#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) |
69 | + |
70 | /* linux/ext2_fs.h */ |
71 | #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) |
72 | /* kind of from ext2/super.c */ |
73 | @@ -553,7 +606,7 @@ |
74 | gdp = GROUP_DESC; |
75 | ino_blk = gdp[desc].bg_inode_table + |
76 | (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group)) |
77 | - >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode))); |
78 | + >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); |
79 | #ifdef E2DEBUG |
80 | printf ("inode table fsblock=%d\n", ino_blk); |
81 | #endif /* E2DEBUG */ |
82 | @@ -565,13 +618,12 @@ |
83 | /* reset indirect blocks! */ |
84 | mapblock2 = mapblock1 = -1; |
85 | |
86 | - raw_inode = INODE + |
87 | - ((current_ino - 1) |
88 | - & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1)); |
89 | + raw_inode = (struct ext2_inode *)((char *)INODE + |
90 | + ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * |
91 | + EXT2_INODE_SIZE (SUPERBLOCK)); |
92 | #ifdef E2DEBUG |
93 | printf ("ipb=%d, sizeof(inode)=%d\n", |
94 | - (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)), |
95 | - sizeof (struct ext2_inode)); |
96 | + EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); |
97 | printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode); |
98 | printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE); |
99 | for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode; |
100 |