ext4: factor out codes to update block bitmap and group descriptor on disk from ext4_...
authorKemeng Shi <shikemeng@huaweicloud.com>
Thu, 28 Sep 2023 16:03:57 +0000 (00:03 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 Oct 2023 02:32:15 +0000 (22:32 -0400)
commitf9e2d95a45321857bd0397aa07ae30cc20f0988f
treef56796b46c68952cefd5065368e6349e607fa971
parentd2f7cf40ea89b486fb7a25f5ab9a5d3ce26fb4bb
ext4: factor out codes to update block bitmap and group descriptor on disk from ext4_mb_mark_bb

There are several reasons to add a general function ext4_mb_mark_context
to update block bitmap and group descriptor on disk:
1. pair behavior of alloc/free bits. For example,
ext4_mb_new_blocks_simple will update free_clusters in struct flex_groups
in ext4_mb_mark_bb while ext4_free_blocks_simple forgets this.
2. remove repeat code to read from disk, update and write back to disk.
3. reduce future unit test mocks to catch real IO to update structure
on disk.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20230928160407.142069-3-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mballoc.c