diff options
author | Arne Jansen <sensille@gmx.net> | 2011-09-12 09:26:38 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2011-12-22 10:22:27 -0500 |
commit | 66d7e7f09f77456fe68683247d77721032a00ee5 (patch) | |
tree | bbf7df3933ed47aa202d60d835864543d25df82d /fs/btrfs/ctree.h | |
parent | c7d22a3c3cdb73d8a0151e2ccc8cf4a48c48310b (diff) |
Btrfs: mark delayed refs as for cow
Add a for_cow parameter to add_delayed_*_ref and pass the appropriate value
from every call site. The for_cow parameter will later on be used to
determine if a ref will change anything with respect to qgroups.
Delayed refs coming from relocation are always counted as for_cow, as they
don't change subvol quota.
Also pass in the fs_info for later use.
btrfs_find_all_roots() will use this as an optimization, as changes that are
for_cow will not change anything with respect to which root points to a
certain leaf. Thus, we don't need to add the current sequence number to
those delayed refs.
Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 3e4a07b79817..543f60bddb39 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2277,11 +2277,11 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
2277 | struct btrfs_root *root, u32 blocksize, | 2277 | struct btrfs_root *root, u32 blocksize, |
2278 | u64 parent, u64 root_objectid, | 2278 | u64 parent, u64 root_objectid, |
2279 | struct btrfs_disk_key *key, int level, | 2279 | struct btrfs_disk_key *key, int level, |
2280 | u64 hint, u64 empty_size); | 2280 | u64 hint, u64 empty_size, int for_cow); |
2281 | void btrfs_free_tree_block(struct btrfs_trans_handle *trans, | 2281 | void btrfs_free_tree_block(struct btrfs_trans_handle *trans, |
2282 | struct btrfs_root *root, | 2282 | struct btrfs_root *root, |
2283 | struct extent_buffer *buf, | 2283 | struct extent_buffer *buf, |
2284 | u64 parent, int last_ref); | 2284 | u64 parent, int last_ref, int for_cow); |
2285 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | 2285 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, |
2286 | struct btrfs_root *root, | 2286 | struct btrfs_root *root, |
2287 | u64 bytenr, u32 blocksize, | 2287 | u64 bytenr, u32 blocksize, |
@@ -2301,17 +2301,17 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans, | |||
2301 | u64 search_end, struct btrfs_key *ins, | 2301 | u64 search_end, struct btrfs_key *ins, |
2302 | u64 data); | 2302 | u64 data); |
2303 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 2303 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
2304 | struct extent_buffer *buf, int full_backref); | 2304 | struct extent_buffer *buf, int full_backref, int for_cow); |
2305 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 2305 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
2306 | struct extent_buffer *buf, int full_backref); | 2306 | struct extent_buffer *buf, int full_backref, int for_cow); |
2307 | int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans, | 2307 | int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans, |
2308 | struct btrfs_root *root, | 2308 | struct btrfs_root *root, |
2309 | u64 bytenr, u64 num_bytes, u64 flags, | 2309 | u64 bytenr, u64 num_bytes, u64 flags, |
2310 | int is_data); | 2310 | int is_data); |
2311 | int btrfs_free_extent(struct btrfs_trans_handle *trans, | 2311 | int btrfs_free_extent(struct btrfs_trans_handle *trans, |
2312 | struct btrfs_root *root, | 2312 | struct btrfs_root *root, |
2313 | u64 bytenr, u64 num_bytes, u64 parent, | 2313 | u64 bytenr, u64 num_bytes, u64 parent, u64 root_objectid, |
2314 | u64 root_objectid, u64 owner, u64 offset); | 2314 | u64 owner, u64 offset, int for_cow); |
2315 | 2315 | ||
2316 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); | 2316 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); |
2317 | int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root, | 2317 | int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root, |
@@ -2323,7 +2323,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, | |||
2323 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | 2323 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, |
2324 | struct btrfs_root *root, | 2324 | struct btrfs_root *root, |
2325 | u64 bytenr, u64 num_bytes, u64 parent, | 2325 | u64 bytenr, u64 num_bytes, u64 parent, |
2326 | u64 root_objectid, u64 owner, u64 offset); | 2326 | u64 root_objectid, u64 owner, u64 offset, int for_cow); |
2327 | 2327 | ||
2328 | int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, | 2328 | int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, |
2329 | struct btrfs_root *root); | 2329 | struct btrfs_root *root); |
@@ -2492,7 +2492,8 @@ static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p) | |||
2492 | int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); | 2492 | int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); |
2493 | int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); | 2493 | int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); |
2494 | void btrfs_drop_snapshot(struct btrfs_root *root, | 2494 | void btrfs_drop_snapshot(struct btrfs_root *root, |
2495 | struct btrfs_block_rsv *block_rsv, int update_ref); | 2495 | struct btrfs_block_rsv *block_rsv, int update_ref, |
2496 | int for_reloc); | ||
2496 | int btrfs_drop_subtree(struct btrfs_trans_handle *trans, | 2497 | int btrfs_drop_subtree(struct btrfs_trans_handle *trans, |
2497 | struct btrfs_root *root, | 2498 | struct btrfs_root *root, |
2498 | struct extent_buffer *node, | 2499 | struct extent_buffer *node, |