diff options
author | Richard Weinberger <richard@nod.at> | 2018-07-12 07:01:57 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-08-14 18:25:21 -0400 |
commit | 6eb61d587f4515e4be5669eff383c0185009954f (patch) | |
tree | a5d3183e104338319152a888e0ff980c2546e6e1 /fs/ubifs/tnc_commit.c | |
parent | 54169ddd382d461f7c01cc5a5182a4b4bc539489 (diff) |
ubifs: Pass struct ubifs_info to ubifs_assert()
This allows us to have more context in ubifs_assert()
and take different actions depending on the configuration.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/tnc_commit.c')
-rw-r--r-- | fs/ubifs/tnc_commit.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index a9df94ad46a3..dba87d09b989 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -87,8 +87,8 @@ static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, | |||
87 | 87 | ||
88 | atomic_long_dec(&c->dirty_zn_cnt); | 88 | atomic_long_dec(&c->dirty_zn_cnt); |
89 | 89 | ||
90 | ubifs_assert(ubifs_zn_dirty(znode)); | 90 | ubifs_assert(c, ubifs_zn_dirty(znode)); |
91 | ubifs_assert(ubifs_zn_cow(znode)); | 91 | ubifs_assert(c, ubifs_zn_cow(znode)); |
92 | 92 | ||
93 | /* | 93 | /* |
94 | * Note, unlike 'write_index()' we do not add memory barriers here | 94 | * Note, unlike 'write_index()' we do not add memory barriers here |
@@ -115,9 +115,9 @@ static int fill_gap(struct ubifs_info *c, int lnum, int gap_start, int gap_end, | |||
115 | { | 115 | { |
116 | int len, gap_remains, gap_pos, written, pad_len; | 116 | int len, gap_remains, gap_pos, written, pad_len; |
117 | 117 | ||
118 | ubifs_assert((gap_start & 7) == 0); | 118 | ubifs_assert(c, (gap_start & 7) == 0); |
119 | ubifs_assert((gap_end & 7) == 0); | 119 | ubifs_assert(c, (gap_end & 7) == 0); |
120 | ubifs_assert(gap_end >= gap_start); | 120 | ubifs_assert(c, gap_end >= gap_start); |
121 | 121 | ||
122 | gap_remains = gap_end - gap_start; | 122 | gap_remains = gap_end - gap_start; |
123 | if (!gap_remains) | 123 | if (!gap_remains) |
@@ -131,7 +131,7 @@ static int fill_gap(struct ubifs_info *c, int lnum, int gap_start, int gap_end, | |||
131 | const int alen = ALIGN(len, 8); | 131 | const int alen = ALIGN(len, 8); |
132 | int err; | 132 | int err; |
133 | 133 | ||
134 | ubifs_assert(alen <= gap_remains); | 134 | ubifs_assert(c, alen <= gap_remains); |
135 | err = make_idx_node(c, c->ileb_buf + gap_pos, znode, | 135 | err = make_idx_node(c, c->ileb_buf + gap_pos, znode, |
136 | lnum, gap_pos, len); | 136 | lnum, gap_pos, len); |
137 | if (err) | 137 | if (err) |
@@ -259,7 +259,7 @@ static int layout_leb_in_gaps(struct ubifs_info *c, int *p) | |||
259 | struct ubifs_idx_node *idx; | 259 | struct ubifs_idx_node *idx; |
260 | int in_use, level; | 260 | int in_use, level; |
261 | 261 | ||
262 | ubifs_assert(snod->type == UBIFS_IDX_NODE); | 262 | ubifs_assert(c, snod->type == UBIFS_IDX_NODE); |
263 | idx = snod->node; | 263 | idx = snod->node; |
264 | key_read(c, ubifs_idx_key(c, idx), &snod->key); | 264 | key_read(c, ubifs_idx_key(c, idx), &snod->key); |
265 | level = le16_to_cpu(idx->level); | 265 | level = le16_to_cpu(idx->level); |
@@ -373,7 +373,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) | |||
373 | 373 | ||
374 | p = c->gap_lebs; | 374 | p = c->gap_lebs; |
375 | do { | 375 | do { |
376 | ubifs_assert(p < c->gap_lebs + c->lst.idx_lebs); | 376 | ubifs_assert(c, p < c->gap_lebs + c->lst.idx_lebs); |
377 | written = layout_leb_in_gaps(c, p); | 377 | written = layout_leb_in_gaps(c, p); |
378 | if (written < 0) { | 378 | if (written < 0) { |
379 | err = written; | 379 | err = written; |
@@ -639,7 +639,7 @@ static int get_znodes_to_commit(struct ubifs_info *c) | |||
639 | } | 639 | } |
640 | cnt += 1; | 640 | cnt += 1; |
641 | while (1) { | 641 | while (1) { |
642 | ubifs_assert(!ubifs_zn_cow(znode)); | 642 | ubifs_assert(c, !ubifs_zn_cow(znode)); |
643 | __set_bit(COW_ZNODE, &znode->flags); | 643 | __set_bit(COW_ZNODE, &znode->flags); |
644 | znode->alt = 0; | 644 | znode->alt = 0; |
645 | cnext = find_next_dirty(znode); | 645 | cnext = find_next_dirty(znode); |
@@ -652,7 +652,7 @@ static int get_znodes_to_commit(struct ubifs_info *c) | |||
652 | cnt += 1; | 652 | cnt += 1; |
653 | } | 653 | } |
654 | dbg_cmt("committing %d znodes", cnt); | 654 | dbg_cmt("committing %d znodes", cnt); |
655 | ubifs_assert(cnt == atomic_long_read(&c->dirty_zn_cnt)); | 655 | ubifs_assert(c, cnt == atomic_long_read(&c->dirty_zn_cnt)); |
656 | return cnt; | 656 | return cnt; |
657 | } | 657 | } |
658 | 658 | ||
@@ -760,7 +760,7 @@ int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot) | |||
760 | err = layout_commit(c, no_space, cnt); | 760 | err = layout_commit(c, no_space, cnt); |
761 | if (err) | 761 | if (err) |
762 | goto out_free; | 762 | goto out_free; |
763 | ubifs_assert(atomic_long_read(&c->dirty_zn_cnt) == 0); | 763 | ubifs_assert(c, atomic_long_read(&c->dirty_zn_cnt) == 0); |
764 | err = free_unused_idx_lebs(c); | 764 | err = free_unused_idx_lebs(c); |
765 | if (err) | 765 | if (err) |
766 | goto out; | 766 | goto out; |
@@ -781,7 +781,7 @@ int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot) | |||
781 | * budgeting subsystem to assume the index is already committed, | 781 | * budgeting subsystem to assume the index is already committed, |
782 | * even though it is not. | 782 | * even though it is not. |
783 | */ | 783 | */ |
784 | ubifs_assert(c->bi.min_idx_lebs == ubifs_calc_min_idx_lebs(c)); | 784 | ubifs_assert(c, c->bi.min_idx_lebs == ubifs_calc_min_idx_lebs(c)); |
785 | c->bi.old_idx_sz = c->calc_idx_sz; | 785 | c->bi.old_idx_sz = c->calc_idx_sz; |
786 | c->bi.uncommitted_idx = 0; | 786 | c->bi.uncommitted_idx = 0; |
787 | c->bi.min_idx_lebs = ubifs_calc_min_idx_lebs(c); | 787 | c->bi.min_idx_lebs = ubifs_calc_min_idx_lebs(c); |
@@ -887,8 +887,8 @@ static int write_index(struct ubifs_info *c) | |||
887 | /* Grab some stuff from znode while we still can */ | 887 | /* Grab some stuff from znode while we still can */ |
888 | cnext = znode->cnext; | 888 | cnext = znode->cnext; |
889 | 889 | ||
890 | ubifs_assert(ubifs_zn_dirty(znode)); | 890 | ubifs_assert(c, ubifs_zn_dirty(znode)); |
891 | ubifs_assert(ubifs_zn_cow(znode)); | 891 | ubifs_assert(c, ubifs_zn_cow(znode)); |
892 | 892 | ||
893 | /* | 893 | /* |
894 | * It is important that other threads should see %DIRTY_ZNODE | 894 | * It is important that other threads should see %DIRTY_ZNODE |