Skip to content

Large Blocksize Support V4

[email protected] linux-ext4 linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest37 patches 7 repliesIn review

V3->V4 from the cover letter

- It is possible to transparently make filesystems support larger blocksizes by simply allowing larger blocksizes in set_blocksize. Remove all special modifications for mmap etc from the filesystems. This now makes 3 disk based filesystems that can use larger blocks (reiser, ext2, xfs). Are there any other useful ones to make work?
- Patch against 2.6.22-rc4-mm2 which allows the use of Mel's antifrag logic to avoid fragmentation.
- More page cache cleanup by applying the functions to filesystems.
- Disable bouncing when the gfp mask is setup.
- Disable mmap directly in mm/filemap.c to avoid filesystem changes while we have no mmap support for higher order pages.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/37Define functions for page cache handlinginclude/linux/pagemap.h+54 -00 replies
2/37Pagecache zeroing: zero_user_segment, zero_user_segments and zero_userfs/affs/file.c fs/buffer.c fs/direct-io.c +20 more+107 -1250 replies
3/37Use page_cache_xxx function in mm/filemap.cmm/filemap.c+38 -380 replies
4/37Use page_cache_xxx in mm/page-writeback.cmm/page-writeback.c+3 -30 replies
5/37Use page_cache_xxx in mm/truncate.cmm/truncate.c+18 -170 replies
6/37Use page_cache_xxx in mm/rmap.cmm/rmap.c+9 -40 replies
7/37Use page_cache_xxx in mm/filemap_xip.cmm/filemap_xip.c+14 -140 replies
8/37Use page_cache_xxx in mm/migrate.cmm/migrate.c+1 -10 replies
9/37Use page_cache_xxx in fs/libfs.cfs/libfs.c+10 -80 replies
10/37Use page_cache_xxx in fs/sync.fs/sync.c+4 -40 replies
11/37Use page_cache_xxx in fs/buffer.cfs/buffer.c+56 -430 replies
12/37Use page_cache_xxx in mm/mpage.cfs/mpage.c+16 -120 replies
13/37Use page_cache_xxx in mm/fadvise.cmm/fadvise.c+4 -40 replies
14/37Use page_cache_xxx in fs/splice.cfs/splice.c+13 -100 replies
15/37Use page_cache_xxx functions in fs/ext2fs/ext2/dir.c+23 -170 replies
16/37Use page_cache_xxx in fs/ext3fs/ext3/dir.c fs/ext3/inode.c+20 -190 replies
17/37Use page_cache_xxx in fs/ext4fs/ext4/dir.c fs/ext4/inode.c fs/ext4/writeback.c+38 -340 replies
18/37Use page_cache_xxx in fs/reiserfsfs/reiserfs/bitmap.c fs/reiserfs/file.c fs/reiserfs/inode.c +4 more+50 -330 replies
19/37Use page_cache_xxx for fs/xfsfs/xfs/linux-2.6/xfs_aops.c fs/xfs/linux-2.6/xfs_lrw.c+31 -280 replies
20/37Fix PAGE SIZE assumption in miscellaneous places.kernel/container.c kernel/futex.c+3 -30 replies
21/37Use page_cache_xxx in drivers/block/loop.cdrivers/block/loop.c+8 -50 replies
22/37Use page_cache_xxx in drivers/block/rd.cdrivers/block/rd.c+4 -40 replies
23/37compound pages: PageHead/PageTail instead of PageCompoundinclude/linux/page-flags.h mm/internal.h mm/page_alloc.c+14 -330 replies
24/37compound pages: Add new support functionsinclude/linux/mm.h+15 -00 replies
25/37compound pages: vmstat supportinclude/linux/vmstat.h mm/vmstat.c+15 -80 replies
26/37compound pages: Use new compound vmstat functions in SLUBmm/slub.c+4 -90 replies
27/37compound pages: Allow use of get_page_unless_zero with compound pagesinclude/linux/mm.h+1 -10 replies
28/37compound pages: Allow freeing of compound pages via pagevecmm/page_alloc.c mm/swap.c+18 -30 replies
29/37Large blocksize support: Fix up reclaim countersinclude/linux/mm_inline.h mm/vmscan.c+43 -200 replies
30/37Add VM_BUG_ONs to check for correct page orderfs/buffer.c mm/filemap.c+16 -30 replies
31/37Large blocksize support: Core pieceblock/Kconfig drivers/block/rd.c fs/block_dev.c +7 more+186 -282 replies
32/37Readahead changes to support large blocksize.include/linux/mm.h mm/fadvise.c mm/filemap.c +2 more+20 -150 replies
33/37Large blocksize: Compound page zeroing and flushingfs/libfs.c include/linux/highmem.h mm/filemap.c +1 more+37 -100 replies
34/37Large blocksize support in ramfsfs/ramfs/inode.c+9 -32 replies
35/37Large blocksize support in XFSfs/xfs/xfs_mount.c+0 -130 replies
36/37Large blocksize support for ext2fs/ext2/inode.c+3 -03 replies
37/37Reiserfs: Fix up for mapping_set_gfp_maskfs/reiserfs/xattr.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [00/37] Large Blocksize Support V4

V3->V4
- It is possible to transparently make filesystems support larger blocksizes by simply allowing larger blocksizes in set_blocksize. Remove all special modifications for mmap etc from the filesystems. This now makes 3 disk based filesystems that can use larger blocks (reiser, ext2, xfs). Are there any other useful ones to make work?
- Patch against 2.6.22-rc4-mm2 which allows the use of Mel's antifrag logic to avoid fragmentation.
- More page cache cleanup by applying the functions to filesystems.
- Disable bouncing when the gfp mask is setup.
- Disable mmap directly in mm/filemap.c to avoid filesystem changes while we have no mmap support for higher order pages.

RFC V2->V3
- More restructuring
- It actually works!
- Add XFS support
- Fix up UP support
- Work out the direct I/O issues
- Add CONFIG_LARGE_BLOCKSIZE. Off by default which makes the inlines revert back to constants. Disabled for 32bit and HIGHMEM configurations. This also allows a gradual migration to the new page cache inline functions. LARGE_BLOCKSIZE capabilities can be
added gradually and if there is a problem then we can disable a subsystem.

RFC V1->V2
- Some ext2 support
- Some block layer, fs layer support etc.
- Better page cache macros
- Use macros to clean up code.

This patchset modifies the Linux kernel so that larger block sizes than page size can be supported. Larger block sizes are handled by using compound pages of an arbitrary order for the page cache instead of single pages with order 0.

Rationales:

1. We have problems supporting devices with a higher blocksize than page size. This is for example important to support CD and DVDs that can only read and write 32k or 64k blocks. We currently have a shim layer in there to deal with this situation which limits the speed of I/O. The developers are currently looking for ways to completely bypass the page cache because of this deficiency.

2. 32/64k blocksize is also used in flash devices. Same issues.

3. Future harddisks will support bigger block sizes that Linux cannot support since we are limited to PAGE_SIZE. Ok the on board cache may buffer this for us but what is the point of handling smaller page sizes than what the drive supports?

4. Reduce fsck times. Larger block sizes mean faster file system checking. Using 64k block size will reduce the number of blocks to be managed by a factor of 16 and produce much denser and contiguous metadata.

5. Performance. If we look at IA64 vs. x86_64 then it seems that the faster interrupt handling on x86_64 compensate for the speed loss due to a smaller page size (4k vs 16k on IA64). Supporting larger block sizes sizes on all allows a significant reduction in I/O overhead and increases the size of I/O that can be performed by hardware in a single request since the number of scatter gather entries are typically limited for one request. This is going to become increasingly important to support the ever growing memory sizes since we may have to handle excessively large amounts of 4k requests for data sizes that may become common soon. For example to write a 1 terabyte file the kernel would have to handle 256 million 4k chunks.

6. Cross arch compatibility: It is currently not possible to mount an 16k blocksize ext2 filesystem created on IA64 on an x86_64 system. With this patch this becomes possible. Note that this also means that some filesystems are already capable of working with blocksizes of up to 64k (ext2, XFS) which is currently only available on a select few arches. This patchset enables that functionality on all arches. There are no special modifications needed to the filesystems. The set_blocksize() function call will simply support a larger blocksize.

7. VM scalability
Large block sizes mean less state keeping for the information being transferred. For a 1TB file one needs to handle 256 million page structs in the VM if one uses 4k page size. A 64k page size reduces that amount to 16 million. If the limitation in existing filesystems are removed then even higher reductions become possible. For very large files like that a page size of 2 MB may be beneficial which will reduce the number of page struct to handle to 512k. The variable nature of the block size means that the size can be tuned at file system creation time for the anticipated needs on a volume.

8. IO scalability
The IO layer will receive large blocks of contiguious memory with this patchset. This means that less scatter gather elements are needed and the memory used is guaranteed to be contiguous. Instead of having to handle 4k chunks we can f.e. handle 64k chunks in one go.

Dave Chinner measures a performance increase of 50% when going to 64k blocksize with XFS.

How to make this work:

1. Apply this patchset on top of 2.6.22-rc4-mm2
2. Enable LARGE_BLOCKSIZE Support
3. compile kernel

In order to use a filesystem with a higher order it needs to be formatted with larger blocksize. This is done using the mkfs.xxx tool for each filesystem. The existing tools work without modification. They may just warn you that the blocksize you specify is not supported on your particular architecture. Ignore that warning since this is no longer true after you have applied this patchset.

Tested file systems:

Filesystem Max Blocksize Changes

Reiserfs 8k Page size functions
Ext2 64k Page size functions
XFS 64k Page size functions / Remove PAGE_SIZE check
Ramfs MAX_ORDER Parameter to specify order

Todo/Issues:

- There are certainly numerous issues with this patch. I have only tested copying files back and forth, volume creation etc. Others have run fsxlinux on the volumes. The missing mmap support limits what can be done for now.

- Antifragmentation in mm does address some fragmentation issues (typically works up to 32k blocksize). However, large orders lead to fragmentation of the movable sections. Seems that we need Mel's memory compaction to support even larger orders. How memory compaction impacts performance still has to be determined.

- Support for bouncing pages.

- Remove PAGE_CACHE_xxx constants after using page_cache_xxx functions everywhere. But that will have to wait until merging becomes possible. For now certain subsystems (shmem f.e.) are not using these functions. They will only use order 0 pages.

- Support for non harddisk based filesystems. Remove the pktdvd etc layers needed because the VM current does not support sufficiently large blocksizes for these devices. Look for other places in the kernel where we have similar issues.

- Mmap read support

Its likely easier to do restricted read only mmap support first. That would enable running executables off the filesystems with large block size.

- Full mmmap support

--