summaryrefslogtreecommitdiff
blob: 27d5956f3786ee130aeab195d0df05482bf23009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ext2fs_swap_inode assumes that symlinks with i_blocks > 0 are slow. If a
fast symlink has extended attributes, these are accounted for in
i_blocks too, so on big endian machines, ext2fs_swap_inode swaps the
i_block array of fast symlinks.

  Andreas Gruenbacher <agruen@suse.de>, SuSE Labs

--- e2fsprogs-1.34/lib/ext2fs/swapfs.c.orig	2003-08-30 11:33:42.000000000 +0000
+++ e2fsprogs-1.34/lib/ext2fs/swapfs.c	2003-08-30 11:47:57.000000000 +0000
@@ -75,7 +75,7 @@
 void ext2fs_swap_inode(ext2_filsys fs, struct ext2_inode *t,
 		       struct ext2_inode *f, int hostorder)
 {
-	unsigned i;
+	unsigned i, xattr_blocks;
 	int islnk = 0;
 	
 	if (hostorder && LINUX_S_ISLNK(f->i_mode))
@@ -93,7 +93,8 @@
 	t->i_links_count = ext2fs_swab16(f->i_links_count);
 	t->i_blocks = ext2fs_swab32(f->i_blocks);
 	t->i_flags = ext2fs_swab32(f->i_flags);
-	if (!islnk || f->i_blocks) {
+	xattr_blocks = (t->i_file_acl) ? (fs->blocksize >> 9) : 0;
+	if (!islnk || t->i_blocks - xattr_blocks) {
 		for (i = 0; i < EXT2_N_BLOCKS; i++)
 			t->i_block[i] = ext2fs_swab32(f->i_block[i]);
 	} else if (t != f) {