ubifs: Fix wrong dirty space budget for dirty inode

[ Upstream commit b248eaf049 ]

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: 1e51764a3c ("UBIFS: add new flash file system")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Zhihao Cheng 2022-10-11 11:47:30 +08:00 committed by Greg Kroah-Hartman
parent f8bd27b625
commit b08071c68b
1 changed files with 1 additions and 1 deletions

View 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; dd_growth = req->dirtied_page ? c->bi.page_budget : 0;
if (req->dirtied_ino) 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) if (req->mod_dent)
dd_growth += c->bi.dent_budget; dd_growth += c->bi.dent_budget;
dd_growth += req->dirtied_ino_d; dd_growth += req->dirtied_ino_d;