Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250445
b: refs/heads/master
c: 34bdc3e
h: refs/heads/master
i:
  250443: f394a38
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed May 16, 2011
1 parent b3555f0 commit e145a70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 34 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: dcc50c8ee334d570cef84fc956084d567f32a8a3
refs/heads/master: 34bdc3e2578cae3162e481203a2980d55e184a73
48 changes: 15 additions & 33 deletions trunk/fs/ubifs/lprops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,22 +1006,12 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
}
}

/**
* struct scan_check_data - data provided to scan callback function.
* @lst: LEB properties statistics
* @err: error code
*/
struct scan_check_data {
struct ubifs_lp_stats lst;
int err;
};

/**
* scan_check_cb - scan callback.
* @c: the UBIFS file-system description object
* @lp: LEB properties to scan
* @in_tree: whether the LEB properties are in main memory
* @data: information passed to and from the caller of the scan
* @lst: lprops statistics to update
*
* This function returns a code that indicates whether the scan should continue
* (%LPT_SCAN_CONTINUE), whether the LEB properties should be added to the tree
Expand All @@ -1030,11 +1020,10 @@ struct scan_check_data {
*/
static int scan_check_cb(struct ubifs_info *c,
const struct ubifs_lprops *lp, int in_tree,
struct scan_check_data *data)
struct ubifs_lp_stats *lst)
{
struct ubifs_scan_leb *sleb;
struct ubifs_scan_node *snod;
struct ubifs_lp_stats *lst = &data->lst;
int cat, lnum = lp->lnum, is_idx = 0, used = 0, free, dirty, ret;
void *buf = NULL;

Expand Down Expand Up @@ -1267,8 +1256,7 @@ static int scan_check_cb(struct ubifs_info *c,
int dbg_check_lprops(struct ubifs_info *c)
{
int i, err;
struct scan_check_data data;
struct ubifs_lp_stats *lst = &data.lst;
struct ubifs_lp_stats lst;

if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS))
return 0;
Expand All @@ -1283,29 +1271,23 @@ int dbg_check_lprops(struct ubifs_info *c)
return err;
}

memset(lst, 0, sizeof(struct ubifs_lp_stats));

data.err = 0;
memset(&lst, 0, sizeof(struct ubifs_lp_stats));
err = ubifs_lpt_scan_nolock(c, c->main_first, c->leb_cnt - 1,
(ubifs_lpt_scan_callback)scan_check_cb,
&data);
&lst);
if (err && err != -ENOSPC)
goto out;
if (data.err) {
err = data.err;
goto out;
}

if (lst->empty_lebs != c->lst.empty_lebs ||
lst->idx_lebs != c->lst.idx_lebs ||
lst->total_free != c->lst.total_free ||
lst->total_dirty != c->lst.total_dirty ||
lst->total_used != c->lst.total_used) {
if (lst.empty_lebs != c->lst.empty_lebs ||
lst.idx_lebs != c->lst.idx_lebs ||
lst.total_free != c->lst.total_free ||
lst.total_dirty != c->lst.total_dirty ||
lst.total_used != c->lst.total_used) {
ubifs_err("bad overall accounting");
ubifs_err("calculated: empty_lebs %d, idx_lebs %d, "
"total_free %lld, total_dirty %lld, total_used %lld",
lst->empty_lebs, lst->idx_lebs, lst->total_free,
lst->total_dirty, lst->total_used);
lst.empty_lebs, lst.idx_lebs, lst.total_free,
lst.total_dirty, lst.total_used);
ubifs_err("read from lprops: empty_lebs %d, idx_lebs %d, "
"total_free %lld, total_dirty %lld, total_used %lld",
c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free,
Expand All @@ -1314,11 +1296,11 @@ int dbg_check_lprops(struct ubifs_info *c)
goto out;
}

if (lst->total_dead != c->lst.total_dead ||
lst->total_dark != c->lst.total_dark) {
if (lst.total_dead != c->lst.total_dead ||
lst.total_dark != c->lst.total_dark) {
ubifs_err("bad dead/dark space accounting");
ubifs_err("calculated: total_dead %lld, total_dark %lld",
lst->total_dead, lst->total_dark);
lst.total_dead, lst.total_dark);
ubifs_err("read from lprops: total_dead %lld, total_dark %lld",
c->lst.total_dead, c->lst.total_dark);
err = -EINVAL;
Expand Down

0 comments on commit e145a70

Please sign in to comment.