Skip to content

Commit 84a2bee

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: Correct the total block count by deducting journal reservation
Since commit e874dcd ("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: e874dcd ("ubifs: Reserve one leb for each journal head while doing budget") Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 94f5b15 commit 84a2bee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/ubifs/super.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,10 @@ static void init_constants_master(struct ubifs_info *c)
773773
* necessary to report something for the 'statfs()' call.
774774
*
775775
* Subtract the LEB reserved for GC, the LEB which is reserved for
776-
* deletions, minimum LEBs for the index, and assume only one journal
777-
* head is available.
776+
* deletions, minimum LEBs for the index, the LEBs which are reserved
777+
* for each journal head.
778778
*/
779-
tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt + 1;
779+
tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt;
780780
tmp64 *= (long long)c->leb_size - c->leb_overhead;
781781
tmp64 = ubifs_reported_space(c, tmp64);
782782
c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT;

0 commit comments

Comments
 (0)