summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu Fengqi <lufq.fnst@cn.fujitsu.com>2018-10-11 13:40:38 +0800
committerDavid Sterba <dsterba@suse.com>2018-10-15 17:23:41 +0200
commitd9352794dad9f28535439d85a815978878c141ab (patch)
tree43d953de87533b134695f9d5b855e5e08699559d
parent7c8616278b19c42141ff4617573cbf950f4a456b (diff)
btrfs: switch return_bigger to bool in find_ref_head
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> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/delayed-ref.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 5d8f6d505d5a..5149165b49a4 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -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;
@@ -359,12 +360,12 @@ struct btrfs_delayed_ref_head *btrfs_select_ref_head(
again:
start = delayed_refs->run_delayed_start;
- head = find_ref_head(delayed_refs, start, 1);
+ head = find_ref_head(delayed_refs, start, true);
if (!head && !loop) {
delayed_refs->run_delayed_start = 0;
start = 0;
loop = true;
- head = find_ref_head(delayed_refs, start, 1);
+ head = find_ref_head(delayed_refs, start, true);
if (!head)
return NULL;
} else if (!head && loop) {
@@ -905,7 +906,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)