Lines Matching defs:block
28 /* maximum number of loops while examining next block, to have a
192 /* For a given Virtual Unit Chain: find or create a free block and
205 /* Scan for a free block */
238 int block;
257 512-byte block within the Chain.
265 for (block = 0; block < nftl->EraseSize / 512; block ++) {
267 (block * 512), 16 , &retlen,
269 if (block == 2) {
282 BlockLastState[block] = status;
286 BlockFreeFound[block] = 1;
290 if (!BlockFreeFound[block])
291 BlockMap[block] = thisEUN;
295 "in Virtual Unit Chain %d for block %d\n",
296 thisVUC, block);
299 if (!BlockFreeFound[block])
300 BlockMap[block] = BLOCK_NIL;
304 "in Virtual Unit Chain %d for block %d\n",
305 thisVUC, block);
311 printk("Unknown status for block %d in EUN %d: %x\n",
312 block, thisEUN, status);
328 with them (i.e. BlockMap[block] != BLOCK_NIL) are
330 block. If not, we're going to have to fold out-of-place
333 for (block = 0; block < nftl->EraseSize / 512 ; block++) {
334 if (BlockLastState[block] != SECTOR_FREE &&
335 BlockMap[block] != BLOCK_NIL &&
336 BlockMap[block] != targetEUN) {
338 "block %d was %x lastEUN, "
340 thisVUC, block, BlockLastState[block],
341 BlockMap[block],
342 BlockMap[block]== targetEUN ? "==" : "!=",
386 /* OK. We now know the location of every block in the Virtual Unit Chain,
391 for (block = 0; block < nftl->EraseSize / 512 ; block++) {
396 if (BlockMap[block] == targetEUN ||
397 (pendingblock == (thisVUC * (nftl->EraseSize / 512) + block))) {
401 /* copy only in non free block (free blocks can only
403 if (BlockMap[block] == BLOCK_NIL)
407 (nftl->EraseSize * BlockMap[block]) + (block * 512),
413 (nftl->EraseSize * BlockMap[block]) + (block * 512),
424 (block * 512), 512, &retlen, movebuf, (char *)&oob);
434 /* OK. We've moved the whole lot into the new block. Now we have to free the original blocks. */
444 /* For each block in the old chain (except the targetEUN of course),
452 /* could not erase : mark block as reserved
520 for this block. Make it available if it isn't already
522 static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block)
525 u16 thisVUC = block / (nftl->EraseSize / 512);
528 unsigned long blockofs = (block * 512) & (nftl->EraseSize -1);
535 a free space for the block in question.
555 pr_debug("Status of block %d in EUN %d is %x\n",
556 block , writeEUN, le16_to_cpu(bci.Status));
568 // Invalid block. Don't use it any more. Must implement.
579 /* Skip to next block in chain */
586 /* Try to find an already-free block */
626 /* We've found a free block. Insert it into the chain. */
629 thisVUC |= 0x8000; /* It's a replacement block */
631 /* The first block in a new chain */
648 /* we link the new block to the chain only after the
649 block is ready. It avoids the case where the chain
650 could point to a free block */
674 static int nftl_writeblock(struct mtd_blktrans_dev *mbd, unsigned long block,
679 unsigned long blockofs = (block * 512) & (nftl->EraseSize - 1);
683 writeEUN = NFTL_findwriteunit(nftl, block);
687 "NFTL_writeblock(): Cannot find block to write to\n");
688 /* If we _still_ haven't got a block to use, we're screwed */
701 static int nftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
707 u16 thisEUN = nftl->EUNtable[block / (nftl->EraseSize / 512)];
708 unsigned long blockofs = (block * 512) & (nftl->EraseSize - 1);
738 printk("Unknown status for block %ld in EUN %d: %x\n",
739 block, thisEUN, status);
745 block / (nftl->EraseSize / 512));
754 /* the requested block is not on the media, return all 0x00 */