ubifs: Fix wrong dirty space budget for dirty inode
authorZhihao Cheng <chengzhihao1@huawei.com>
Tue, 11 Oct 2022 03:47:30 +0000 (11:47 +0800)
committerRichard Weinberger <richard@nod.at>
Thu, 2 Feb 2023 20:13:39 +0000 (21:13 +0100)
Each dirty inode should reserve 'c->bi.inode_budget' bytes in space
budget calculation. Currently, space budget for dirty inode reports
more space than what UBIFS actually needs to write.

Fixes: 1e51764a3c2ac0 ("UBIFS: add new flash file system")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/budget.c

index e8b9b75..986e6e4 100644 (file)
@@ -400,7 +400,7 @@ static int calc_dd_growth(const struct ubifs_info *c,
        dd_growth = req->dirtied_page ? c->bi.page_budget : 0;
 
        if (req->dirtied_ino)
-               dd_growth += c->bi.inode_budget << (req->dirtied_ino - 1);
+               dd_growth += c->bi.inode_budget * req->dirtied_ino;
        if (req->mod_dent)
                dd_growth += c->bi.dent_budget;
        dd_growth += req->dirtied_ino_d;