aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/budget.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-24 07:42:05 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-13 04:34:27 -0400
commit547000da6412c45456ff2ff44a171d01027bd727 (patch)
tree2f99e7033dd87273876a36081cc42c9926dc6709 /fs/ubifs/budget.c
parentf769108424a19c7758546d1d7d19f098b1a33759 (diff)
UBIFS: improve budgeting checks
Budgeting is a crucial UBIFS subsystem - add more assertions to improve requests checking. This is not compiled in when UBIFS debugging is disabled. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/budget.c')
-rw-r--r--fs/ubifs/budget.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 12a1717db87c..f5afce5f37bd 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -543,6 +543,12 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req)
543 int err, idx_growth, data_growth, dd_growth; 543 int err, idx_growth, data_growth, dd_growth;
544 struct retries_info ri; 544 struct retries_info ri;
545 545
546 ubifs_assert(req->new_page <= 1);
547 ubifs_assert(req->dirtied_page <= 1);
548 ubifs_assert(req->new_dent <= 1);
549 ubifs_assert(req->mod_dent <= 1);
550 ubifs_assert(req->new_ino <= 1);
551 ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA);
546 ubifs_assert(req->dirtied_ino <= 4); 552 ubifs_assert(req->dirtied_ino <= 4);
547 ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4); 553 ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4);
548 554
@@ -618,6 +624,12 @@ again:
618 */ 624 */
619void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req) 625void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)
620{ 626{
627 ubifs_assert(req->new_page <= 1);
628 ubifs_assert(req->dirtied_page <= 1);
629 ubifs_assert(req->new_dent <= 1);
630 ubifs_assert(req->mod_dent <= 1);
631 ubifs_assert(req->new_ino <= 1);
632 ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA);
621 ubifs_assert(req->dirtied_ino <= 4); 633 ubifs_assert(req->dirtied_ino <= 4);
622 ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4); 634 ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4);
623 if (!req->recalculate) { 635 if (!req->recalculate) {