Lines Matching refs:block
28 unsigned int block, boot_record_count = 0; in find_boot_record() local
48 for (block = 0; block < nftl->nb_blocks; block++) { in find_boot_record()
53 ret = mtd_read(mtd, block * nftl->EraseSize, SECTORSIZE, in find_boot_record()
62 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); in find_boot_record()
73 block * nftl->EraseSize, nftl->mbd.mtd->index); in find_boot_record()
79 ret = nftl_read_oob(mtd, block * nftl->EraseSize + in find_boot_record()
84 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); in find_boot_record()
94 block * nftl->EraseSize, nftl->mbd.mtd->index, in find_boot_record()
100 ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE, in find_boot_record()
104 block * nftl->EraseSize, nftl->mbd.mtd->index, ret); in find_boot_record()
111 block * nftl->EraseSize, nftl->mbd.mtd->index); in find_boot_record()
123 nftl->MediaUnit * nftl->EraseSize, block * nftl->EraseSize); in find_boot_record()
132 nftl->SpareMediaUnit = block; in find_boot_record()
135 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in find_boot_record()
211 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in find_boot_record()
216 The new DiskOnChip driver already scanned the bad block table. Just query it. in find_boot_record()
220 block * nftl->EraseSize + i + in find_boot_record()
240 nftl->MediaUnit = block; in find_boot_record()
302 int NFTL_formatblock(struct NFTLrecord *nftl, int block) in NFTL_formatblock() argument
311 if (nftl_read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8, in NFTL_formatblock()
326 instr->addr = block * nftl->EraseSize; in NFTL_formatblock()
329 printk("Error while formatting block %d\n", block); in NFTL_formatblock()
349 if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE + in NFTL_formatblock()
372 unsigned int block, i, status; in check_sectors_in_chain() local
378 block = first_block; in check_sectors_in_chain()
382 block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
393 check_free_sectors(nftl, block * nftl->EraseSize + i * SECTORSIZE, in check_sectors_in_chain()
397 i, block); in check_sectors_in_chain()
402 nftl_write_oob(mtd, block * in check_sectors_in_chain()
414 block = nftl->ReplUnitTable[block]; in check_sectors_in_chain()
415 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in check_sectors_in_chain()
416 printk("incorrect ReplUnitTable[] : %d\n", block); in check_sectors_in_chain()
417 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in check_sectors_in_chain()
425 unsigned int length = 0, block = first_block; in calc_chain_length() local
436 block = nftl->ReplUnitTable[block]; in calc_chain_length()
437 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in calc_chain_length()
438 printk("incorrect ReplUnitTable[] : %d\n", block); in calc_chain_length()
439 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in calc_chain_length()
457 unsigned int block = first_block, block1; in format_chain() local
462 block1 = nftl->ReplUnitTable[block]; in format_chain()
464 printk("Formatting block %d\n", block); in format_chain()
465 if (NFTL_formatblock(nftl, block) < 0) { in format_chain()
467 nftl->ReplUnitTable[block] = BLOCK_RESERVED; in format_chain()
469 nftl->ReplUnitTable[block] = BLOCK_FREE; in format_chain()
473 block = block1; in format_chain()
475 if (!(block == BLOCK_NIL || block < nftl->nb_blocks)) in format_chain()
476 printk("incorrect ReplUnitTable[] : %d\n", block); in format_chain()
477 if (block == BLOCK_NIL || block >= nftl->nb_blocks) in format_chain()
488 static int check_and_mark_free_block(struct NFTLrecord *nftl, int block) in check_and_mark_free_block() argument
496 if (nftl_read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, in check_and_mark_free_block()
504 if (check_free_sectors (nftl, block * nftl->EraseSize, nftl->EraseSize, 1) != 0) in check_and_mark_free_block()
512 block * nftl->EraseSize + SECTORSIZE + 8, 8, in check_and_mark_free_block()
520 if (check_free_sectors (nftl, block * nftl->EraseSize + i, in check_and_mark_free_block()
524 if (nftl_read_oob(mtd, block * nftl->EraseSize + i, in check_and_mark_free_block()
549 static int get_fold_mark(struct NFTLrecord *nftl, unsigned int block) in get_fold_mark() argument
555 if (nftl_read_oob(mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8, in get_fold_mark()
566 unsigned int block, first_block, is_first_block; in NFTL_mount() local
589 block = first_block; in NFTL_mount()
596 block * s->EraseSize + 8, 8, in NFTL_mount()
599 block * s->EraseSize + in NFTL_mount()
602 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
618 if (check_and_mark_free_block(s, block) < 0) { in NFTL_mount()
620 printk("Formatting block %d\n", block); in NFTL_mount()
621 if (NFTL_formatblock(s, block) < 0) { in NFTL_mount()
623 s->ReplUnitTable[block] = BLOCK_RESERVED; in NFTL_mount()
625 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
629 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
637 block, first_block); in NFTL_mount()
638 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
655 block, logical_block, first_logical_block); in NFTL_mount()
664 if (get_fold_mark(s, block) != FOLD_MARK_IN_PROGRESS || in NFTL_mount()
667 block); in NFTL_mount()
673 block); in NFTL_mount()
680 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
684 block, rep_block); in NFTL_mount()
686 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
700 s->ReplUnitTable[block] = rep_block; in NFTL_mount()
704 block, rep_block); in NFTL_mount()
707 s->ReplUnitTable[block] = BLOCK_NIL; in NFTL_mount()
712 s->ReplUnitTable[block] = rep_block; in NFTL_mount()
713 block = rep_block; in NFTL_mount()
767 for (block = 0; block < s->nb_blocks; block++) { in NFTL_mount()
768 if (s->ReplUnitTable[block] == BLOCK_NOTEXPLORED) { in NFTL_mount()
769 printk("Unreferenced block %d, formatting it\n", block); in NFTL_mount()
770 if (NFTL_formatblock(s, block) < 0) in NFTL_mount()
771 s->ReplUnitTable[block] = BLOCK_RESERVED; in NFTL_mount()
773 s->ReplUnitTable[block] = BLOCK_FREE; in NFTL_mount()
775 if (s->ReplUnitTable[block] == BLOCK_FREE) { in NFTL_mount()
777 s->LastFreeEUN = block; in NFTL_mount()