diff options
author | Joe Thornber <ejt@redhat.com> | 2013-03-02 02:45:50 +0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2013-03-02 02:45:50 +0400 |
commit | 4e7f1f9089660aec3b5ab2645ce62777c6f4c6a2 (patch) | |
tree | 56f012273947dcd88e4a73944aae37d01f023b56 /drivers/md/persistent-data/dm-btree.h | |
parent | b0d8ed4d96a26ef3ac54a4aa8911c9413070662e (diff) | |
download | linux-4e7f1f9089660aec3b5ab2645ce62777c6f4c6a2.tar.xz |
dm persistent data: add btree_walk
Add dm_btree_walk to iterate through the contents of a btree.
This will be used by the dm cache target.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/persistent-data/dm-btree.h')
-rw-r--r-- | drivers/md/persistent-data/dm-btree.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/md/persistent-data/dm-btree.h b/drivers/md/persistent-data/dm-btree.h index fced8316bca2..8672d159e0b5 100644 --- a/drivers/md/persistent-data/dm-btree.h +++ b/drivers/md/persistent-data/dm-btree.h @@ -142,4 +142,13 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, int dm_btree_find_highest_key(struct dm_btree_info *info, dm_block_t root, uint64_t *result_keys); +/* + * Iterate through the a btree, calling fn() on each entry. + * It only works for single level trees and is internally recursive, so + * monitor stack usage carefully. + */ +int dm_btree_walk(struct dm_btree_info *info, dm_block_t root, + int (*fn)(void *context, uint64_t *keys, void *leaf), + void *context); + #endif /* _LINUX_DM_BTREE_H */ |