Skip to content

RFC ext4: Block allocation restriction and inode preferred range of blocks for ext4

Akira Fujita linux-ext4 linux-fsdevel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7ext4: Add EXT4_IOC_ADD_GLOBAL_ALLOC_RULE restricts block allocationfs/ext4/balloc.c fs/ext4/ext4.h fs/ext4/ioctl.c +2 more+512 -108 replies
2/7ext4: Add EXT4_IOC_CLR_GLOBAL_ALLOC_RULE clears block allocation restrictionfs/ext4/ext4.h fs/ext4/ioctl.c fs/ext4/mballoc.c+205 -02 replies
3/7ext4: Add EXT4_IOC_ADD_INODE_ALLOC_RULE sets inode preferred range of blocksfs/ext4/ext4.h fs/ext4/file.c fs/ext4/ialloc.c +3 more+75 -00 replies
4/7ext4: Implement the block allocation with restricted blocksfs/ext4/mballoc.c fs/ext4/mballoc.h+306 -220 replies
5/7ext4: Implement the block allocation with preferred allocation rangefs/ext4/ext4.h fs/ext4/extents.c fs/ext4/mballoc.c+43 -110 replies
6/7ext4: Add EXT4_IOC_PRINT_GLOBAL_ARULE for debug block allocation restrictionfs/ext4/ext4.h fs/ext4/ioctl.c fs/ext4/mballoc.c+52 -00 replies
7/7ext4: Add EXT4_IOC_PRINT_INODE_ARULE for debug inode preferred range of blocksfs/ext4/ext4.h fs/ext4/ioctl.c fs/ext4/mballoc.c+27 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC][PATCH 0/7]ext4: Block allocation restriction and inode preferred range of blocks for ext4

Hi,

These are trial patches to add block allocation restriction and inode preferred range of blocks for ext4
(http://marc.info/?l=linux-ext4&m=123615213508332&w=2).

This change will help ext4 online defrag to re-implement force defrag (-f) and relevant defrag (-r) features which defrag had implemented in the past version.

Summary of this function:
a. Block allocation restriction (EXT4_IOC_ADD_GLOBAL_ALLOC_RULE)
This is the ioctl interface which allows a privileged program to specify one or more range of blocks which the filesystem's block allocator must not allocate from.
This allows the ext4 online defrag to solve free space fragmentation; it has to do with force defragmentation mode.
This feature may be useful for online shrink; at first, we restrict the allocation from the tail of a filesystem, then move data away from there, and shorten the size of it.

b. Preferred blocks allocation (EXT4_IOC_ADD_INODE_ALLOC_RULE)
This is ioctl interface which associates an inode with preferred range of blocks which the block allocator will try using first.
It gives the two following features to ext4 online defrag.
1. Defragment files and re-allocate them closely each other (Relevant file defragmentation mode needs this one).
2. After solving free space fragmentation, re-allocate a file to the contiguous free space (Force defragmentation mode needs this one).
It is also possible to allocate particular blocks to a file with fallocate in advance.

This patch set consists of following 7 patches (6/7 and 7/7 are for debugging). And can be applied to the ext4 patch queue (2.6.30-git14).

[1/7] Add EXT4_IOC_ADD_GLOBAL_ALLOC_RULE restricts block allocation [2/7] Add EXT4_IOC_CLR_GLOBAL_ALLOC_RULE clears block allocation restriction [3/7] Add EXT4_IOC_ADD_INODE_ALLOC_RULE sets inode preferred range of blocks [4/7] Implement the block allocation with restricted blocks [5/7] Implement the block allocation with preferred allocation range [6/7] (For debugging) Add EXT4_IOC_PRINT_GLOBAL_ARULE prints
block allocation restriction
[7/7] (For debugging) Add EXT4_IOC_PRINT_INODE_ARULE prints
preferred block allocation

ToDos:
1. Support indirect blocks (Current implementation is just for extent based file).
2. Inspect for the lock order of block group and allocation rule.

Any comments are very welcome.

Best regards,
Akira Fujita