summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-19 18:26:29 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-23 11:23:29 +0100
commitaf14a1ad792621942a03e4bd0e5f17b6e177e2e0 (patch)
treeb91e77a8a1a373ca3dfcc84ec0feb243fb74e2e5 /fs/ubifs/super.c
parentUBIFS: various comment improvements and fixes (diff)
downloadlinux-af14a1ad792621942a03e4bd0e5f17b6e177e2e0.tar.xz
linux-af14a1ad792621942a03e4bd0e5f17b6e177e2e0.zip
UBIFS: fix available blocks count
Take into account that 2 eraseblocks are never available because they are reserved for the index. This gives more realistic count of FS blocks. To avoid future confusions like this, introduce a constant. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 2dbaa4fc2cbb..a6a7798d020b 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -695,9 +695,10 @@ static int init_constants_late(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, and assume only one journal head is available.
+ * deletions, minimum LEBs for the index, and assume only one journal
+ * head is available.
*/
- tmp64 = c->main_lebs - 2 - c->jhead_cnt + 1;
+ tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt + 1;
tmp64 *= (uint64_t)c->leb_size - c->leb_overhead;
tmp64 = ubifs_reported_space(c, tmp64);
c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT;