• Home
  • Raw
  • Download

Lines Matching full:block

41 	unsigned int block, boot_record_count = 0;  in find_boot_record()  local
61 for (block = 0; block < nftl->nb_blocks; block++) { in find_boot_record()
66 ret = mtd_read(mtd, block * nftl->EraseSize, SECTORSIZE, in find_boot_record()
74 printk(KERN_WARNING "Block read at 0x%x of mtd%d failed: %d\n", in find_boot_record()
75 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); in find_boot_record()
77 printk(KERN_WARNING "Further failures for this block will not be printed\n"); in find_boot_record()
86 block * nftl->EraseSize, nftl->mbd.mtd->index); in find_boot_record()
92 ret = nftl_read_oob(mtd, block * nftl->EraseSize + in find_boot_record()
97 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); in find_boot_record()
107 block * nftl->EraseSize, nftl->mbd.mtd->index, in find_boot_record()
113 ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE, in find_boot_record()
117 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); in find_boot_record()
124 block * nftl->EraseSize, nftl->mbd.mtd->index); in find_boot_record()
136 nftl->MediaUnit * nftl->EraseSize, block * nftl->EraseSize); in find_boot_record()
145 nftl->SpareMediaUnit = block; in find_boot_record()
147 /* Mark this boot record (NFTL MediaHeader) block as reserved */ in find_boot_record()
148 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in find_boot_record()
226 /* Mark this boot record (NFTL MediaHeader) block as reserved */ in find_boot_record()
227 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in find_boot_record()
232 The new DiskOnChip driver already scanned the bad block table. Just query it. in find_boot_record()
236 block * nftl->EraseSize + i + in find_boot_record()
256 nftl->MediaUnit = block; in find_boot_record()
259 } /* foreach (block) */ in find_boot_record()
318 int NFTL_formatblock(struct NFTLrecord *nftl, int block) in NFTL_formatblock() argument
327 if (nftl_read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8, in NFTL_formatblock()
342 instr->addr = block * nftl->EraseSize; in NFTL_formatblock()
345 printk("Error while formatting block %d\n", block); in NFTL_formatblock()
353 /* wrap (almost impossible with current flash) or free block */ in NFTL_formatblock()
364 if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE + in NFTL_formatblock()
369 /* could not format, update the bad block table (caller is responsible in NFTL_formatblock()
380 * situation that after writing the Data area, the Block Control Information is
381 * not updated according (due to power failure or something) which leaves the block
382 * in an inconsistent state. So we have to check if a block is really FREE in this
387 unsigned int block, i, status; in check_sectors_in_chain() local
393 block = first_block; in check_sectors_in_chain()
397 block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
408 check_free_sectors(nftl, block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
410 printk("Incorrect free sector %d in block %d: " in check_sectors_in_chain()
412 i, block); in check_sectors_in_chain()
417 nftl_write_oob(mtd, block * in check_sectors_in_chain()
429 block = nftl->ReplUnitTable[block]; in check_sectors_in_chain()
430 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in check_sectors_in_chain()
431 printk("incorrect ReplUnitTable[] : %d\n", block); in check_sectors_in_chain()
432 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in check_sectors_in_chain()
440 unsigned int length = 0, block = first_block; in calc_chain_length() local
451 block = nftl->ReplUnitTable[block]; in calc_chain_length()
452 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in calc_chain_length()
453 printk("incorrect ReplUnitTable[] : %d\n", block); in calc_chain_length()
454 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in calc_chain_length()
463 * It is not strictly correct to begin from the first block of the chain because
465 * flag in a block inside it. But is it really a problem ?
472 unsigned int block = first_block, block1; in format_chain() local
474 printk("Formatting chain at block %d\n", first_block); in format_chain()
477 block1 = nftl->ReplUnitTable[block]; in format_chain()
479 printk("Formatting block %d\n", block); in format_chain()
480 if (NFTL_formatblock(nftl, block) < 0) { in format_chain()
482 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in format_chain()
484 nftl->ReplUnitTable[block] = BLOCK_FREE; in format_chain()
487 /* goto next block on the chain */ in format_chain()
488 block = block1; in format_chain()
490 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in format_chain()
491 printk("incorrect ReplUnitTable[] : %d\n", block); in format_chain()
492 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in format_chain()
497 /* check_and_mark_free_block: Verify that a block is free in the NFTL sense (valid erase mark) or
503 static int check_and_mark_free_block(struct NFTLrecord *nftl, int block) in check_and_mark_free_block() argument
511 if (nftl_read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, in check_and_mark_free_block()
517 /* if no erase mark, the block must be totally free. This is in check_and_mark_free_block()
519 if (check_free_sectors (nftl, block * nftl->EraseSize, nftl->EraseSize, 1) != 0) in check_and_mark_free_block()
522 /* free block : write erase mark */ in check_and_mark_free_block()
527 block * nftl->EraseSize + SECTORSIZE + 8, 8, in check_and_mark_free_block()
535 if (check_free_sectors (nftl, block * nftl->EraseSize + i, in check_and_mark_free_block()
539 if (nftl_read_oob(mtd, block * nftl->EraseSize + i, in check_and_mark_free_block()
564 static int get_fold_mark(struct NFTLrecord *nftl, unsigned int block) in get_fold_mark() argument
570 if (nftl_read_oob(mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8, in get_fold_mark()
581 unsigned int block, first_block, is_first_block; in NFTL_mount() local
599 /* first pass : explore each block chain */ in NFTL_mount()
602 /* if the block was not already explored, we can look at it */ in NFTL_mount()
604 block = first_block; in NFTL_mount()
609 /* read the block header. If error, we format the chain */ in NFTL_mount()
611 block * s->EraseSize + 8, 8, in NFTL_mount()
614 block * s->EraseSize + in NFTL_mount()
617 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
629 /* invalid/free block test */ in NFTL_mount()
633 if (check_and_mark_free_block(s, block) < 0) { in NFTL_mount()
635 printk("Formatting block %d\n", block); in NFTL_mount()
636 if (NFTL_formatblock(s, block) < 0) { in NFTL_mount()
637 /* could not format: reserve the block */ in NFTL_mount()
638 s->ReplUnitTable[block] = BLOCK_RESERVED; in NFTL_mount()
640 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
643 /* free block: mark it */ in NFTL_mount()
644 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
646 /* directly examine the next block. */ in NFTL_mount()
649 /* the block was in a chain : this is bad. We in NFTL_mount()
651 printk("Block %d: free but referenced in chain %d\n", in NFTL_mount()
652 block, first_block); in NFTL_mount()
653 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
661 /* this block is not the first block in chain : in NFTL_mount()
669 printk("Block %d: incorrect logical block: %d expected: %d\n", in NFTL_mount()
670 block, logical_block, first_logical_block); in NFTL_mount()
676 /* we accept that a block is marked as first in NFTL_mount()
677 block while being last block in a chain in NFTL_mount()
679 if (get_fold_mark(s, block) != FOLD_MARK_IN_PROGRESS || in NFTL_mount()
681 printk("Block %d: incorrectly marked as first block in chain\n", in NFTL_mount()
682 block); in NFTL_mount()
687 printk("Block %d: folding in progress - ignoring first block flag\n", in NFTL_mount()
688 block); in NFTL_mount()
695 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
698 printk("Block %d: referencing invalid block %d\n", in NFTL_mount()
699 block, rep_block); in NFTL_mount()
701 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
705 we accept that the last block of a chain has in NFTL_mount()
708 last block appeared first */ in NFTL_mount()
713 printk("Block %d: folding in progress - ignoring first block flag\n", in NFTL_mount()
715 s->ReplUnitTable[block] = rep_block; in NFTL_mount()
718 printk("Block %d: referencing block %d already in another chain\n", in NFTL_mount()
719 block, rep_block); in NFTL_mount()
722 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
727 s->ReplUnitTable[block] = rep_block; in NFTL_mount()
728 block = rep_block; in NFTL_mount()
745 printk("Could read foldmark at block %d\n", first_block); in NFTL_mount()
778 /* second pass to format unreferenced blocks and init free block count */ in NFTL_mount()
782 for (block = 0; block < s->nb_blocks; block++) { in NFTL_mount()
783 if (s->ReplUnitTable[block] == BLOCK_NOTEXPLORED) { in NFTL_mount()
784 printk("Unreferenced block %d, formatting it\n", block); in NFTL_mount()
785 if (NFTL_formatblock(s, block) < 0) in NFTL_mount()
786 s->ReplUnitTable[block] = BLOCK_RESERVED; in NFTL_mount()
788 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
790 if (s->ReplUnitTable[block] == BLOCK_FREE) { in NFTL_mount()
792 s->LastFreeEUN = block; in NFTL_mount()