Lines Matching refs:offsets

25 static int get_level_offsets(struct ext2_data *fs, uint32_t block, uint32_t offsets[4]);
405 static int fetch_level_blocks(struct ext2_inode *inode, uint32_t offsets[4], int lvl, int max_lvl, in fetch_level_blocks()
409 bool already_fetched = try_current && (offsets[lvl] == inode->offsets[lvl]); in fetch_level_blocks()
426 block = inode->i_block[offsets[0]]; in fetch_level_blocks()
430 block = sys_le32_to_cpu(list[offsets[lvl]]); in fetch_level_blocks()
442 LOG_DBG("[fetch] lvl:%d off:%d num:%d", lvl, offsets[lvl], block); in fetch_level_blocks()
444 return fetch_level_blocks(inode, offsets, lvl + 1, max_lvl, try_current); in fetch_level_blocks()
458 uint32_t offsets[MAX_OFFSETS_SIZE]; in ext2_fetch_inode_block() local
461 max_lvl = get_level_offsets(fs, block, offsets); in ext2_fetch_inode_block()
463 ret = fetch_level_blocks(inode, offsets, 0, max_lvl, try_current); in ext2_fetch_inode_block()
469 memcpy(inode->offsets, offsets, MAX_OFFSETS_SIZE * sizeof(uint32_t)); in ext2_fetch_inode_block()
475 inode->offsets[0], inode->offsets[1], inode->offsets[2], inode->offsets[3]); in ext2_fetch_inode_block()
479 static bool all_zero(const uint32_t *offsets, int lvl) in all_zero() argument
482 if (offsets[i] > 0) { in all_zero()
498 const uint32_t *offsets) in delete_blocks() argument
526 if (all_zero(offsets, lvl)) { in delete_blocks()
539 start_blk = offsets[0]; in delete_blocks()
542 uint32_t block_num2 = sys_le32_to_cpu(list[offsets[0]]); in delete_blocks()
555 start_blk = offsets[0] + 1; in delete_blocks()
558 rem = delete_blocks(fs, block_num2, lvl - 1, &offsets[1]); in delete_blocks()
610 static int get_level_offsets(struct ext2_data *fs, uint32_t block, uint32_t offsets[4]) in get_level_offsets()
620 offsets[0] = block; in get_level_offsets()
627 offsets[0] = EXT2_INODE_BLOCK_1LVL; in get_level_offsets()
628 offsets[1] = block; in get_level_offsets()
635 offsets[0] = EXT2_INODE_BLOCK_2LVL; in get_level_offsets()
636 offsets[1] = block / B; in get_level_offsets()
637 offsets[2] = block % B; in get_level_offsets()
644 offsets[0] = EXT2_INODE_BLOCK_3LVL; in get_level_offsets()
645 offsets[1] = block / (B * B); in get_level_offsets()
646 offsets[2] = (block % (B * B)) / B; in get_level_offsets()
647 offsets[3] = (block % (B * B)) % B; in get_level_offsets()
667 uint32_t offsets[4]; in ext2_inode_remove_blocks() local
670 max_lvl = get_level_offsets(inode->i_fs, first, offsets); in ext2_inode_remove_blocks()
672 if (all_zero(&offsets[1], max_lvl)) { in ext2_inode_remove_blocks()
678 start = offsets[0]; in ext2_inode_remove_blocks()
683 if (inode->i_block[offsets[0]] == 0) { in ext2_inode_remove_blocks()
689 start = offsets[0] + 1; in ext2_inode_remove_blocks()
690 ret = delete_blocks(inode->i_fs, inode->i_block[offsets[0]], in ext2_inode_remove_blocks()
691 block0_level(offsets[0]), &offsets[1]); in ext2_inode_remove_blocks()
721 block = &inode->i_block[inode->offsets[lvl]]; in alloc_level_blocks()
723 block = &((uint32_t *)inode->blocks[lvl - 1]->data)[inode->offsets[lvl]]; in alloc_level_blocks()