On Fri, Dec 04, 2020 at 09:26:49AM +0800, brookxu wrote: > > Theodore Y. Ts'o wrote on 2020/12/3 23:08: > > On Sat, Nov 07, 2020 at 11:58:14PM +0800, Chunguang Xu wrote: > >> From: Chunguang Xu <brookxu@xxxxxxxxxxx> > >> > >> In order to avoid poor search efficiency of system_zone, the > >> system only adds metadata of some sparse group to system_zone. > >> In the meta_bg scenario, the non-sparse group may contain gdt > >> blocks. Perhaps we should add these blocks to system_zone to > >> improve fault tolerance without significantly reducing system > >> performance. > > Thanks, in the large-market scenario, if we deal with all groups, > the system_zone will be very large, which may reduce performance. > I think the previous method is good, but it needs to be changed > slightly, so that the fault tolerance in the meta_bg scenario > can be improved without the risk of performance degradation. OK, I see. But this is not actually reliable: > >> + if ((i < 5) || ((i % flex_size) == 0)) { This only works if the flex_size is less than or equal to 64 (assuming a 4k blocksize). That's because on 64-bit file systems, we can fit 64 block group descripters in a 4k block group descriptor block, so that's the size of the meta_bg. The default flex_bg size is 16, but it's quite possible to create a file system via "mke2fs -t ext4 -G 256". In that case, the flex_size will be 256, and we would not be including all of the meta_bg groups. So i % flex_size needs to be replaced by "i % meta_bg_size", where meta_bg_size would be initialized to EXT4_DESC_PER_BLOCK(sb). Does that make sense? - Ted