aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/budget.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-25 07:38:51 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-13 04:37:28 -0400
commitb364b41aeb0289be402be83eebca92eb90bfcb8b (patch)
tree8bec0a45617f30e24b112b66973ac3eac72da834 /fs/ubifs/budget.c
parent1de9415906bccab51fb74c6adf575948610f0909 (diff)
UBIFS: reserve more space for index
At the moment UBIFS reserves twice old index size space for the index. But this is not enough in some cases, because if the indexing node are very fragmented and there are many small gaps, while the dirty index has big znodes - in-the-gaps method would fail. Thus, reserve trise as more, in which case we are guaranteed that we can commit in any case. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/budget.c')
-rw-r--r--fs/ubifs/budget.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index a3978ba4215e..323d83a4d099 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -263,8 +263,8 @@ int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
263 263
264 idx_size = c->old_idx_sz + c->budg_idx_growth + c->budg_uncommitted_idx; 264 idx_size = c->old_idx_sz + c->budg_idx_growth + c->budg_uncommitted_idx;
265 265
266 /* And make sure we have twice the index size of space reserved */ 266 /* And make sure we have trice the index size of space reserved */
267 idx_size <<= 1; 267 idx_size = idx_size + (idx_size << 1);
268 268
269 /* 269 /*
270 * We do not maintain 'old_idx_size' as 'old_idx_lebs'/'old_idx_bytes' 270 * We do not maintain 'old_idx_size' as 'old_idx_lebs'/'old_idx_bytes'
@@ -388,11 +388,11 @@ static int can_use_rp(struct ubifs_info *c)
388 * This function makes sure UBIFS has enough free eraseblocks for index growth 388 * This function makes sure UBIFS has enough free eraseblocks for index growth
389 * and data. 389 * and data.
390 * 390 *
391 * When budgeting index space, UBIFS reserves twice as more LEBs as the index 391 * When budgeting index space, UBIFS reserves trice as more LEBs as the index
392 * would take if it was consolidated and written to the flash. This guarantees 392 * would take if it was consolidated and written to the flash. This guarantees
393 * that the "in-the-gaps" commit method always succeeds and UBIFS will always 393 * that the "in-the-gaps" commit method always succeeds and UBIFS will always
394 * be able to commit dirty index. So this function basically adds amount of 394 * be able to commit dirty index. So this function basically adds amount of
395 * budgeted index space to the size of the current index, multiplies this by 2, 395 * budgeted index space to the size of the current index, multiplies this by 3,
396 * and makes sure this does not exceed the amount of free eraseblocks. 396 * and makes sure this does not exceed the amount of free eraseblocks.
397 * 397 *
398 * Notes about @c->min_idx_lebs and @c->lst.idx_lebs variables: 398 * Notes about @c->min_idx_lebs and @c->lst.idx_lebs variables: