summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/rgb_bitmap.h
blob: 4c3126b66dcb96753ad0260f1b22fe577364c34d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2020-2024 Oracle.  All Rights Reserved.
 * Author: Darrick J. Wong <djwong@kernel.org>
 */
#ifndef __XFS_SCRUB_RGB_BITMAP_H__
#define __XFS_SCRUB_RGB_BITMAP_H__

/* Bitmaps, but for type-checked for xfs_rgblock_t */

struct xrgb_bitmap {
	struct xbitmap32	rgbitmap;
};

static inline void xrgb_bitmap_init(struct xrgb_bitmap *bitmap)
{
	xbitmap32_init(&bitmap->rgbitmap);
}

static inline void xrgb_bitmap_destroy(struct xrgb_bitmap *bitmap)
{
	xbitmap32_destroy(&bitmap->rgbitmap);
}

static inline int xrgb_bitmap_set(struct xrgb_bitmap *bitmap,
		xfs_rgblock_t start, xfs_extlen_t len)
{
	return xbitmap32_set(&bitmap->rgbitmap, start, len);
}

static inline int xrgb_bitmap_walk(struct xrgb_bitmap *bitmap,
		xbitmap32_walk_fn fn, void *priv)
{
	return xbitmap32_walk(&bitmap->rgbitmap, fn, priv);
}

#endif /* __XFS_SCRUB_RGB_BITMAP_H__ */