diff options
author | Richard Weinberger <richard@nod.at> | 2014-09-22 05:44:50 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-03-26 17:46:03 -0400 |
commit | 5fa7fa5dad0cf8f2b47bb8dca91c605c48d282f6 (patch) | |
tree | 1781c7666647ede6e57e8c631b6f1af3ed8361e3 /drivers/mtd | |
parent | 5ca97ad83800938e8aeea622821a26d69d2052bf (diff) |
UBI: Add initial support for fastmap self checks
Using this debugfs knob fastmap self checks can be controlled.
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Tanya Brokhman <tlinder@codeaurora.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/debug.c | 11 | ||||
-rw-r--r-- | drivers/mtd/ubi/debug.h | 5 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index 7335c9ff9d99..224fed085102 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -275,6 +275,8 @@ static ssize_t dfs_file_read(struct file *file, char __user *user_buf, | |||
275 | val = d->chk_gen; | 275 | val = d->chk_gen; |
276 | else if (dent == d->dfs_chk_io) | 276 | else if (dent == d->dfs_chk_io) |
277 | val = d->chk_io; | 277 | val = d->chk_io; |
278 | else if (dent == d->dfs_chk_fastmap) | ||
279 | val = d->chk_fastmap; | ||
278 | else if (dent == d->dfs_disable_bgt) | 280 | else if (dent == d->dfs_disable_bgt) |
279 | val = d->disable_bgt; | 281 | val = d->disable_bgt; |
280 | else if (dent == d->dfs_emulate_bitflips) | 282 | else if (dent == d->dfs_emulate_bitflips) |
@@ -336,6 +338,8 @@ static ssize_t dfs_file_write(struct file *file, const char __user *user_buf, | |||
336 | d->chk_gen = val; | 338 | d->chk_gen = val; |
337 | else if (dent == d->dfs_chk_io) | 339 | else if (dent == d->dfs_chk_io) |
338 | d->chk_io = val; | 340 | d->chk_io = val; |
341 | else if (dent == d->dfs_chk_fastmap) | ||
342 | d->chk_fastmap = val; | ||
339 | else if (dent == d->dfs_disable_bgt) | 343 | else if (dent == d->dfs_disable_bgt) |
340 | d->disable_bgt = val; | 344 | d->disable_bgt = val; |
341 | else if (dent == d->dfs_emulate_bitflips) | 345 | else if (dent == d->dfs_emulate_bitflips) |
@@ -406,6 +410,13 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi) | |||
406 | goto out_remove; | 410 | goto out_remove; |
407 | d->dfs_chk_io = dent; | 411 | d->dfs_chk_io = dent; |
408 | 412 | ||
413 | fname = "chk_fastmap"; | ||
414 | dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, | ||
415 | &dfs_fops); | ||
416 | if (IS_ERR_OR_NULL(dent)) | ||
417 | goto out_remove; | ||
418 | d->dfs_chk_fastmap = dent; | ||
419 | |||
409 | fname = "tst_disable_bgt"; | 420 | fname = "tst_disable_bgt"; |
410 | dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, | 421 | dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, (void *)ubi_num, |
411 | &dfs_fops); | 422 | &dfs_fops); |
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index cba89fcd1587..e99ef37a321e 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -127,4 +127,9 @@ static inline int ubi_dbg_chk_gen(const struct ubi_device *ubi) | |||
127 | { | 127 | { |
128 | return ubi->dbg.chk_gen; | 128 | return ubi->dbg.chk_gen; |
129 | } | 129 | } |
130 | |||
131 | static inline int ubi_dbg_chk_fastmap(const struct ubi_device *ubi) | ||
132 | { | ||
133 | return ubi->dbg.chk_fastmap; | ||
134 | } | ||
130 | #endif /* !__UBI_DEBUG_H__ */ | 135 | #endif /* !__UBI_DEBUG_H__ */ |
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 058c84cac8dc..adc633cb89c3 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -356,6 +356,7 @@ struct ubi_wl_entry; | |||
356 | * | 356 | * |
357 | * @chk_gen: if UBI general extra checks are enabled | 357 | * @chk_gen: if UBI general extra checks are enabled |
358 | * @chk_io: if UBI I/O extra checks are enabled | 358 | * @chk_io: if UBI I/O extra checks are enabled |
359 | * @chk_fastmap: if UBI fastmap extra checks are enabled | ||
359 | * @disable_bgt: disable the background task for testing purposes | 360 | * @disable_bgt: disable the background task for testing purposes |
360 | * @emulate_bitflips: emulate bit-flips for testing purposes | 361 | * @emulate_bitflips: emulate bit-flips for testing purposes |
361 | * @emulate_io_failures: emulate write/erase failures for testing purposes | 362 | * @emulate_io_failures: emulate write/erase failures for testing purposes |
@@ -363,6 +364,7 @@ struct ubi_wl_entry; | |||
363 | * @dfs_dir: direntry object of the UBI device debugfs directory | 364 | * @dfs_dir: direntry object of the UBI device debugfs directory |
364 | * @dfs_chk_gen: debugfs knob to enable UBI general extra checks | 365 | * @dfs_chk_gen: debugfs knob to enable UBI general extra checks |
365 | * @dfs_chk_io: debugfs knob to enable UBI I/O extra checks | 366 | * @dfs_chk_io: debugfs knob to enable UBI I/O extra checks |
367 | * @dfs_chk_fastmap: debugfs knob to enable UBI fastmap extra checks | ||
366 | * @dfs_disable_bgt: debugfs knob to disable the background task | 368 | * @dfs_disable_bgt: debugfs knob to disable the background task |
367 | * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips | 369 | * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips |
368 | * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures | 370 | * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures |
@@ -370,6 +372,7 @@ struct ubi_wl_entry; | |||
370 | struct ubi_debug_info { | 372 | struct ubi_debug_info { |
371 | unsigned int chk_gen:1; | 373 | unsigned int chk_gen:1; |
372 | unsigned int chk_io:1; | 374 | unsigned int chk_io:1; |
375 | unsigned int chk_fastmap:1; | ||
373 | unsigned int disable_bgt:1; | 376 | unsigned int disable_bgt:1; |
374 | unsigned int emulate_bitflips:1; | 377 | unsigned int emulate_bitflips:1; |
375 | unsigned int emulate_io_failures:1; | 378 | unsigned int emulate_io_failures:1; |
@@ -377,6 +380,7 @@ struct ubi_debug_info { | |||
377 | struct dentry *dfs_dir; | 380 | struct dentry *dfs_dir; |
378 | struct dentry *dfs_chk_gen; | 381 | struct dentry *dfs_chk_gen; |
379 | struct dentry *dfs_chk_io; | 382 | struct dentry *dfs_chk_io; |
383 | struct dentry *dfs_chk_fastmap; | ||
380 | struct dentry *dfs_disable_bgt; | 384 | struct dentry *dfs_disable_bgt; |
381 | struct dentry *dfs_emulate_bitflips; | 385 | struct dentry *dfs_emulate_bitflips; |
382 | struct dentry *dfs_emulate_io_failures; | 386 | struct dentry *dfs_emulate_io_failures; |