diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-05-10 19:22:11 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-06-07 16:37:38 +0200 |
commit | 9e2bf8c8abecf878ea5928f2751e92433af124c7 (patch) | |
tree | 75f7d294bcfa8bc1fa50ea2aec1ae64f0711313a | |
parent | 6386ae4d8c6644630ab3f9aa1c92d8aed3b81aea (diff) |
btrfs-progs: Use symbolic names for read ahead behavior
Presently btrfs-progs haven't pulled the enum defining the symbolic
names of read ahead constants. This commit adds the enum and
simultaneously converts all usages to respective symbolic name.
No functional change, just making the code human readable.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | ctree.h | 2 | ||||
-rw-r--r-- | extent-tree.c | 12 | ||||
-rw-r--r-- | qgroup-verify.c | 4 | ||||
-rw-r--r-- | volumes.c | 4 |
4 files changed, 11 insertions, 11 deletions
@@ -556,7 +556,7 @@ struct btrfs_node { * The slots array records the index of the item or block pointer * used while walking the tree. */ - +enum { READA_NONE = 0, READA_BACK, READA_FORWARD }; struct btrfs_path { struct extent_buffer *nodes[BTRFS_MAX_LEVEL]; int slots[BTRFS_MAX_LEVEL]; diff --git a/extent-tree.c b/extent-tree.c index 1694c479..0643815b 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -110,7 +110,7 @@ static int cache_block_group(struct btrfs_root *root, if (!path) return -ENOMEM; - path->reada = 2; + path->reada = READA_FORWARD; last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET); key.objectid = last; key.offset = 0; @@ -1389,7 +1389,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, if (!path) return -ENOMEM; - path->reada = 1; + path->reada = READA_BACK; ret = insert_inline_extent_backref(trans, root->fs_info->extent_root, path, bytenr, num_bytes, parent, @@ -1410,7 +1410,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, btrfs_mark_buffer_dirty(leaf); btrfs_release_path(path); - path->reada = 1; + path->reada = READA_BACK; /* now insert the actual backref */ ret = insert_extent_backref(trans, root->fs_info->extent_root, @@ -1454,7 +1454,7 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, path = btrfs_alloc_path(); if (!path) return -ENOMEM; - path->reada = 1; + path->reada = READA_BACK; key.objectid = bytenr; key.offset = offset; @@ -1544,7 +1544,7 @@ int btrfs_set_block_flags(struct btrfs_trans_handle *trans, u64 bytenr, path = btrfs_alloc_path(); if (!path) return -ENOMEM; - path->reada = 1; + path->reada = READA_BACK; key.objectid = bytenr; if (skinny_metadata) { @@ -2184,7 +2184,7 @@ static int __free_extent(struct btrfs_trans_handle *trans, if (!path) return -ENOMEM; - path->reada = 1; + path->reada = READA_BACK; is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID; if (is_data) diff --git a/qgroup-verify.c b/qgroup-verify.c index 4deb9879..e2332be2 100644 --- a/qgroup-verify.c +++ b/qgroup-verify.c @@ -622,7 +622,7 @@ static void free_tree_blocks(void) ULIST_ITER_INIT(&uiter); while ((unode = ulist_next(tree_blocks, &uiter))) free(unode_tree_block(unode)); - ulist_free(tree_blocks); + ulist_free(tree_blocks); tree_blocks = NULL; } @@ -1160,7 +1160,7 @@ static int scan_extents(struct btrfs_fs_info *info, fprintf(stderr, "ERROR: Couldn't search slot: %d\n", ret); goto out; } - path.reada = 1; + path.reada = READA_BACK; while (1) { leaf = path.nodes[0]; @@ -420,7 +420,7 @@ static int find_free_dev_extent_start(struct btrfs_device *device, goto out; } - path->reada = 2; + path->reada = READA_FORWARD; key.objectid = device->devid; key.offset = search_start; @@ -846,7 +846,7 @@ static int btrfs_device_avail_bytes(struct btrfs_trans_handle *trans, key.offset = root->fs_info->alloc_start; key.type = BTRFS_DEV_EXTENT_KEY; - path->reada = 2; + path->reada = READA_FORWARD; ret = btrfs_search_slot(trans, root, &key, path, 0, 0); if (ret < 0) goto error; |