Linux-libre 5.4.48-gnu
[librecmc/linux-libre.git] / fs / xfs / scrub / bitmap.h
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2018 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <darrick.wong@oracle.com>
5  */
6 #ifndef __XFS_SCRUB_BITMAP_H__
7 #define __XFS_SCRUB_BITMAP_H__
8
9 struct xfs_bitmap_range {
10         struct list_head        list;
11         uint64_t                start;
12         uint64_t                len;
13 };
14
15 struct xfs_bitmap {
16         struct list_head        list;
17 };
18
19 void xfs_bitmap_init(struct xfs_bitmap *bitmap);
20 void xfs_bitmap_destroy(struct xfs_bitmap *bitmap);
21
22 #define for_each_xfs_bitmap_extent(bex, n, bitmap) \
23         list_for_each_entry_safe((bex), (n), &(bitmap)->list, list)
24
25 #define for_each_xfs_bitmap_block(b, bex, n, bitmap) \
26         list_for_each_entry_safe((bex), (n), &(bitmap)->list, list) \
27                 for ((b) = bex->start; (b) < bex->start + bex->len; (b)++)
28
29 int xfs_bitmap_set(struct xfs_bitmap *bitmap, uint64_t start, uint64_t len);
30 int xfs_bitmap_disunion(struct xfs_bitmap *bitmap, struct xfs_bitmap *sub);
31 int xfs_bitmap_set_btcur_path(struct xfs_bitmap *bitmap,
32                 struct xfs_btree_cur *cur);
33 int xfs_bitmap_set_btblocks(struct xfs_bitmap *bitmap,
34                 struct xfs_btree_cur *cur);
35
36 #endif  /* __XFS_SCRUB_BITMAP_H__ */