summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2011-11-22 15:14:33 +0100
committerBen Hutchings <ben@decadent.org.uk>2015-11-27 12:48:20 +0000
commite83c48cb331eec759cfb9cf93ed2c5face453885 (patch)
tree696183c9f0247d4ecebdec2c4ce8363a39e84494 /fs
parent9914546b256457c85e45c99f9d95759b07452f1a (diff)
Btrfs: added helper btrfs_next_item()
commit c7d22a3c3cdb73d8a0151e2ccc8cf4a48c48310b upstream. btrfs_next_item() makes the btrfs path point to the next item, crossing leaf boundaries if needed. Signed-off-by: Arne Jansen <sensille@gmx.net> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> [bwh: Dependency of the following fix] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 83a871ffe092..2ca4f315b8e5 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2482,6 +2482,13 @@ static inline int btrfs_insert_empty_item(struct btrfs_trans_handle *trans,
}
int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
+static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p)
+{
+ ++p->slots[0];
+ if (p->slots[0] >= btrfs_header_nritems(p->nodes[0]))
+ return btrfs_next_leaf(root, p);
+ return 0;
+}
int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf);
void btrfs_drop_snapshot(struct btrfs_root *root,