]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: add prefetching for block allocation bitmaps
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 21 Apr 2020 07:54:07 +0000 (10:54 +0300)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Aug 2020 05:44:48 +0000 (01:44 -0400)
commit558d9c9295bf15ed6b849f2fba2c3e9d7907799e
tree740af5b89ccd775ffd1e35bd0315412417bf187e
parenta9bfaee0d40711eb002148ee19026e7a84324664
ext4: add prefetching for block allocation bitmaps

This should significantly improve bitmap loading, especially for flex
groups as it tries to load all bitmaps within a flex.group instead of
one by one synchronously.

Prefetching is done in 8 * flex_bg groups, so it should be 8
read-ahead reads for a single allocating thread. At the end of
allocation the thread waits for read-ahead completion and initializes
buddy information so that read-aheads are not lost in case of memory
pressure.

At cr=0 the number of prefetching IOs is limited per allocation
context to prevent a situation when mballoc loads thousands of bitmaps
looking for a perfect group and ignoring groups with good chunks.

Together with the patch "ext4: limit scanning of uninitialized groups"
the mount time (which includes few tiny allocations) of a 1PB
filesystem is reduced significantly:

               0% full    50%-full unpatched    patched
  mount time       33s                9279s       563s

[ Restructured by tytso; removed the state flags in the allocation
  context, so it can be used to lazily prefetch the allocation bitmaps
  immediately after the file system is mounted.  Skip prefetching
  block groups which are uninitialized.  Finally pass in the
  REQ_RAHEAD flag to the block layer while prefetching. ]

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/balloc.c
fs/ext4/ext4.h
fs/ext4/mballoc.c
fs/ext4/sysfs.c