Skip to content

Commit 044595d

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next
* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next: Squashfs: Add an option to set dev block size to 4K
2 parents 1583171 + 7657cac commit 044595d

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎fs/squashfs/Kconfig‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,28 @@ config SQUASHFS_XZ
7878

7979
If unsure, say N.
8080

81+
config SQUASHFS_4K_DEVBLK_SIZE
82+
bool "Use 4K device block size?"
83+
depends on SQUASHFS
84+
help
85+
By default Squashfs sets the dev block size (sb_min_blocksize)
86+
to 1K or the smallest block size supported by the block device
87+
(if larger). This, because blocks are packed together and
88+
unaligned in Squashfs, should reduce latency.
89+
90+
This, however, gives poor performance on MTD NAND devices where
91+
the optimal I/O size is 4K (even though the devices can support
92+
smaller block sizes).
93+
94+
Using a 4K device block size may also improve overall I/O
95+
performance for some file access patterns (e.g. sequential
96+
accesses of files in filesystem order) on all media.
97+
98+
Setting this option will force Squashfs to use a 4K device block
99+
size by default.
100+
101+
If unsure, say N.
102+
81103
config SQUASHFS_EMBEDDED
82104
bool "Additional option for memory-constrained systems"
83105
depends on SQUASHFS

‎fs/squashfs/squashfs_fs.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
#define SQUASHFS_FILE_SIZE 131072
3737
#define SQUASHFS_FILE_LOG 17
3838

39+
/* default size of block device I/O */
40+
#ifdef CONFIG_SQUASHFS_4K_DEVBLK_SIZE
41+
#define SQUASHFS_DEVBLK_SIZE 4096
42+
#else
43+
#define SQUASHFS_DEVBLK_SIZE 1024
44+
#endif
45+
3946
#define SQUASHFS_FILE_MAX_SIZE 1048576
4047
#define SQUASHFS_FILE_MAX_LOG 20
4148

‎fs/squashfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
9595
}
9696
msblk = sb->s_fs_info;
9797

98-
msblk->devblksize = sb_min_blocksize(sb, BLOCK_SIZE);
98+
msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
9999
msblk->devblksize_log2 = ffz(~msblk->devblksize);
100100

101101
mutex_init(&msblk->read_data_mutex);

0 commit comments

Comments
 (0)