Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2019-05-17 18:49:10 +0800
committerQu Wenruo <wqu@suse.com>2019-05-17 18:49:10 +0800
commitba7f8deee3398a233d3c1e48410e7cf13b40940f (patch)
tree5e7a5f3d6a6206b861be219cb624a9e24add892c
parent6c403a7a7c1dd29f3305e2caa9efa6dd544489bd (diff)
- btrfs: split delayed ref head initialization and addition
(bsc#1134813). - Refresh patches.fixes/0001-btrfs-qgroup-Move-reserved-data-accounting-from-btrf.patch. suse-commit: 036fef73e273342b0c0bd8f428c4b048399fda8e
-rw-r--r--fs/btrfs/delayed-ref.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 99919e90261b..2a74307e2655 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -615,8 +615,7 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
struct btrfs_trans_handle *trans,
struct btrfs_delayed_ref_head *head_ref,
struct btrfs_qgroup_extent_record *qrecord,
- u64 bytenr, u64 num_bytes, u64 ref_root, u64 reserved,
- int action, int is_data, int is_system, int *old_ref_mod,
+ int action, int *old_ref_mod,
int *new_ref_mod)
{
@@ -627,9 +626,6 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
mutex_init(&head_ref->mutex);
- init_delayed_ref_head(head_ref, qrecord, bytenr, num_bytes, ref_root,
- reserved, action, is_data, is_system);
-
/* Record qgroup extent info if provided */
if (qrecord) {
if(btrfs_qgroup_trace_extent_nolock(fs_info,
@@ -653,8 +649,8 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
} else {
if (old_ref_mod)
*old_ref_mod = 0;
- if (is_data && head_ref->ref_mod < 0)
- delayed_refs->pending_csums += num_bytes;
+ if (head_ref->is_data && head_ref->ref_mod < 0)
+ delayed_refs->pending_csums += head_ref->num_bytes;
delayed_refs->num_heads++;
delayed_refs->num_heads_ready++;
atomic_inc(&delayed_refs->num_entries);
@@ -662,6 +658,7 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
}
if (new_ref_mod)
*new_ref_mod = head_ref->total_ref_mod;
+
return head_ref;
}
@@ -732,7 +729,7 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
struct btrfs_qgroup_extent_record *record = NULL;
- int is_system = (ref_root == BTRFS_CHUNK_TREE_OBJECTID);
+ bool is_system = (ref_root == BTRFS_CHUNK_TREE_OBJECTID);
int ret;
u8 ref_type;
@@ -762,6 +759,8 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
goto free_head_ref;
}
+ init_delayed_ref_head(head_ref, record, bytenr, num_bytes,
+ ref_root, 0, action, false, is_system);
head_ref->extent_op = extent_op;
delayed_refs = &trans->transaction->delayed_refs;
@@ -772,8 +771,7 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
* the spin lock
*/
head_ref = add_delayed_ref_head(fs_info, trans, head_ref, record,
- bytenr, num_bytes, 0, 0, action, 0,
- is_system, old_ref_mod, new_ref_mod);
+ action, old_ref_mod, new_ref_mod);
ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node);
spin_unlock(&delayed_refs->lock);
@@ -845,6 +843,8 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,
}
}
+ init_delayed_ref_head(head_ref, record, bytenr, num_bytes, ref_root,
+ reserved, action, true, false);
head_ref->extent_op = extent_op;
delayed_refs = &trans->transaction->delayed_refs;
@@ -855,8 +855,7 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,
* the spin lock
*/
head_ref = add_delayed_ref_head(fs_info, trans, head_ref, record,
- bytenr, num_bytes, ref_root, reserved,
- action, 1, 0, old_ref_mod, new_ref_mod);
+ action, old_ref_mod, new_ref_mod);
ret = insert_delayed_ref(trans, delayed_refs, head_ref, &ref->node);
spin_unlock(&delayed_refs->lock);
@@ -881,19 +880,16 @@ int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info,
if (!head_ref)
return -ENOMEM;
+ init_delayed_ref_head(head_ref, NULL, bytenr, num_bytes, 0, 0,
+ BTRFS_UPDATE_DELAYED_HEAD, extent_op->is_data,
+ false);
head_ref->extent_op = extent_op;
delayed_refs = &trans->transaction->delayed_refs;
spin_lock(&delayed_refs->lock);
- /*
- * extent_ops just modify the flags of an extent and they don't result
- * in ref count changes, hence it's safe to pass false/0 for is_system
- * argument
- */
- add_delayed_ref_head(fs_info, trans, head_ref, NULL, bytenr,
- num_bytes, 0, 0, BTRFS_UPDATE_DELAYED_HEAD,
- extent_op->is_data, 0, NULL, NULL);
+ add_delayed_ref_head(fs_info, trans, head_ref, NULL,
+ BTRFS_UPDATE_DELAYED_HEAD, NULL, NULL);
spin_unlock(&delayed_refs->lock);
return 0;