Whamcloud - gitweb
Don't byte swap extents information in the inode
authorTheodore Ts'o <tytso@mit.edu>
Sat, 1 Sep 2007 13:10:43 +0000 (09:10 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 18 Feb 2008 20:27:04 +0000 (15:27 -0500)
Responsibility for byte swapping the extents information rests with
the low-level extent code, which translates the on-disk extents
information to the abstract extent format.  The on-disk format will
eventually get more complicated, in order to add support for 64-bit
block numbers, bit-compressed extents, etc.  So to avoid needing to
expose all of that complexity in swapfs.c, the in-memory contents of
i_blocks will not be byte-swapped and will be identical to the on-disk
format.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/swapfs.c

index 040e3dd..7852c62 100644 (file)
@@ -158,7 +158,11 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
        if (!hostorder)
                has_data_blocks = ext2fs_inode_data_blocks(fs, 
                                           (struct ext2_inode *) t);
+       if (hostorder && (f->i_flags & EXT4_EXTENTS_FL))
+               has_data_blocks = 0;
        t->i_flags = ext2fs_swab32(f->i_flags);
+       if (hostorder && (t->i_flags & EXT4_EXTENTS_FL))
+               has_data_blocks = 0;
        t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
        if (!islnk || has_data_blocks ) {
                for (i = 0; i < EXT2_N_BLOCKS; i++)