aboutsummaryrefslogtreecommitdiffstats
path: root/tools/genext2fs/patches/400-byteswap_fix.patch
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-06-02 12:43:46 +0000
committerJohn Crispin <blogic@openwrt.org>2014-06-02 12:43:46 +0000
commitd4d63a3d241b453a044ce72a5bb7ea68e94f7b2c (patch)
tree5e8127f47766a36ca113143151c372a5abce66a4 /tools/genext2fs/patches/400-byteswap_fix.patch
parent4c58e12447b930bbaa8747a03a41707177e3bc00 (diff)
downloadmaster-187ad058-d4d63a3d241b453a044ce72a5bb7ea68e94f7b2c.tar.gz
master-187ad058-d4d63a3d241b453a044ce72a5bb7ea68e94f7b2c.tar.bz2
master-187ad058-d4d63a3d241b453a044ce72a5bb7ea68e94f7b2c.zip
tools: genext2fs: add support for blocksize != 1024
This patch series is extracted from http://ftp.de.debian.org/debian/pool/main/g/genext2fs/genext2fs_1.4.1-4.debian.tar.gz The patches are used in Debian for quite a long time, so I assume that this is solid material. At least, my Ubuntu host fsck.ext4 does not bark :-) The goal is to allow building filesystems with larger blocksizes instead of the current default of 1k. This should improve performance and lifetime when the filesystem is stored e.g. on a SD card (on Raspberry Pi/I2SE Duckbill for example) which uses internal flash memory. Writing to flash memory is slow because writing the data of one block results in erasing a whole erase block of the flash memory. Thus it is preferable to align the filesystem block size on a flash device with the erase blocksize, or at least bring it closer to the later one, to avoid unnecessary write amplification. Signed-off-by: Michael Heimpold <mhei@heimpold.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40921 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/genext2fs/patches/400-byteswap_fix.patch')
-rw-r--r--tools/genext2fs/patches/400-byteswap_fix.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/genext2fs/patches/400-byteswap_fix.patch b/tools/genext2fs/patches/400-byteswap_fix.patch
new file mode 100644
index 0000000000..7b3c00b5ee
--- /dev/null
+++ b/tools/genext2fs/patches/400-byteswap_fix.patch
@@ -0,0 +1,44 @@
+Index: genext2fs/genext2fs.c
+===================================================================
+--- genext2fs.orig/genext2fs.c 2011-11-29 17:36:06.000000000 +0100
++++ genext2fs/genext2fs.c 2011-11-29 17:37:37.000000000 +0100
+@@ -1779,7 +1779,8 @@
+ assert(nod->i_block[EXT2_DIND_BLOCK] != 0);
+ for(i = 0; i < BLOCKSIZE/4; i++)
+ if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i )
+- swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
++ if (((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])
++ swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
+ swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]));
+ if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4)
+ return;
+@@ -1792,7 +1793,8 @@
+ (BLOCKSIZE/4)*(BLOCKSIZE/4) +
+ i*(BLOCKSIZE/4)*(BLOCKSIZE/4) +
+ j*(BLOCKSIZE/4)) )
+- swap_block(get_blk(fs,b2[j]));
++ if (b2[j])
++ swap_block(get_blk(fs,b2[j]));
+ else {
+ done = 1;
+ break;
+@@ -1825,7 +1827,8 @@
+ swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]));
+ for(i = 0; i < BLOCKSIZE/4; i++)
+ if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i )
+- swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
++ if (((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])
++ swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
+ if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4)
+ return;
+ /* Adding support for triple indirection */
+@@ -1839,7 +1842,8 @@
+ (BLOCKSIZE/4)*(BLOCKSIZE/4) +
+ i*(BLOCKSIZE/4)*(BLOCKSIZE/4) +
+ j*(BLOCKSIZE/4)) )
+- swap_block(get_blk(fs,b2[j]));
++ if (b2[j])
++ swap_block(get_blk(fs,b2[j]));
+ else {
+ done = 1;
+ break;