Lines Matching refs:block

39 	u32 block;
115 reg->bg * info.blocks_per_group + reg->block,
116 reg->bg * info.blocks_per_group + reg->block + reg->len - 1,
132 u32 block, u32 len, int bg_num)
136 reg->block = block;
149 u32 block = bg->first_block + 2;
152 block += aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks + 1;
159 aux_info.inode_table_blocks * info.block_size, block);
165 u32 block;
171 block = bg->first_block + 2;
173 block += aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks + 1;
175 aux_info.inode_table_blocks * info.block_size, block);
196 /* Marks a the first num_blocks blocks in a block group as used, and accounts
197 for them in the block group free block info. */
202 u32 block = start;
206 for (i = 0; i < num && block % 8 != 0; i++, block++) {
207 if (bitmap_set_bit(bg->block_bitmap, block)) {
208 error("attempted to reserve already reserved block");
213 for (; i + 8 <= (num & ~7); i += 8, block += 8) {
214 if (bitmap_set_8_bits(bg->block_bitmap, block)) {
215 error("attempted to reserve already reserved block");
220 for (; i < num; i++, block++) {
221 if (bitmap_set_bit(bg->block_bitmap, block)) {
222 error("attempted to reserve already reserved block");
237 u32 block = bg->first_free_block - 1;
238 for (i = 0; i < num_blocks; i++, block--)
239 bg->block_bitmap[block / 8] &= ~(1 << (block % 8));
245 to the free pool in their block group. Assumes that the blocks being
246 returned were the last ones allocated out of the block group */
289 u32 block = bg->first_block;
291 block += 1 + aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks;
293 block);
302 error("failed to reserve %u blocks in block group %u\n", bg->header_blocks, i);
337 u32 block = aux_info.bgs[bg_num].first_free_block;
340 error("failed to reserve %u blocks in block group %u\n", len, bg_num);
346 return bg->first_block + block;
355 u32 block = ext4_allocate_blocks_from_block_group(len, i);
357 if (block != EXT4_ALLOCATE_FAILED) {
359 reg->block = block;
371 /* Allocate a single block and return its block number */
376 u32 block = ext4_allocate_blocks_from_block_group(1, i);
378 if (block != EXT4_ALLOCATE_FAILED)
379 return block;
393 u32 block;
396 /* If the requested length would fit in a block group,
398 used block group */
402 block = ext4_allocate_blocks_from_block_group(bg_len, i);
404 if (block == EXT4_ALLOCATE_FAILED) {
405 error("failed to allocate %d blocks in block group %d", bg_len, i);
410 reg->block = block;
459 /* Allocate len blocks. The blocks may be spread across multiple block groups,
460 and are returned in a linked list of the blocks in each block group. The
462 1. Try to allocate the entire block len in each block group
463 2. If the request doesn't fit in any block group, allocate as many
464 blocks as possible into each block group that is completely empty
465 3. Put the last set of blocks in the first block group they fit in
505 /* Returns the block number of the block'th block in an allocation */
506 u32 get_block(struct block_allocation *alloc, u32 block)
509 block += alloc->list.partial_iter;
512 if (block < reg->len)
513 return reg->block + block;
514 block -= reg->len;
519 u32 get_oob_block(struct block_allocation *alloc, u32 block)
522 block += alloc->oob_list.partial_iter;
525 if (block < reg->len)
526 return reg->block + block;
527 block -= reg->len;
532 /* Gets the starting block and length in blocks of the first region
534 void get_region(struct block_allocation *alloc, u32 *block, u32 *len)
536 *block = alloc->list.iter->block;
547 /* Returns the number of free blocks in a block group */
582 new->block = reg->block + len;
690 /* Mark the first len inodes in a block group as used */
713 TODO: Inodes should be allocated in the block group of the data? */
728 /* Returns the number of free inodes in a block group */
734 /* Increments the directory count of the block group that contains inode */
741 /* Returns the number of inodes in a block group that are directories */