Lines Matching refs:block

119 			   reg->block, reg->block + reg->len - 1, reg->len)
139 fprintf(f, "%d", reg->block);
141 fprintf(f, "%d-%d", reg->block, reg->block + reg->len - 1);
149 u32 block, u32 len, int bg_num)
153 reg->block = block;
166 u32 block = bg->first_block + 2;
169 block += aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks + 1;
176 aux_info.inode_table_blocks * info.block_size, block);
197 /* Marks a the first num_blocks blocks in a block group as used, and accounts
198 for them in the block group free block info. */
203 u32 block = start;
204 for (i = 0; i < num && block % 8 != 0; i++, block++) {
205 if (bitmap_set_bit(bg->block_bitmap, block)) {
206 error("attempted to reserve already reserved block %d in block group %d", block, bg_num);
211 for (; i + 8 <= (num & ~7); i += 8, block += 8) {
212 if (bitmap_set_8_bits(bg->block_bitmap, block)) {
213 error("attempted to reserve already reserved block %d in block group %d", block, bg_num);
218 for (; i < num; i++, block++) {
219 if (bitmap_set_bit(bg->block_bitmap, block)) {
220 error("attempted to reserve already reserved block %d in block group %d", block, bg_num);
230 static void free_blocks(struct block_group_info *bg, u32 block, u32 num_blocks)
233 for (i = 0; i < num_blocks; i++, block--)
234 bg->block_bitmap[block / 8] &= ~(1 << (block % 8));
239 to the free pool in their block group. Assumes that the blocks being
240 returned were the last ones allocated out of the block group */
248 free_blocks(bg, last_reg->block + last_reg->len - bg->first_block - 1, len);
253 free_blocks(bg, last_reg->block + last_reg->len - bg->first_block - 1, last_reg->len);
284 u32 block = bg->first_block;
286 block += 1 + aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks;
288 block);
301 error("failed to reserve %u blocks in block group %u\n", bg->header_blocks, i);
339 /* Allocate a single block and return its block number */
342 u32 block;
347 block = blk_alloc->list.first->block;
349 return block;
364 hole_start = bgs[i].chunks[j-1].block + bgs[i].chunks[j-1].len;
365 hole_size = bgs[i].chunks[j].block - hole_start;
402 error("failed to reserve %u blocks in block group %u\n", found_allocate_len, found_bg);
407 reg->block = found_block + bgs[found_bg].first_block;
441 /* Allocate len blocks. The blocks may be spread across multiple block groups,
442 and are returned in a linked list of the blocks in each block group. The
488 /* Returns the block number of the block'th block in an allocation */
489 u32 get_block(struct block_allocation *alloc, u32 block)
492 block += alloc->list.partial_iter;
495 if (block < reg->len)
496 return reg->block + block;
497 block -= reg->len;
502 u32 get_oob_block(struct block_allocation *alloc, u32 block)
505 block += alloc->oob_list.partial_iter;
508 if (block < reg->len)
509 return reg->block + block;
510 block -= reg->len;
515 /* Gets the starting block and length in blocks of the first region
517 void get_region(struct block_allocation *alloc, u32 *block, u32 *len)
519 *block = alloc->list.iter->block;
530 /* Returns the number of free blocks in a block group */
565 new->block = reg->block + len;
675 struct ext4_xattr_header *block = xattr_list_find(inode);
676 if (block != NULL)
677 return block;
680 block = calloc(info.block_size, 1);
681 if (block == NULL) {
686 block->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
687 block->h_refcount = cpu_to_le32(1);
688 block->h_blocks = cpu_to_le32(1);
692 int result = sparse_file_add_data(ext4_sparse_file, block, info.block_size, block_num);
695 free(block);
698 xattr_list_insert(inode, block);
699 return block;
702 /* Mark the first len inodes in a block group as used */
725 TODO: Inodes should be allocated in the block group of the data? */
740 /* Returns the number of free inodes in a block group */
746 /* Increments the directory count of the block group that contains inode */
753 /* Returns the number of inodes in a block group that are directories */
759 /* Returns the flags for a block group */
797 bgs[bg].chunks[chunk_count].block = start_block;
810 if (reserve_blocks(&bgs[reg->bg], reg->bg, reg->block - bgs[reg->bg].first_block, reg->len) < 0) {