@@ -106,7 +106,7 @@ static long long get_liability(struct ubifs_info *c)
106106 long long liab ;
107107
108108 spin_lock (& c -> space_lock );
109- liab = c -> budg_idx_growth + c -> budg_data_growth + c -> budg_dd_growth ;
109+ liab = c -> bi . idx_growth + c -> bi . data_growth + c -> bi . dd_growth ;
110110 spin_unlock (& c -> space_lock );
111111 return liab ;
112112}
@@ -180,7 +180,7 @@ int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
180180 int idx_lebs ;
181181 long long idx_size ;
182182
183- idx_size = c -> old_idx_sz + c -> budg_idx_growth + c -> budg_uncommitted_idx ;
183+ idx_size = c -> bi . old_idx_sz + c -> bi . idx_growth + c -> bi . uncommitted_idx ;
184184 /* And make sure we have thrice the index size of space reserved */
185185 idx_size += idx_size << 1 ;
186186 /*
@@ -292,13 +292,13 @@ static int can_use_rp(struct ubifs_info *c)
292292 * budgeted index space to the size of the current index, multiplies this by 3,
293293 * and makes sure this does not exceed the amount of free LEBs.
294294 *
295- * Notes about @c->min_idx_lebs and @c->lst.idx_lebs variables:
295+ * Notes about @c->bi. min_idx_lebs and @c->lst.idx_lebs variables:
296296 * o @c->lst.idx_lebs is the number of LEBs the index currently uses. It might
297297 * be large, because UBIFS does not do any index consolidation as long as
298298 * there is free space. IOW, the index may take a lot of LEBs, but the LEBs
299299 * will contain a lot of dirt.
300- * o @c->min_idx_lebs is the number of LEBS the index presumably takes. IOW,
301- * the index may be consolidated to take up to @c->min_idx_lebs LEBs.
300+ * o @c->bi. min_idx_lebs is the number of LEBS the index presumably takes. IOW,
301+ * the index may be consolidated to take up to @c->bi. min_idx_lebs LEBs.
302302 *
303303 * This function returns zero in case of success, and %-ENOSPC in case of
304304 * failure.
@@ -343,13 +343,13 @@ static int do_budget_space(struct ubifs_info *c)
343343 c -> lst .taken_empty_lebs ;
344344 if (unlikely (rsvd_idx_lebs > lebs )) {
345345 dbg_budg ("out of indexing space: min_idx_lebs %d (old %d), "
346- "rsvd_idx_lebs %d" , min_idx_lebs , c -> min_idx_lebs ,
346+ "rsvd_idx_lebs %d" , min_idx_lebs , c -> bi . min_idx_lebs ,
347347 rsvd_idx_lebs );
348348 return - ENOSPC ;
349349 }
350350
351351 available = ubifs_calc_available (c , min_idx_lebs );
352- outstanding = c -> budg_data_growth + c -> budg_dd_growth ;
352+ outstanding = c -> bi . data_growth + c -> bi . dd_growth ;
353353
354354 if (unlikely (available < outstanding )) {
355355 dbg_budg ("out of data space: available %lld, outstanding %lld" ,
@@ -360,7 +360,7 @@ static int do_budget_space(struct ubifs_info *c)
360360 if (available - outstanding <= c -> rp_size && !can_use_rp (c ))
361361 return - ENOSPC ;
362362
363- c -> min_idx_lebs = min_idx_lebs ;
363+ c -> bi . min_idx_lebs = min_idx_lebs ;
364364 return 0 ;
365365}
366366
@@ -393,11 +393,11 @@ static int calc_data_growth(const struct ubifs_info *c,
393393{
394394 int data_growth ;
395395
396- data_growth = req -> new_ino ? c -> inode_budget : 0 ;
396+ data_growth = req -> new_ino ? c -> bi . inode_budget : 0 ;
397397 if (req -> new_page )
398- data_growth += c -> page_budget ;
398+ data_growth += c -> bi . page_budget ;
399399 if (req -> new_dent )
400- data_growth += c -> dent_budget ;
400+ data_growth += c -> bi . dent_budget ;
401401 data_growth += req -> new_ino_d ;
402402 return data_growth ;
403403}
@@ -413,12 +413,12 @@ static int calc_dd_growth(const struct ubifs_info *c,
413413{
414414 int dd_growth ;
415415
416- dd_growth = req -> dirtied_page ? c -> page_budget : 0 ;
416+ dd_growth = req -> dirtied_page ? c -> bi . page_budget : 0 ;
417417
418418 if (req -> dirtied_ino )
419- dd_growth += c -> inode_budget << (req -> dirtied_ino - 1 );
419+ dd_growth += c -> bi . inode_budget << (req -> dirtied_ino - 1 );
420420 if (req -> mod_dent )
421- dd_growth += c -> dent_budget ;
421+ dd_growth += c -> bi . dent_budget ;
422422 dd_growth += req -> dirtied_ino_d ;
423423 return dd_growth ;
424424}
@@ -460,19 +460,19 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
460460
461461again :
462462 spin_lock (& c -> space_lock );
463- ubifs_assert (c -> budg_idx_growth >= 0 );
464- ubifs_assert (c -> budg_data_growth >= 0 );
465- ubifs_assert (c -> budg_dd_growth >= 0 );
463+ ubifs_assert (c -> bi . idx_growth >= 0 );
464+ ubifs_assert (c -> bi . data_growth >= 0 );
465+ ubifs_assert (c -> bi . dd_growth >= 0 );
466466
467- if (unlikely (c -> nospace ) && (c -> nospace_rp || !can_use_rp (c ))) {
467+ if (unlikely (c -> bi . nospace ) && (c -> bi . nospace_rp || !can_use_rp (c ))) {
468468 dbg_budg ("no space" );
469469 spin_unlock (& c -> space_lock );
470470 return - ENOSPC ;
471471 }
472472
473- c -> budg_idx_growth += idx_growth ;
474- c -> budg_data_growth += data_growth ;
475- c -> budg_dd_growth += dd_growth ;
473+ c -> bi . idx_growth += idx_growth ;
474+ c -> bi . data_growth += data_growth ;
475+ c -> bi . dd_growth += dd_growth ;
476476
477477 err = do_budget_space (c );
478478 if (likely (!err )) {
@@ -484,9 +484,9 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
484484 }
485485
486486 /* Restore the old values */
487- c -> budg_idx_growth -= idx_growth ;
488- c -> budg_data_growth -= data_growth ;
489- c -> budg_dd_growth -= dd_growth ;
487+ c -> bi . idx_growth -= idx_growth ;
488+ c -> bi . data_growth -= data_growth ;
489+ c -> bi . dd_growth -= dd_growth ;
490490 spin_unlock (& c -> space_lock );
491491
492492 if (req -> fast ) {
@@ -506,9 +506,9 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
506506 goto again ;
507507 }
508508 dbg_budg ("FS is full, -ENOSPC" );
509- c -> nospace = 1 ;
509+ c -> bi . nospace = 1 ;
510510 if (can_use_rp (c ) || c -> rp_size == 0 )
511- c -> nospace_rp = 1 ;
511+ c -> bi . nospace_rp = 1 ;
512512 smp_wmb ();
513513 } else
514514 ubifs_err ("cannot budget space, error %d" , err );
@@ -523,8 +523,8 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
523523 * This function releases the space budgeted by 'ubifs_budget_space()'. Note,
524524 * since the index changes (which were budgeted for in @req->idx_growth) will
525525 * only be written to the media on commit, this function moves the index budget
526- * from @c->budg_idx_growth to @c->budg_uncommitted_idx. The latter will be
527- * zeroed by the commit operation.
526+ * from @c->bi.idx_growth to @c->bi.uncommitted_idx. The latter will be zeroed
527+ * by the commit operation.
528528 */
529529void ubifs_release_budget (struct ubifs_info * c , struct ubifs_budget_req * req )
530530{
@@ -553,23 +553,23 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)
553553 if (!req -> data_growth && !req -> dd_growth )
554554 return ;
555555
556- c -> nospace = c -> nospace_rp = 0 ;
556+ c -> bi . nospace = c -> bi . nospace_rp = 0 ;
557557 smp_wmb ();
558558
559559 spin_lock (& c -> space_lock );
560- c -> budg_idx_growth -= req -> idx_growth ;
561- c -> budg_uncommitted_idx += req -> idx_growth ;
562- c -> budg_data_growth -= req -> data_growth ;
563- c -> budg_dd_growth -= req -> dd_growth ;
564- c -> min_idx_lebs = ubifs_calc_min_idx_lebs (c );
565-
566- ubifs_assert (c -> budg_idx_growth >= 0 );
567- ubifs_assert (c -> budg_data_growth >= 0 );
568- ubifs_assert (c -> budg_dd_growth >= 0 );
569- ubifs_assert (c -> min_idx_lebs < c -> main_lebs );
570- ubifs_assert (!(c -> budg_idx_growth & 7 ));
571- ubifs_assert (!(c -> budg_data_growth & 7 ));
572- ubifs_assert (!(c -> budg_dd_growth & 7 ));
560+ c -> bi . idx_growth -= req -> idx_growth ;
561+ c -> bi . uncommitted_idx += req -> idx_growth ;
562+ c -> bi . data_growth -= req -> data_growth ;
563+ c -> bi . dd_growth -= req -> dd_growth ;
564+ c -> bi . min_idx_lebs = ubifs_calc_min_idx_lebs (c );
565+
566+ ubifs_assert (c -> bi . idx_growth >= 0 );
567+ ubifs_assert (c -> bi . data_growth >= 0 );
568+ ubifs_assert (c -> bi . dd_growth >= 0 );
569+ ubifs_assert (c -> bi . min_idx_lebs < c -> main_lebs );
570+ ubifs_assert (!(c -> bi . idx_growth & 7 ));
571+ ubifs_assert (!(c -> bi . data_growth & 7 ));
572+ ubifs_assert (!(c -> bi . dd_growth & 7 ));
573573 spin_unlock (& c -> space_lock );
574574}
575575
@@ -586,13 +586,13 @@ void ubifs_convert_page_budget(struct ubifs_info *c)
586586{
587587 spin_lock (& c -> space_lock );
588588 /* Release the index growth reservation */
589- c -> budg_idx_growth -= c -> max_idx_node_sz << UBIFS_BLOCKS_PER_PAGE_SHIFT ;
589+ c -> bi . idx_growth -= c -> max_idx_node_sz << UBIFS_BLOCKS_PER_PAGE_SHIFT ;
590590 /* Release the data growth reservation */
591- c -> budg_data_growth -= c -> page_budget ;
591+ c -> bi . data_growth -= c -> bi . page_budget ;
592592 /* Increase the dirty data growth reservation instead */
593- c -> budg_dd_growth += c -> page_budget ;
593+ c -> bi . dd_growth += c -> bi . page_budget ;
594594 /* And re-calculate the indexing space reservation */
595- c -> min_idx_lebs = ubifs_calc_min_idx_lebs (c );
595+ c -> bi . min_idx_lebs = ubifs_calc_min_idx_lebs (c );
596596 spin_unlock (& c -> space_lock );
597597}
598598
@@ -612,7 +612,7 @@ void ubifs_release_dirty_inode_budget(struct ubifs_info *c,
612612
613613 memset (& req , 0 , sizeof (struct ubifs_budget_req ));
614614 /* The "no space" flags will be cleared because dd_growth is > 0 */
615- req .dd_growth = c -> inode_budget + ALIGN (ui -> data_len , 8 );
615+ req .dd_growth = c -> bi . inode_budget + ALIGN (ui -> data_len , 8 );
616616 ubifs_release_budget (c , & req );
617617}
618618
@@ -682,9 +682,9 @@ long long ubifs_get_free_space_nolock(struct ubifs_info *c)
682682 int rsvd_idx_lebs , lebs ;
683683 long long available , outstanding , free ;
684684
685- ubifs_assert (c -> min_idx_lebs == ubifs_calc_min_idx_lebs (c ));
686- outstanding = c -> budg_data_growth + c -> budg_dd_growth ;
687- available = ubifs_calc_available (c , c -> min_idx_lebs );
685+ ubifs_assert (c -> bi . min_idx_lebs == ubifs_calc_min_idx_lebs (c ));
686+ outstanding = c -> bi . data_growth + c -> bi . dd_growth ;
687+ available = ubifs_calc_available (c , c -> bi . min_idx_lebs );
688688
689689 /*
690690 * When reporting free space to user-space, UBIFS guarantees that it is
@@ -697,8 +697,8 @@ long long ubifs_get_free_space_nolock(struct ubifs_info *c)
697697 * Note, the calculations below are similar to what we have in
698698 * 'do_budget_space()', so refer there for comments.
699699 */
700- if (c -> min_idx_lebs > c -> lst .idx_lebs )
701- rsvd_idx_lebs = c -> min_idx_lebs - c -> lst .idx_lebs ;
700+ if (c -> bi . min_idx_lebs > c -> lst .idx_lebs )
701+ rsvd_idx_lebs = c -> bi . min_idx_lebs - c -> lst .idx_lebs ;
702702 else
703703 rsvd_idx_lebs = 0 ;
704704 lebs = c -> lst .empty_lebs + c -> freeable_cnt + c -> idx_gc_cnt -
0 commit comments