Lines Matching refs:block
54 unsigned int block, boot_record_count = 0; in find_boot_record() local
69 for (block = 0; block < nftl->nb_blocks; block++) { in find_boot_record()
74 if ((ret = MTD_READ(nftl->mtd, block * nftl->EraseSize, SECTORSIZE, &retlen, buf))) { in find_boot_record()
79 block * nftl->EraseSize, nftl->mtd->index, ret); in find_boot_record()
90 block * nftl->EraseSize, nftl->mtd->index); in find_boot_record()
96 if ((ret = MTD_READOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, in find_boot_record()
99 block * nftl->EraseSize, nftl->mtd->index, ret); in find_boot_record()
109 block * nftl->EraseSize, nftl->mtd->index, in find_boot_record()
115 if ((ret = MTD_READECC(nftl->mtd, block * nftl->EraseSize, SECTORSIZE, in find_boot_record()
118 block * nftl->EraseSize, nftl->mtd->index, ret); in find_boot_record()
125 block * nftl->EraseSize, nftl->mtd->index); in find_boot_record()
138 nftl->MediaUnit * nftl->EraseSize, block * nftl->EraseSize); in find_boot_record()
143 nftl->SpareMediaUnit = block; in find_boot_record()
146 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in find_boot_record()
217 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in find_boot_record()
223 if ((ret = MTD_READECC(nftl->mtd, block * nftl->EraseSize + in find_boot_record()
238 nftl->MediaUnit = block; in find_boot_record()
292 int NFTL_formatblock(struct NFTLrecord *nftl, int block) in NFTL_formatblock() argument
300 if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, in NFTL_formatblock()
315 instr->addr = block * nftl->EraseSize; in NFTL_formatblock()
322 printk("Error while formatting block %d\n", block); in NFTL_formatblock()
340 if (MTD_WRITEOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, in NFTL_formatblock()
358 unsigned int block, i, status; in check_sectors_in_chain() local
363 block = first_block; in check_sectors_in_chain()
366 if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
377 check_free_sectors(nftl, block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
381 i, block); in check_sectors_in_chain()
387 block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
397 block = nftl->ReplUnitTable[block]; in check_sectors_in_chain()
398 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in check_sectors_in_chain()
399 printk("incorrect ReplUnitTable[] : %d\n", block); in check_sectors_in_chain()
400 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in check_sectors_in_chain()
408 unsigned int length = 0, block = first_block; in calc_chain_length() local
419 block = nftl->ReplUnitTable[block]; in calc_chain_length()
420 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in calc_chain_length()
421 printk("incorrect ReplUnitTable[] : %d\n", block); in calc_chain_length()
422 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in calc_chain_length()
440 unsigned int block = first_block, block1; in format_chain() local
445 block1 = nftl->ReplUnitTable[block]; in format_chain()
447 printk("Formatting block %d\n", block); in format_chain()
448 if (NFTL_formatblock(nftl, block) < 0) { in format_chain()
451 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in format_chain()
453 nftl->ReplUnitTable[block] = BLOCK_FREE; in format_chain()
457 block = block1; in format_chain()
459 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in format_chain()
460 printk("incorrect ReplUnitTable[] : %d\n", block); in format_chain()
461 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in format_chain()
472 static int check_and_mark_free_block(struct NFTLrecord *nftl, int block) in check_and_mark_free_block() argument
479 if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, in check_and_mark_free_block()
487 if (check_free_sectors (nftl, block * nftl->EraseSize, nftl->EraseSize, 1) != 0) in check_and_mark_free_block()
494 if (MTD_WRITEOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, in check_and_mark_free_block()
502 if (check_free_sectors (nftl, block * nftl->EraseSize + i, in check_and_mark_free_block()
506 if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + i, in check_and_mark_free_block()
531 static int get_fold_mark(struct NFTLrecord *nftl, unsigned int block) in get_fold_mark() argument
536 if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8, in get_fold_mark()
547 unsigned int block, first_block, is_first_block; in NFTL_mount() local
569 block = first_block; in NFTL_mount()
575 if (MTD_READOOB(s->mtd, block * s->EraseSize + 8, 8, in NFTL_mount()
577 MTD_READOOB(s->mtd, block * s->EraseSize + SECTORSIZE + 8, 8, in NFTL_mount()
579 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
596 if (check_and_mark_free_block(s, block) < 0) { in NFTL_mount()
598 printk("Formatting block %d\n", block); in NFTL_mount()
599 if (NFTL_formatblock(s, block) < 0) { in NFTL_mount()
601 s->ReplUnitTable[block] = BLOCK_RESERVED; in NFTL_mount()
603 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
607 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
615 block, first_block); in NFTL_mount()
616 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
633 block, logical_block, first_logical_block); in NFTL_mount()
642 if (get_fold_mark(s, block) != FOLD_MARK_IN_PROGRESS || in NFTL_mount()
645 block); in NFTL_mount()
651 block); in NFTL_mount()
658 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
662 block, rep_block); in NFTL_mount()
664 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
678 s->ReplUnitTable[block] = rep_block; in NFTL_mount()
682 block, rep_block); in NFTL_mount()
685 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
690 s->ReplUnitTable[block] = rep_block; in NFTL_mount()
691 block = rep_block; in NFTL_mount()
745 for (block = 0; block < s->nb_blocks; block++) { in NFTL_mount()
746 if (s->ReplUnitTable[block] == BLOCK_NOTEXPLORED) { in NFTL_mount()
747 printk("Unreferenced block %d, formatting it\n", block); in NFTL_mount()
748 if (NFTL_formatblock(s, block) < 0) in NFTL_mount()
749 s->ReplUnitTable[block] = BLOCK_RESERVED; in NFTL_mount()
751 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
753 if (s->ReplUnitTable[block] == BLOCK_FREE) { in NFTL_mount()
755 s->LastFreeEUN = block; in NFTL_mount()