OSDN Git Service

ext4: skip non-loaded groups at cr=0/1 when scanning for good groups
authorAlex Zhuravlev <azhuravlev@whamcloud.com>
Sat, 20 Jun 2020 02:08:56 +0000 (22:08 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Aug 2020 05:44:55 +0000 (01:44 -0400)
commitc1d2c7d47e15482bb23cda83a5021e60f624a09c
tree9d1bd02a84b1a0e707537842a59a4b64f68e0a07
parentcfd73237722135807967f389bcbda558a60a30d6
ext4: skip non-loaded groups at cr=0/1 when scanning for good groups

cr=0 is supposed to be an optimization to save CPU cycles, but if
buddy data (in memory) is not initialized then all this makes no sense
as we have to do sync IO taking a lot of cycles.  Also, at cr=0
mballoc doesn't choose any available chunk.  cr=1 also skips groups
using heuristic based on avg. fragment size.  It's more useful to skip
such groups and switch to cr=2 where groups will be scanned for
available chunks.  However, we always read the first block group in a
flex_bg so metadata blocks will get read into the first flex_bg if
possible.

Using sparse image and dm-slow virtual device of 120TB was
simulated, then the image was formatted and filled using debugfs to
mark ~85% of available space as busy.  mount process w/o the patch
couldn't complete in half an hour (according to vmstat it would take
~10-11 hours).  With the patch applied mount took ~20 seconds.

Lustre-bug-id: https://jira.whamcloud.com/browse/LU-12988
Signed-off-by: Alex Zhuravlev <azhuravlev@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
fs/ext4/mballoc.c