@@ -168,11 +168,12 @@ static struct btrfs_delayed_ref_node* tree_insert(struct rb_root_cached *root,
* find an head entry based on bytenr. This returns the delayed ref
* head if it was able to find one, or NULL if nothing was in that spot.
* If return_bigger is given, the next bigger entry is returned if no exact
- * match is found.
+ * match is found. But if no bigger one is found then the first node of the
+ * ref head tree will be returned.
*/
static struct btrfs_delayed_ref_head* find_ref_head(
struct btrfs_delayed_ref_root *dr, u64 bytenr,
- int return_bigger)
+ bool return_bigger)
{
struct rb_root *root = &dr->href_root.rb_root;
struct rb_node *n;
@@ -356,7 +357,8 @@ btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
struct btrfs_delayed_ref_head *head;
again:
- head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
+ head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start,
+ true);
if (!head) {
delayed_refs->run_delayed_start = 0;
return NULL;
@@ -894,7 +896,7 @@ int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_head *
btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs, u64 bytenr)
{
- return find_ref_head(delayed_refs, bytenr, 0);
+ return find_ref_head(delayed_refs, bytenr, false);
}
void __cold btrfs_delayed_ref_exit(void)
Using bool is more suitable than int here, and add the comment about the return_bigger. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> --- fs/btrfs/delayed-ref.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)