aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nftlmount.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nftlmount.c')
-rw-r--r--drivers/mtd/nftlmount.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c
index e3cd1ffad2f6..ac4092591aea 100644
--- a/drivers/mtd/nftlmount.c
+++ b/drivers/mtd/nftlmount.c
@@ -32,7 +32,7 @@
32 32
33/* find_boot_record: Find the NFTL Media Header and its Spare copy which contains the 33/* find_boot_record: Find the NFTL Media Header and its Spare copy which contains the
34 * various device information of the NFTL partition and Bad Unit Table. Update 34 * various device information of the NFTL partition and Bad Unit Table. Update
35 * the ReplUnitTable[] table accroding to the Bad Unit Table. ReplUnitTable[] 35 * the ReplUnitTable[] table according to the Bad Unit Table. ReplUnitTable[]
36 * is used for management of Erase Unit in other routines in nftl.c and nftlmount.c 36 * is used for management of Erase Unit in other routines in nftl.c and nftlmount.c
37 */ 37 */
38static int find_boot_record(struct NFTLrecord *nftl) 38static int find_boot_record(struct NFTLrecord *nftl)
@@ -297,7 +297,7 @@ static int check_free_sectors(struct NFTLrecord *nftl, unsigned int address, int
297 * 297 *
298 * Return: 0 when succeed, -1 on error. 298 * Return: 0 when succeed, -1 on error.
299 * 299 *
300 * ToDo: 1. Is it neceressary to check_free_sector after erasing ?? 300 * ToDo: 1. Is it necessary to check_free_sector after erasing ??
301 */ 301 */
302int NFTL_formatblock(struct NFTLrecord *nftl, int block) 302int NFTL_formatblock(struct NFTLrecord *nftl, int block)
303{ 303{
@@ -337,7 +337,7 @@ int NFTL_formatblock(struct NFTLrecord *nftl, int block)
337 nb_erases = le32_to_cpu(uci.WearInfo); 337 nb_erases = le32_to_cpu(uci.WearInfo);
338 nb_erases++; 338 nb_erases++;
339 339
340 /* wrap (almost impossible with current flashs) or free block */ 340 /* wrap (almost impossible with current flash) or free block */
341 if (nb_erases == 0) 341 if (nb_erases == 0)
342 nb_erases = 1; 342 nb_erases = 1;
343 343
@@ -363,10 +363,10 @@ fail:
363 * Mark as 'IGNORE' each incorrect sector. This check is only done if the chain 363 * Mark as 'IGNORE' each incorrect sector. This check is only done if the chain
364 * was being folded when NFTL was interrupted. 364 * was being folded when NFTL was interrupted.
365 * 365 *
366 * The check_free_sectors in this function is neceressary. There is a possible 366 * The check_free_sectors in this function is necessary. There is a possible
367 * situation that after writing the Data area, the Block Control Information is 367 * situation that after writing the Data area, the Block Control Information is
368 * not updated according (due to power failure or something) which leaves the block 368 * not updated according (due to power failure or something) which leaves the block
369 * in an umconsistent state. So we have to check if a block is really FREE in this 369 * in an inconsistent state. So we have to check if a block is really FREE in this
370 * case. */ 370 * case. */
371static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_block) 371static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_block)
372{ 372{
@@ -428,7 +428,7 @@ static int calc_chain_length(struct NFTLrecord *nftl, unsigned int first_block)
428 428
429 for (;;) { 429 for (;;) {
430 length++; 430 length++;
431 /* avoid infinite loops, although this is guaranted not to 431 /* avoid infinite loops, although this is guaranteed not to
432 happen because of the previous checks */ 432 happen because of the previous checks */
433 if (length >= nftl->nb_blocks) { 433 if (length >= nftl->nb_blocks) {
434 printk("nftl: length too long %d !\n", length); 434 printk("nftl: length too long %d !\n", length);
@@ -447,11 +447,11 @@ static int calc_chain_length(struct NFTLrecord *nftl, unsigned int first_block)
447/* format_chain: Format an invalid Virtual Unit chain. It frees all the Erase Units in a 447/* format_chain: Format an invalid Virtual Unit chain. It frees all the Erase Units in a
448 * Virtual Unit Chain, i.e. all the units are disconnected. 448 * Virtual Unit Chain, i.e. all the units are disconnected.
449 * 449 *
450 * It is not stricly correct to begin from the first block of the chain because 450 * It is not strictly correct to begin from the first block of the chain because
451 * if we stop the code, we may see again a valid chain if there was a first_block 451 * if we stop the code, we may see again a valid chain if there was a first_block
452 * flag in a block inside it. But is it really a problem ? 452 * flag in a block inside it. But is it really a problem ?
453 * 453 *
454 * FixMe: Figure out what the last statesment means. What if power failure when we are 454 * FixMe: Figure out what the last statement means. What if power failure when we are
455 * in the for (;;) loop formatting blocks ?? 455 * in the for (;;) loop formatting blocks ??
456 */ 456 */
457static void format_chain(struct NFTLrecord *nftl, unsigned int first_block) 457static void format_chain(struct NFTLrecord *nftl, unsigned int first_block)
@@ -485,7 +485,7 @@ static void format_chain(struct NFTLrecord *nftl, unsigned int first_block)
485 * totally free (only 0xff). 485 * totally free (only 0xff).
486 * 486 *
487 * Definition: Free Erase Unit -- A properly erased/formatted Free Erase Unit should have meet the 487 * Definition: Free Erase Unit -- A properly erased/formatted Free Erase Unit should have meet the
488 * following critia: 488 * following criteria:
489 * 1. */ 489 * 1. */
490static int check_and_mark_free_block(struct NFTLrecord *nftl, int block) 490static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
491{ 491{
@@ -502,7 +502,7 @@ static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
502 erase_mark = le16_to_cpu ((h1.EraseMark | h1.EraseMark1)); 502 erase_mark = le16_to_cpu ((h1.EraseMark | h1.EraseMark1));
503 if (erase_mark != ERASE_MARK) { 503 if (erase_mark != ERASE_MARK) {
504 /* if no erase mark, the block must be totally free. This is 504 /* if no erase mark, the block must be totally free. This is
505 possible in two cases : empty filsystem or interrupted erase (very unlikely) */ 505 possible in two cases : empty filesystem or interrupted erase (very unlikely) */
506 if (check_free_sectors (nftl, block * nftl->EraseSize, nftl->EraseSize, 1) != 0) 506 if (check_free_sectors (nftl, block * nftl->EraseSize, nftl->EraseSize, 1) != 0)
507 return -1; 507 return -1;
508 508
@@ -544,7 +544,7 @@ static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
544/* get_fold_mark: Read fold mark from Unit Control Information #2, we use FOLD_MARK_IN_PROGRESS 544/* get_fold_mark: Read fold mark from Unit Control Information #2, we use FOLD_MARK_IN_PROGRESS
545 * to indicate that we are in the progression of a Virtual Unit Chain folding. If the UCI #2 545 * to indicate that we are in the progression of a Virtual Unit Chain folding. If the UCI #2
546 * is FOLD_MARK_IN_PROGRESS when mounting the NFTL, the (previous) folding process is interrupted 546 * is FOLD_MARK_IN_PROGRESS when mounting the NFTL, the (previous) folding process is interrupted
547 * for some reason. A clean up/check of the VUC is neceressary in this case. 547 * for some reason. A clean up/check of the VUC is necessary in this case.
548 * 548 *
549 * WARNING: return 0 if read error 549 * WARNING: return 0 if read error
550 */ 550 */
@@ -657,7 +657,7 @@ int NFTL_mount(struct NFTLrecord *s)
657 printk("Block %d: incorrect logical block: %d expected: %d\n", 657 printk("Block %d: incorrect logical block: %d expected: %d\n",
658 block, logical_block, first_logical_block); 658 block, logical_block, first_logical_block);
659 /* the chain is incorrect : we must format it, 659 /* the chain is incorrect : we must format it,
660 but we need to read it completly */ 660 but we need to read it completely */
661 do_format_chain = 1; 661 do_format_chain = 1;
662 } 662 }
663 if (is_first_block) { 663 if (is_first_block) {
@@ -669,7 +669,7 @@ int NFTL_mount(struct NFTLrecord *s)
669 printk("Block %d: incorrectly marked as first block in chain\n", 669 printk("Block %d: incorrectly marked as first block in chain\n",
670 block); 670 block);
671 /* the chain is incorrect : we must format it, 671 /* the chain is incorrect : we must format it,
672 but we need to read it completly */ 672 but we need to read it completely */
673 do_format_chain = 1; 673 do_format_chain = 1;
674 } else { 674 } else {
675 printk("Block %d: folding in progress - ignoring first block flag\n", 675 printk("Block %d: folding in progress - ignoring first block flag\n",