diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-07-24 07:52:45 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-08-13 04:35:16 -0400 |
commit | dab4b4d2f915a65022343012a795f4ae4ae7e83c (patch) | |
tree | 13a1ec2c5f6b18781145bccddf2fb63017a1336b /fs/ubifs/budget.c | |
parent | 547000da6412c45456ff2ff44a171d01027bd727 (diff) |
UBIFS: align inode data to eight
UBIFS aligns node lengths to 8, so budgeting has to do the
same. Well, direntry, inode, and page budgets are already
aligned, but not inode data budget (e.g., data in special
devices or symlinks). Do this for inode data as well.
Also, add corresponding debugging checks.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/budget.c')
-rw-r--r-- | fs/ubifs/budget.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index f5afce5f37bd..a3978ba4215e 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c | |||
@@ -551,6 +551,8 @@ int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req) | |||
551 | ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA); | 551 | ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA); |
552 | ubifs_assert(req->dirtied_ino <= 4); | 552 | ubifs_assert(req->dirtied_ino <= 4); |
553 | ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4); | 553 | ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4); |
554 | ubifs_assert(!(req->new_ino_d & 7)); | ||
555 | ubifs_assert(!(req->dirtied_ino_d & 7)); | ||
554 | 556 | ||
555 | data_growth = calc_data_growth(c, req); | 557 | data_growth = calc_data_growth(c, req); |
556 | dd_growth = calc_dd_growth(c, req); | 558 | dd_growth = calc_dd_growth(c, req); |
@@ -632,6 +634,8 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req) | |||
632 | ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA); | 634 | ubifs_assert(req->new_ino_d <= UBIFS_MAX_INO_DATA); |
633 | ubifs_assert(req->dirtied_ino <= 4); | 635 | ubifs_assert(req->dirtied_ino <= 4); |
634 | ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4); | 636 | ubifs_assert(req->dirtied_ino_d <= UBIFS_MAX_INO_DATA * 4); |
637 | ubifs_assert(!(req->new_ino_d & 7)); | ||
638 | ubifs_assert(!(req->dirtied_ino_d & 7)); | ||
635 | if (!req->recalculate) { | 639 | if (!req->recalculate) { |
636 | ubifs_assert(req->idx_growth >= 0); | 640 | ubifs_assert(req->idx_growth >= 0); |
637 | ubifs_assert(req->data_growth >= 0); | 641 | ubifs_assert(req->data_growth >= 0); |
@@ -659,7 +663,11 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req) | |||
659 | 663 | ||
660 | ubifs_assert(c->budg_idx_growth >= 0); | 664 | ubifs_assert(c->budg_idx_growth >= 0); |
661 | ubifs_assert(c->budg_data_growth >= 0); | 665 | ubifs_assert(c->budg_data_growth >= 0); |
666 | ubifs_assert(c->budg_dd_growth >= 0); | ||
662 | ubifs_assert(c->min_idx_lebs < c->main_lebs); | 667 | ubifs_assert(c->min_idx_lebs < c->main_lebs); |
668 | ubifs_assert(!(c->budg_idx_growth & 7)); | ||
669 | ubifs_assert(!(c->budg_data_growth & 7)); | ||
670 | ubifs_assert(!(c->budg_dd_growth & 7)); | ||
663 | spin_unlock(&c->space_lock); | 671 | spin_unlock(&c->space_lock); |
664 | } | 672 | } |
665 | 673 | ||
@@ -701,7 +709,7 @@ void ubifs_release_dirty_inode_budget(struct ubifs_info *c, | |||
701 | struct ubifs_budget_req req; | 709 | struct ubifs_budget_req req; |
702 | 710 | ||
703 | memset(&req, 0, sizeof(struct ubifs_budget_req)); | 711 | memset(&req, 0, sizeof(struct ubifs_budget_req)); |
704 | req.dd_growth = c->inode_budget + ui->data_len; | 712 | req.dd_growth = c->inode_budget + ALIGN(ui->data_len, 8); |
705 | ubifs_release_budget(c, &req); | 713 | ubifs_release_budget(c, &req); |
706 | } | 714 | } |
707 | 715 | ||