summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2022-10-11 11:47:30 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 16:26:50 +0100
commit5381c45466dd241ac0c9e39e2dc92a585e101e57 (patch)
treebdda8e105eb435304803017c69e9558b4facf6c3 /fs/ubifs
parent3afd49bec1f857d856e88b4c2060d9df0ca0a57f (diff)
downloadlinux-stable-5381c45466dd241ac0c9e39e2dc92a585e101e57.tar.gz
linux-stable-5381c45466dd241ac0c9e39e2dc92a585e101e57.tar.bz2
linux-stable-5381c45466dd241ac0c9e39e2dc92a585e101e57.zip
ubifs: Fix wrong dirty space budget for dirty inode
[ Upstream commit b248eaf049d9cdc5eb76b59399e4d3de233f02ac ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/budget.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 11a11b32a2a9..e6b5d61a4e20 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -415,7 +415,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;