xref: /linux/fs/xfs/scrub/dab_bitmap.h (revision 151ebcf0797b1a3ba53c8843dc21748c80e098c7)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2022-2024 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <djwong@kernel.org>
5  */
6 #ifndef __XFS_SCRUB_DAB_BITMAP_H__
7 #define __XFS_SCRUB_DAB_BITMAP_H__
8 
9 /* Bitmaps, but for type-checked for xfs_dablk_t */
10 
11 struct xdab_bitmap {
12 	struct xbitmap32	dabitmap;
13 };
14 
15 static inline void xdab_bitmap_init(struct xdab_bitmap *bitmap)
16 {
17 	xbitmap32_init(&bitmap->dabitmap);
18 }
19 
20 static inline void xdab_bitmap_destroy(struct xdab_bitmap *bitmap)
21 {
22 	xbitmap32_destroy(&bitmap->dabitmap);
23 }
24 
25 static inline int xdab_bitmap_set(struct xdab_bitmap *bitmap,
26 		xfs_dablk_t dabno, xfs_extlen_t len)
27 {
28 	return xbitmap32_set(&bitmap->dabitmap, dabno, len);
29 }
30 
31 static inline bool xdab_bitmap_test(struct xdab_bitmap *bitmap,
32 		xfs_dablk_t dabno, xfs_extlen_t *len)
33 {
34 	return xbitmap32_test(&bitmap->dabitmap, dabno, len);
35 }
36 
37 #endif	/* __XFS_SCRUB_DAB_BITMAP_H__ */
38