1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
6 #ifndef __XFS_RTBITMAP_H__
7 #define __XFS_RTBITMAP_H__
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.
14 struct xfs_rtalloc_rec
{
15 xfs_rtblock_t ar_startext
;
16 xfs_rtbxlen_t ar_extcount
;
19 typedef int (*xfs_rtalloc_query_range_fn
)(
22 const struct xfs_rtalloc_rec
*rec
,
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
,
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
,
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
,
56 int xfs_rtalloc_extent_is_free(struct xfs_mount
*mp
, struct xfs_trans
*tp
,
57 xfs_rtblock_t start
, xfs_rtxlen_t len
,
60 * Free an extent in the realtime subvolume. Length is expressed in
61 * realtime extents, as is the block number.
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 */
69 /* Same as above, but in units of rt blocks. */
70 int xfs_rtfree_blocks(struct xfs_trans
*tp
, xfs_fsblock_t rtbno
,
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 */
81 #endif /* __XFS_RTBITMAP_H__ */