Messages in this thread Patch in this message | | | From | Jakub Jelinek <> | Subject | Endian bug in ext2 | Date | Wed, 28 Oct 1998 18:16:46 +0100 (MET) |
| |
Hi!
I just realized sparse superblocks don't work at all on big endian (actually, on anything but little endian). The reason is that sb->u.ext2_sb.s_feature_ro_compat (ie. the kernel structure as opposed to the ondisk structure member) is being initialized into host CPU order:
sb->u.ext2_sb.s_feature_ro_compat = le32_to_cpu(es->s_feature_ro_compat);
but the code happily applies le32_to_cpu to that value once again. This patch fixes it.
--- ./fs/ext2/super.c.jj Mon Oct 5 10:19:28 1998 +++ ./fs/ext2/super.c Wed Oct 28 17:10:35 1998 @@ -786,7 +786,7 @@ int ext2_statfs (struct super_block * sb * superblocks is turned on, then not all groups have * this. */ - if (le32_to_cpu(sb->u.ext2_sb.s_feature_ro_compat) & + if (sb->u.ext2_sb.s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) { ngroups = 0; for (i=0 ; i < sb->u.ext2_sb.s_groups_count; i++) --- ./fs/ext2/balloc.c.jj Tue Oct 27 07:16:17 1998 +++ ./fs/ext2/balloc.c Wed Oct 28 17:14:59 1998 @@ -721,7 +721,7 @@ void ext2_check_blocks_bitmap (struct su bh = sb->u.ext2_sb.s_block_bitmap[bitmap_nr]; - if (!(le32_to_cpu(sb->u.ext2_sb.s_feature_ro_compat) & + if (!(sb->u.ext2_sb.s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) || ext2_group_sparse(i)) { if (!ext2_test_bit (0, bh->b_data))
Cheers, Jakub ___________________________________________________________________ Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz Administrator of SunSITE Czech Republic, MFF, Charles University ___________________________________________________________________ Ultralinux - first 64bit OS to take full power of the UltraSparc Linux version 2.1.126 on a sparc64 machine (498.80 BogoMips). ___________________________________________________________________ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |