Lines Matching refs:num_bytes
104 struct btrfs_block_rsv *dest, u64 num_bytes, in block_rsv_release_bytes() argument
112 if (num_bytes == (u64)-1) { in block_rsv_release_bytes()
113 num_bytes = block_rsv->size; in block_rsv_release_bytes()
116 block_rsv->size -= num_bytes; in block_rsv_release_bytes()
118 num_bytes = block_rsv->reserved - block_rsv->size; in block_rsv_release_bytes()
122 num_bytes = 0; in block_rsv_release_bytes()
133 ret = num_bytes; in block_rsv_release_bytes()
134 if (num_bytes > 0) { in block_rsv_release_bytes()
141 bytes_to_add = min(num_bytes, bytes_to_add); in block_rsv_release_bytes()
145 num_bytes -= bytes_to_add; in block_rsv_release_bytes()
149 if (num_bytes) in block_rsv_release_bytes()
152 num_bytes); in block_rsv_release_bytes()
160 struct btrfs_block_rsv *dst, u64 num_bytes, in btrfs_block_rsv_migrate() argument
165 ret = btrfs_block_rsv_use_bytes(src, num_bytes); in btrfs_block_rsv_migrate()
169 btrfs_block_rsv_add_bytes(dst, num_bytes, update_size); in btrfs_block_rsv_migrate()
212 struct btrfs_block_rsv *block_rsv, u64 num_bytes, in btrfs_block_rsv_add() argument
217 if (num_bytes == 0) in btrfs_block_rsv_add()
220 ret = btrfs_reserve_metadata_bytes(root, block_rsv, num_bytes, flush); in btrfs_block_rsv_add()
222 btrfs_block_rsv_add_bytes(block_rsv, num_bytes, true); in btrfs_block_rsv_add()
229 u64 num_bytes = 0; in btrfs_block_rsv_check() local
236 num_bytes = div_factor(block_rsv->size, min_factor); in btrfs_block_rsv_check()
237 if (block_rsv->reserved >= num_bytes) in btrfs_block_rsv_check()
248 u64 num_bytes = 0; in btrfs_block_rsv_refill() local
255 num_bytes = min_reserved; in btrfs_block_rsv_refill()
256 if (block_rsv->reserved >= num_bytes) in btrfs_block_rsv_refill()
259 num_bytes -= block_rsv->reserved; in btrfs_block_rsv_refill()
265 ret = btrfs_reserve_metadata_bytes(root, block_rsv, num_bytes, flush); in btrfs_block_rsv_refill()
267 btrfs_block_rsv_add_bytes(block_rsv, num_bytes, false); in btrfs_block_rsv_refill()
275 struct btrfs_block_rsv *block_rsv, u64 num_bytes, in btrfs_block_rsv_release() argument
294 return block_rsv_release_bytes(fs_info, block_rsv, target, num_bytes, in btrfs_block_rsv_release()
298 int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, u64 num_bytes) in btrfs_block_rsv_use_bytes() argument
303 if (block_rsv->reserved >= num_bytes) { in btrfs_block_rsv_use_bytes()
304 block_rsv->reserved -= num_bytes; in btrfs_block_rsv_use_bytes()
314 u64 num_bytes, bool update_size) in btrfs_block_rsv_add_bytes() argument
317 block_rsv->reserved += num_bytes; in btrfs_block_rsv_add_bytes()
319 block_rsv->size += num_bytes; in btrfs_block_rsv_add_bytes()
326 struct btrfs_block_rsv *dest, u64 num_bytes, in btrfs_cond_migrate_bytes() argument
337 if (global_rsv->reserved < min_bytes + num_bytes) { in btrfs_cond_migrate_bytes()
341 global_rsv->reserved -= num_bytes; in btrfs_cond_migrate_bytes()
346 btrfs_block_rsv_add_bytes(dest, num_bytes, true); in btrfs_cond_migrate_bytes()
354 u64 num_bytes; in btrfs_update_global_block_rsv() local
362 num_bytes = btrfs_root_used(&fs_info->extent_root->root_item) + in btrfs_update_global_block_rsv()
383 num_bytes = max_t(u64, num_bytes, in btrfs_update_global_block_rsv()
389 block_rsv->size = min_t(u64, num_bytes, SZ_512M); in btrfs_update_global_block_rsv()
392 num_bytes = block_rsv->size - block_rsv->reserved; in btrfs_update_global_block_rsv()
394 num_bytes); in btrfs_update_global_block_rsv()
397 num_bytes = block_rsv->reserved - block_rsv->size; in btrfs_update_global_block_rsv()
399 -num_bytes); in btrfs_update_global_block_rsv()