Lines Matching refs:block
39 u32 block;
141 reg->bg * info.blocks_per_group + reg->block,
142 reg->bg * info.blocks_per_group + reg->block + reg->len - 1,
158 u32 block, u32 len, int bg_num)
162 reg->block = block;
175 u32 block = bg->first_block + 2;
178 block += aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks + 1;
185 aux_info.inode_table_blocks * info.block_size, block);
206 /* Marks a the first num_blocks blocks in a block group as used, and accounts
207 for them in the block group free block info. */
212 u32 block = start;
216 for (i = 0; i < num && block % 8 != 0; i++, block++) {
217 if (bitmap_set_bit(bg->block_bitmap, block)) {
218 error("attempted to reserve already reserved block");
223 for (; i + 8 <= (num & ~7); i += 8, block += 8) {
224 if (bitmap_set_8_bits(bg->block_bitmap, block)) {
225 error("attempted to reserve already reserved block");
230 for (; i < num; i++, block++) {
231 if (bitmap_set_bit(bg->block_bitmap, block)) {
232 error("attempted to reserve already reserved block");
247 u32 block = bg->first_free_block - 1;
248 for (i = 0; i < num_blocks; i++, block--)
249 bg->block_bitmap[block / 8] &= ~(1 << (block % 8));
255 to the free pool in their block group. Assumes that the blocks being
256 returned were the last ones allocated out of the block group */
299 u32 block = bg->first_block;
301 block += 1 + aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks;
303 block);
313 error("failed to reserve %u blocks in block group %u\n", bg->header_blocks, i);
348 u32 block = aux_info.bgs[bg_num].first_free_block;
351 error("failed to reserve %u blocks in block group %u\n", len, bg_num);
357 return bg->first_block + block;
366 u32 block = ext4_allocate_blocks_from_block_group(len, i);
368 if (block != EXT4_ALLOCATE_FAILED) {
370 reg->block = block;
382 /* Allocate a single block and return its block number */
387 u32 block = ext4_allocate_blocks_from_block_group(1, i);
389 if (block != EXT4_ALLOCATE_FAILED)
390 return block;
404 u32 block;
407 /* If the requested length would fit in a block group,
409 used block group */
413 block = ext4_allocate_blocks_from_block_group(bg_len, i);
415 if (block == EXT4_ALLOCATE_FAILED) {
416 error("failed to allocate %d blocks in block group %d", bg_len, i);
421 reg->block = block;
470 /* Allocate len blocks. The blocks may be spread across multiple block groups,
471 and are returned in a linked list of the blocks in each block group. The
473 1. Try to allocate the entire block len in each block group
474 2. If the request doesn't fit in any block group, allocate as many
475 blocks as possible into each block group that is completely empty
476 3. Put the last set of blocks in the first block group they fit in
516 /* Returns the block number of the block'th block in an allocation */
517 u32 get_block(struct block_allocation *alloc, u32 block)
520 block += alloc->list.partial_iter;
523 if (block < reg->len)
524 return reg->block + block;
525 block -= reg->len;
530 u32 get_oob_block(struct block_allocation *alloc, u32 block)
533 block += alloc->oob_list.partial_iter;
536 if (block < reg->len)
537 return reg->block + block;
538 block -= reg->len;
543 /* Gets the starting block and length in blocks of the first region
545 void get_region(struct block_allocation *alloc, u32 *block, u32 *len)
547 *block = alloc->list.iter->block;
558 /* Returns the number of free blocks in a block group */
593 new->block = reg->block + len;
703 struct ext4_xattr_header *block = xattr_list_find(inode);
704 if (block != NULL)
705 return block;
708 block = calloc(info.block_size, 1);
709 if (block == NULL) {
714 block->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
715 block->h_refcount = cpu_to_le32(1);
716 block->h_blocks = cpu_to_le32(1);
720 int result = sparse_file_add_data(info.sparse_file, block, info.block_size, block_num);
723 free(block);
726 xattr_list_insert(inode, block);
727 return block;
730 /* Mark the first len inodes in a block group as used */
753 TODO: Inodes should be allocated in the block group of the data? */
768 /* Returns the number of free inodes in a block group */
774 /* Increments the directory count of the block group that contains inode */
781 /* Returns the number of inodes in a block group that are directories */
787 /* Returns the flags for a block group */