summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2024-09-05 09:09:09 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-05 14:03:04 +0100
commit7f0b3524a6c26ccde2588b611bdb17242cd7c86c (patch)
treeacb0214988da7925f4fb551e2679ff135b4b8a43 /fs
parent366fda649f1a105703e2a111126e791e27e4b566 (diff)
downloadlinux-7f0b3524a6c26ccde2588b611bdb17242cd7c86c.tar.gz
linux-7f0b3524a6c26ccde2588b611bdb17242cd7c86c.tar.bz2
linux-7f0b3524a6c26ccde2588b611bdb17242cd7c86c.zip
ubifs: Correct the total block count by deducting journal reservation
[ Upstream commit 84a2bee9c49769310efa19601157ef50a1df1267 ] Since commit e874dcde1cbf ("ubifs: Reserve one leb for each journal head while doing budget"), available space is calulated by deducting reservation for all journal heads. However, the total block count ( which is only used by statfs) is not updated yet, which will cause the wrong displaying for used space(total - available). Fix it by deducting reservation for all journal heads from total block count. Fixes: e874dcde1cbf ("ubifs: Reserve one leb for each journal head while doing budget") 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')
-rw-r--r--fs/ubifs/super.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 291583005dd1..245a10cc1eeb 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -773,10 +773,10 @@ static void init_constants_master(struct ubifs_info *c)
* necessary to report something for the 'statfs()' call.
*
* Subtract the LEB reserved for GC, the LEB which is reserved for
- * deletions, minimum LEBs for the index, and assume only one journal
- * head is available.
+ * deletions, minimum LEBs for the index, the LEBs which are reserved
+ * for each journal head.
*/
- tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt + 1;
+ tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt;
tmp64 *= (long long)c->leb_size - c->leb_overhead;
tmp64 = ubifs_reported_space(c, tmp64);
c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT;