]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - libxfs/xfs_rtbitmap.h
xfs: convert rt bitmap extent lengths to xfs_rtbxlen_t
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_rtbitmap.h
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6 #ifndef __XFS_RTBITMAP_H__
7 #define __XFS_RTBITMAP_H__
8
9 /*
10 * XXX: Most of the realtime allocation functions deal in units of realtime
11 * extents, not realtime blocks. This looks funny when paired with the type
12 * name and screams for a larger cleanup.
13 */
14 struct xfs_rtalloc_rec {
15 xfs_rtblock_t ar_startext;
16 xfs_rtbxlen_t ar_extcount;
17 };
18
19 typedef int (*xfs_rtalloc_query_range_fn)(
20 struct xfs_mount *mp,
21 struct xfs_trans *tp,
22 const struct xfs_rtalloc_rec *rec,
23 void *priv);
24
25 #ifdef CONFIG_XFS_RT
26 int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
27 xfs_fileoff_t block, int issum, struct xfs_buf **bpp);
28 int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp,
29 xfs_rtblock_t start, xfs_rtxlen_t len, int val,
30 xfs_rtblock_t *new, int *stat);
31 int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp,
32 xfs_rtblock_t start, xfs_rtblock_t limit,
33 xfs_rtblock_t *rtblock);
34 int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp,
35 xfs_rtblock_t start, xfs_rtblock_t limit,
36 xfs_rtblock_t *rtblock);
37 int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
38 xfs_rtblock_t start, xfs_rtxlen_t len, int val);
39 int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
40 int log, xfs_fileoff_t bbno, int delta,
41 struct xfs_buf **rbpp, xfs_fileoff_t *rsb,
42 xfs_suminfo_t *sum);
43 int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
44 xfs_fileoff_t bbno, int delta, struct xfs_buf **rbpp,
45 xfs_fileoff_t *rsb);
46 int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
47 xfs_rtblock_t start, xfs_rtxlen_t len,
48 struct xfs_buf **rbpp, xfs_fileoff_t *rsb);
49 int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
50 const struct xfs_rtalloc_rec *low_rec,
51 const struct xfs_rtalloc_rec *high_rec,
52 xfs_rtalloc_query_range_fn fn, void *priv);
53 int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
54 xfs_rtalloc_query_range_fn fn,
55 void *priv);
56 int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
57 xfs_rtblock_t start, xfs_rtxlen_t len,
58 bool *is_free);
59 /*
60 * Free an extent in the realtime subvolume. Length is expressed in
61 * realtime extents, as is the block number.
62 */
63 int /* error */
64 xfs_rtfree_extent(
65 struct xfs_trans *tp, /* transaction pointer */
66 xfs_rtblock_t bno, /* starting block number to free */
67 xfs_rtxlen_t len); /* length of extent freed */
68
69 /* Same as above, but in units of rt blocks. */
70 int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno,
71 xfs_filblks_t rtlen);
72 #else /* CONFIG_XFS_RT */
73 # define xfs_rtfree_extent(t,b,l) (-ENOSYS)
74 # define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS)
75 # define xfs_rtalloc_query_range(m,t,l,h,f,p) (-ENOSYS)
76 # define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS)
77 # define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS)
78 # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS)
79 #endif /* CONFIG_XFS_RT */
80
81 #endif /* __XFS_RTBITMAP_H__ */