hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/btrfs/tree-defrag.c
....@@ -35,7 +35,7 @@
3535 goto out;
3636 }
3737
38
- if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state))
38
+ if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
3939 goto out;
4040
4141 path = btrfs_alloc_path();
....@@ -52,7 +52,7 @@
5252 u32 nritems;
5353
5454 root_node = btrfs_lock_root_node(root);
55
- btrfs_set_lock_blocking(root_node);
55
+ btrfs_set_lock_blocking_write(root_node);
5656 nritems = btrfs_header_nritems(root_node);
5757 root->defrag_max.objectid = 0;
5858 /* from above we know this is not a leaf */
....@@ -133,10 +133,9 @@
133133 ret = 0;
134134 }
135135 done:
136
- if (ret != -EAGAIN) {
136
+ if (ret != -EAGAIN)
137137 memset(&root->defrag_progress, 0,
138138 sizeof(root->defrag_progress));
139
- root->defrag_trans_start = trans->transid;
140
- }
139
+
141140 return ret;
142141 }