wok rev 2599
grub: fix 256 bytes/inodes ext3
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Apr 10 15:54:35 2009 +0000 (2009-04-10) |
parents | e444419779c9 |
children | c40855c3b892 |
files | grub/receipt grub/stuff/ext3_256byte_inode.diff grub/stuff/xfs_freeze.diff |
line diff
1.1 --- a/grub/receipt Fri Apr 10 15:01:11 2009 +0000 1.2 +++ b/grub/receipt Fri Apr 10 15:54:35 2009 +0000 1.3 @@ -15,6 +15,11 @@ 1.4 compile_rules() 1.5 { 1.6 cd $src 1.7 + for i in ../stuff/*.diff ; do 1.8 + [ -f $(basename $i) ] && continue 1.9 + patch -p1 < $i 1.10 + touch $(basename $i) 1.11 + done 1.12 ./configure --prefix=/usr --infodir=/usr/share/info \ 1.13 --mandir=/usr/share/man $CONFIGURE_ARGS && 1.14 make &&
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/grub/stuff/ext3_256byte_inode.diff Fri Apr 10 15:54:35 2009 +0000 2.3 @@ -0,0 +1,102 @@ 2.4 + 2.5 +Patch from Red Hat. See #463236, #463123 (and #491076 for the reviewed version) 2.6 + 2.7 +diff -ur grub-0.97/stage2/fsys_ext2fs.c grub-0.97.new/stage2/fsys_ext2fs.c 2.8 +--- grub-0.97/stage2/fsys_ext2fs.c 2008-07-23 01:18:18.000000000 +0200 2.9 ++++ grub-0.97.new/stage2/fsys_ext2fs.c 2008-07-25 14:33:29.000000000 +0200 2.10 +@@ -79,7 +79,52 @@ 2.11 + __u32 s_rev_level; /* Revision level */ 2.12 + __u16 s_def_resuid; /* Default uid for reserved blocks */ 2.13 + __u16 s_def_resgid; /* Default gid for reserved blocks */ 2.14 +- __u32 s_reserved[235]; /* Padding to the end of the block */ 2.15 ++ /* 2.16 ++ * These fields are for EXT2_DYNAMIC_REV superblocks only. 2.17 ++ * 2.18 ++ * Note: the difference between the compatible feature set and 2.19 ++ * the incompatible feature set is that if there is a bit set 2.20 ++ * in the incompatible feature set that the kernel doesn't 2.21 ++ * know about, it should refuse to mount the filesystem. 2.22 ++ * 2.23 ++ * e2fsck's requirements are more strict; if it doesn't know 2.24 ++ * about a feature in either the compatible or incompatible 2.25 ++ * feature set, it must abort and not try to meddle with 2.26 ++ * things it doesn't understand... 2.27 ++ */ 2.28 ++ __u32 s_first_ino; /* First non-reserved inode */ 2.29 ++ __u16 s_inode_size; /* size of inode structure */ 2.30 ++ __u16 s_block_group_nr; /* block group # of this superblock */ 2.31 ++ __u32 s_feature_compat; /* compatible feature set */ 2.32 ++ __u32 s_feature_incompat; /* incompatible feature set */ 2.33 ++ __u32 s_feature_ro_compat; /* readonly-compatible feature set */ 2.34 ++ __u8 s_uuid[16]; /* 128-bit uuid for volume */ 2.35 ++ char s_volume_name[16]; /* volume name */ 2.36 ++ char s_last_mounted[64]; /* directory where last mounted */ 2.37 ++ __u32 s_algorithm_usage_bitmap; /* For compression */ 2.38 ++ /* 2.39 ++ * Performance hints. Directory preallocation should only 2.40 ++ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. 2.41 ++ */ 2.42 ++ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 2.43 ++ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 2.44 ++ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */ 2.45 ++ /* 2.46 ++ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. 2.47 ++ */ 2.48 ++ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ 2.49 ++ __u32 s_journal_inum; /* inode number of journal file */ 2.50 ++ __u32 s_journal_dev; /* device number of journal file */ 2.51 ++ __u32 s_last_orphan; /* start of list of inodes to delete */ 2.52 ++ __u32 s_hash_seed[4]; /* HTREE hash seed */ 2.53 ++ __u8 s_def_hash_version; /* Default hash version to use */ 2.54 ++ __u8 s_jnl_backup_type; /* Default type of journal backup */ 2.55 ++ __u16 s_reserved_word_pad; 2.56 ++ __u32 s_default_mount_opts; 2.57 ++ __u32 s_first_meta_bg; /* First metablock group */ 2.58 ++ __u32 s_mkfs_time; /* When the filesystem was created */ 2.59 ++ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ 2.60 ++ __u32 s_reserved[172]; /* Padding to the end of the block */ 2.61 + }; 2.62 + 2.63 + struct ext2_group_desc 2.64 +@@ -218,6 +263,14 @@ 2.65 + #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) 2.66 + #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s))) 2.67 + 2.68 ++#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ 2.69 ++#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ 2.70 ++#define EXT2_GOOD_OLD_INODE_SIZE 128 2.71 ++#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ 2.72 ++ EXT2_GOOD_OLD_INODE_SIZE : \ 2.73 ++ (s)->s_inode_size) 2.74 ++#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) 2.75 ++ 2.76 + /* linux/ext2_fs.h */ 2.77 + #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) 2.78 + /* kind of from ext2/super.c */ 2.79 +@@ -553,7 +606,7 @@ 2.80 + gdp = GROUP_DESC; 2.81 + ino_blk = gdp[desc].bg_inode_table + 2.82 + (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group)) 2.83 +- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode))); 2.84 ++ >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); 2.85 + #ifdef E2DEBUG 2.86 + printf ("inode table fsblock=%d\n", ino_blk); 2.87 + #endif /* E2DEBUG */ 2.88 +@@ -565,13 +618,12 @@ 2.89 + /* reset indirect blocks! */ 2.90 + mapblock2 = mapblock1 = -1; 2.91 + 2.92 +- raw_inode = INODE + 2.93 +- ((current_ino - 1) 2.94 +- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1)); 2.95 ++ raw_inode = (struct ext2_inode *)((char *)INODE + 2.96 ++ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * 2.97 ++ EXT2_INODE_SIZE (SUPERBLOCK)); 2.98 + #ifdef E2DEBUG 2.99 + printf ("ipb=%d, sizeof(inode)=%d\n", 2.100 +- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)), 2.101 +- sizeof (struct ext2_inode)); 2.102 ++ EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); 2.103 + printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode); 2.104 + printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE); 2.105 + for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/grub/stuff/xfs_freeze.diff Fri Apr 10 15:54:35 2009 +0000 3.3 @@ -0,0 +1,21 @@ 3.4 +diff -ur grub-0.97.old/util/grub-install.in grub-0.97/util/grub-install.in 3.5 +--- grub-0.97.old/util/grub-install.in 2004-07-24 20:57:31.000000000 +0200 3.6 ++++ grub-0.97/util/grub-install.in 2009-01-16 22:15:46.000000000 +0100 3.7 +@@ -422,6 +422,17 @@ 3.8 + test -n "$mkimg" && img_file=`$mkimg` 3.9 + test -n "$mklog" && log_file=`$mklog` 3.10 + 3.11 ++# GRUB will try to verify that stage2 is accessible using its own 3.12 ++# filesystem drivers. Make sure it's committed to disk. 3.13 ++sync 3.14 ++ 3.15 ++# On XFS, sync() is not enough. 3.16 ++if [ `grub-probe -t fs ${grubdir}` = "xfs" ] ; then 3.17 ++ xfs_freeze -f ${grubdir} && xfs_freeze -u ${grubdir} 3.18 ++ # We don't have set -e. If xfs_freeze failed, it's worth trying anyway, 3.19 ++ # maybe we're lucky. 3.20 ++fi 3.21 ++ 3.22 + for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do 3.23 + count=5 3.24 + tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"`