Lines Matching refs:block

28 	unsigned int block, boot_record_count = 0;
48 for (block = 0; block < nftl->nb_blocks; block++) {
53 ret = mtd_read(mtd, block * nftl->EraseSize, SECTORSIZE,
62 block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
64 printk(KERN_WARNING "Further failures for this block will not be printed\n");
73 block * nftl->EraseSize, nftl->mbd.mtd->index);
79 ret = nftl_read_oob(mtd, block * nftl->EraseSize +
84 block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
94 block * nftl->EraseSize, nftl->mbd.mtd->index,
100 ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
104 block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
111 block * nftl->EraseSize, nftl->mbd.mtd->index);
123 nftl->MediaUnit * nftl->EraseSize, block * nftl->EraseSize);
132 nftl->SpareMediaUnit = block;
134 /* Mark this boot record (NFTL MediaHeader) block as reserved */
135 nftl->ReplUnitTable[block] = BLOCK_RESERVED;
210 /* Mark this boot record (NFTL MediaHeader) block as reserved */
211 nftl->ReplUnitTable[block] = BLOCK_RESERVED;
216 The new DiskOnChip driver already scanned the bad block table. Just query it.
220 block * nftl->EraseSize + i +
240 nftl->MediaUnit = block;
243 } /* foreach (block) */
302 int NFTL_formatblock(struct NFTLrecord *nftl, int block)
311 if (nftl_read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8,
326 instr->addr = block * nftl->EraseSize;
329 printk("Error while formatting block %d\n", block);
337 /* wrap (almost impossible with current flash) or free block */
349 if (nftl_write_oob(mtd, block * nftl->EraseSize + SECTORSIZE +
354 /* could not format, update the bad block table (caller is responsible
366 * not updated according (due to power failure or something) which leaves the block
367 * in an inconsistent state. So we have to check if a block is really FREE in this
372 unsigned int block, i, status;
378 block = first_block;
382 block * nftl->EraseSize + i * SECTORSIZE,
393 check_free_sectors(nftl, block * nftl->EraseSize + i * SECTORSIZE,
395 printk("Incorrect free sector %d in block %d: "
397 i, block);
402 nftl_write_oob(mtd, block *
414 block = nftl->ReplUnitTable[block];
415 if (!(block == BLOCK_NIL || block < nftl->nb_blocks))
416 printk("incorrect ReplUnitTable[] : %d\n", block);
417 if (block == BLOCK_NIL || block >= nftl->nb_blocks)
425 unsigned int length = 0, block = first_block;
436 block = nftl->ReplUnitTable[block];
437 if (!(block == BLOCK_NIL || block < nftl->nb_blocks))
438 printk("incorrect ReplUnitTable[] : %d\n", block);
439 if (block == BLOCK_NIL || block >= nftl->nb_blocks)
448 * It is not strictly correct to begin from the first block of the chain because
450 * flag in a block inside it. But is it really a problem ?
457 unsigned int block = first_block, block1;
459 printk("Formatting chain at block %d\n", first_block);
462 block1 = nftl->ReplUnitTable[block];
464 printk("Formatting block %d\n", block);
465 if (NFTL_formatblock(nftl, block) < 0) {
467 nftl->ReplUnitTable[block] = BLOCK_RESERVED;
469 nftl->ReplUnitTable[block] = BLOCK_FREE;
472 /* goto next block on the chain */
473 block = block1;
475 if (!(block == BLOCK_NIL || block < nftl->nb_blocks))
476 printk("incorrect ReplUnitTable[] : %d\n", block);
477 if (block == BLOCK_NIL || block >= nftl->nb_blocks)
482 /* check_and_mark_free_block: Verify that a block is free in the NFTL sense (valid erase mark) or
488 static int check_and_mark_free_block(struct NFTLrecord *nftl, int block)
496 if (nftl_read_oob(mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8,
502 /* if no erase mark, the block must be totally free. This is
504 if (check_free_sectors (nftl, block * nftl->EraseSize, nftl->EraseSize, 1) != 0)
507 /* free block : write erase mark */
512 block * nftl->EraseSize + SECTORSIZE + 8, 8,
520 if (check_free_sectors (nftl, block * nftl->EraseSize + i,
524 if (nftl_read_oob(mtd, block * nftl->EraseSize + i,
549 static int get_fold_mark(struct NFTLrecord *nftl, unsigned int block)
555 if (nftl_read_oob(mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8,
566 unsigned int block, first_block, is_first_block;
584 /* first pass : explore each block chain */
587 /* if the block was not already explored, we can look at it */
589 block = first_block;
594 /* read the block header. If error, we format the chain */
596 block * s->EraseSize + 8, 8,
599 block * s->EraseSize +
602 s->ReplUnitTable[block] = BLOCK_NIL;
614 /* invalid/free block test */
618 if (check_and_mark_free_block(s, block) < 0) {
620 printk("Formatting block %d\n", block);
621 if (NFTL_formatblock(s, block) < 0) {
622 /* could not format: reserve the block */
623 s->ReplUnitTable[block] = BLOCK_RESERVED;
625 s->ReplUnitTable[block] = BLOCK_FREE;
628 /* free block: mark it */
629 s->ReplUnitTable[block] = BLOCK_FREE;
631 /* directly examine the next block. */
634 /* the block was in a chain : this is bad. We
637 block, first_block);
638 s->ReplUnitTable[block] = BLOCK_NIL;
646 /* this block is not the first block in chain :
654 printk("Block %d: incorrect logical block: %d expected: %d\n",
655 block, logical_block, first_logical_block);
661 /* we accept that a block is marked as first
662 block while being last block in a chain
664 if (get_fold_mark(s, block) != FOLD_MARK_IN_PROGRESS ||
666 printk("Block %d: incorrectly marked as first block in chain\n",
667 block);
672 printk("Block %d: folding in progress - ignoring first block flag\n",
673 block);
680 s->ReplUnitTable[block] = BLOCK_NIL;
683 printk("Block %d: referencing invalid block %d\n",
684 block, rep_block);
686 s->ReplUnitTable[block] = BLOCK_NIL;
690 we accept that the last block of a chain has
693 last block appeared first */
698 printk("Block %d: folding in progress - ignoring first block flag\n",
700 s->ReplUnitTable[block] = rep_block;
703 printk("Block %d: referencing block %d already in another chain\n",
704 block, rep_block);
707 s->ReplUnitTable[block] = BLOCK_NIL;
712 s->ReplUnitTable[block] = rep_block;
713 block = rep_block;
730 printk("Could read foldmark at block %d\n", first_block);
763 /* second pass to format unreferenced blocks and init free block count */
767 for (block = 0; block < s->nb_blocks; block++) {
768 if (s->ReplUnitTable[block] == BLOCK_NOTEXPLORED) {
769 printk("Unreferenced block %d, formatting it\n", block);
770 if (NFTL_formatblock(s, block) < 0)
771 s->ReplUnitTable[block] = BLOCK_RESERVED;
773 s->ReplUnitTable[block] = BLOCK_FREE;
775 if (s->ReplUnitTable[block] == BLOCK_FREE) {
777 s->LastFreeEUN = block;