static bool_t translate(ext2fs_st *st, struct inode *ino, const FileIO_Request *req, USD_Extent *extent) { FileIO_Block blockno = 0, tmp, last; uint32_t nblocks; last = blockno = ext2_bmap(st, ino, req->blockno); for (nblocks = 1; nblocks < req->nblocks; nblocks++) { tmp = ext2_bmap(st, ino, req->blockno+nblocks); if (tmp != last+1) break; last = tmp; } TRC(printf("(%d,%d)->%d(%d)\n", ino->i_ino, req->blockno, blockno, nblocks)); extent->base = blockno; extent->len = nblocks; return True; }
/* * Map a logical sector and load it into the cache */ static const void * ext2_get_cache(struct inode *inode, block_t lblock) { block_t pblock = ext2_bmap(inode, lblock, NULL); return get_cache(inode->fs->fs_dev, pblock); }