[PATCH] Efficient bswab64 for i386
Due to some bugs in byteorder/generic.h linux would always use C handcoded swab64 for 64bit ntohq or cpu_to_be64. The C version is very inefficient and expands to 30+ instructions of horrible code. This hurts on filesystems that use on disk big endian data structures with 64bit data types. This patch adds an assembly optimized swab64 to fix it. Now bswab64 is 4 instructions when your CPU supports bswap and 9 when it doesn't. Tests were done with gcc 3.2, may be different on older gcc. This is good for ~600 bytes code size reduction in XFS (gcc 3.2): Before: 503199 3296 1682 508177 7c111 fs/xfs/xfs.o After: 502543 3296 1682 507521 7be81 fs/xfs/xfs.o Also should be faster. Also some minor cleanups in the file.
Showing
Please register or sign in to comment