diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-08-07 09:06:11 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-08-30 09:19:09 +0200 |
commit | 3bb66b47a4268a4419594b4c4aec58dbeb6b58d2 (patch) | |
tree | 42e4e7b28adc166573ffef4c23dc03492fd981b4 /fs/ubifs/gc.c | |
parent | UBIFS: fix assertion warnings in comparison function (diff) | |
download | linux-3bb66b47a4268a4419594b4c4aec58dbeb6b58d2.tar.xz linux-3bb66b47a4268a4419594b4c4aec58dbeb6b58d2.zip |
UBIFS: introduce list sorting debugging checks
The UBIFS bug in the GC list sorting comparison functions inspired
me to write internal debugging check functions which verify that
the list of nodes is sorted properly.
So, this patch implements 2 new debugging functions:
o 'dbg_check_data_nodes_order()' - check order of data nodes list
o 'dbg_check_nondata_nodes_order()' - check order of non-data nodes list
The debugging functions are executed only if general UBIFS debugging checks are
enabled. And they are compiled out if UBIFS debugging is disabled.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/gc.c')
-rw-r--r-- | fs/ubifs/gc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 4fc31ca0e3b1..396f24a30af9 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -242,14 +242,13 @@ int nondata_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, struct list_head *nondata, int *min) { + int err; struct ubifs_scan_node *snod, *tmp; *min = INT_MAX; /* Separate data nodes and non-data nodes */ list_for_each_entry_safe(snod, tmp, &sleb->nodes, list) { - int err; - ubifs_assert(snod->type == UBIFS_INO_NODE || snod->type == UBIFS_DATA_NODE || snod->type == UBIFS_DENT_NODE || @@ -293,6 +292,13 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, /* Sort data and non-data nodes */ list_sort(c, &sleb->nodes, &data_nodes_cmp); list_sort(c, nondata, &nondata_nodes_cmp); + + err = dbg_check_data_nodes_order(c, &sleb->nodes); + if (err) + return err; + err = dbg_check_nondata_nodes_order(c, nondata); + if (err) + return err; return 0; } |