Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108548
b: refs/heads/master
c: b364b41
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Aug 13, 2008
1 parent 84b07d8 commit 1c95078
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1de9415906bccab51fb74c6adf575948610f0909
refs/heads/master: b364b41aeb0289be402be83eebca92eb90bfcb8b
8 changes: 4 additions & 4 deletions trunk/fs/ubifs/budget.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ int ubifs_calc_min_idx_lebs(struct ubifs_info *c)

idx_size = c->old_idx_sz + c->budg_idx_growth + c->budg_uncommitted_idx;

/* And make sure we have twice the index size of space reserved */
idx_size <<= 1;
/* And make sure we have trice the index size of space reserved */
idx_size = idx_size + (idx_size << 1);

/*
* We do not maintain 'old_idx_size' as 'old_idx_lebs'/'old_idx_bytes'
Expand Down Expand Up @@ -388,11 +388,11 @@ static int can_use_rp(struct ubifs_info *c)
* This function makes sure UBIFS has enough free eraseblocks for index growth
* and data.
*
* When budgeting index space, UBIFS reserves twice as more LEBs as the index
* When budgeting index space, UBIFS reserves trice as more LEBs as the index
* would take if it was consolidated and written to the flash. This guarantees
* that the "in-the-gaps" commit method always succeeds and UBIFS will always
* be able to commit dirty index. So this function basically adds amount of
* budgeted index space to the size of the current index, multiplies this by 2,
* budgeted index space to the size of the current index, multiplies this by 3,
* and makes sure this does not exceed the amount of free eraseblocks.
*
* Notes about @c->min_idx_lebs and @c->lst.idx_lebs variables:
Expand Down
9 changes: 7 additions & 2 deletions trunk/fs/ubifs/find.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,14 @@ int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
idx_lp = idx_heap->arr[0];
sum = idx_lp->free + idx_lp->dirty;
/*
* Since we reserve twice as more space for the index than it
* Since we reserve trice as more space for the index than it
* actually takes, it does not make sense to pick indexing LEBs
* with less than half LEB of dirty space.
* with less than, say, half LEB of dirty space. May be half is
* not the optimal boundary - this should be tested and
* checked. This boundary should determine how much we use
* in-the-gaps to consolidate the index comparing to how much
* we use garbage collector to consolidate it. The "half"
* criteria just feels to be fine.
*/
if (sum < min_space || sum < c->half_leb_size)
idx_lp = NULL;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ubifs/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static inline long long ubifs_reported_space(const struct ubifs_info *c,
{
int divisor, factor;

divisor = UBIFS_MAX_DATA_NODE_SZ + (c->max_idx_node_sz << 1);
divisor = UBIFS_MAX_DATA_NODE_SZ + (c->max_idx_node_sz * 3);
factor = UBIFS_MAX_DATA_NODE_SZ - UBIFS_DATA_NODE_SZ;
do_div(free, divisor);

Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/ubifs/ubifs-media.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ enum {
/* Minimum number of orphan area logical eraseblocks */
#define UBIFS_MIN_ORPH_LEBS 1
/*
* Minimum number of main area logical eraseblocks (buds, 2 for the index, 1
* Minimum number of main area logical eraseblocks (buds, 3 for the index, 1
* for GC, 1 for deletions, and at least 1 for committed data).
*/
#define UBIFS_MIN_MAIN_LEBS (UBIFS_MIN_BUD_LEBS + 5)
#define UBIFS_MIN_MAIN_LEBS (UBIFS_MIN_BUD_LEBS + 6)

/* Minimum number of logical eraseblocks */
#define UBIFS_MIN_LEB_CNT (UBIFS_SB_LEBS + UBIFS_MST_LEBS + \
Expand Down

0 comments on commit 1c95078

Please sign in to comment.