xfs_rtbitmap.h (a684c538bc14410565e8939393089670fa1e19dd) xfs_rtbitmap.h (fa5a387230861116c2434c20d29fc4b3fd077d24)
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
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
9static inline xfs_rtblock_t
10xfs_rtx_to_rtb(
11 struct xfs_mount *mp,
12 xfs_rtxnum_t rtx)
13{
14 return rtx * mp->m_sb.sb_rextsize;
15}
16
17static inline xfs_extlen_t
18xfs_rtxlen_to_extlen(
19 struct xfs_mount *mp,
20 xfs_rtxlen_t rtxlen)
21{
22 return rtxlen * mp->m_sb.sb_rextsize;
23}
24
9/*
25/*
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.
26 * Functions for walking free space rtextents in the realtime bitmap.
13 */
14struct xfs_rtalloc_rec {
27 */
28struct xfs_rtalloc_rec {
15 xfs_rtblock_t ar_startext;
16 xfs_rtblock_t ar_extcount;
29 xfs_rtxnum_t ar_startext;
30 xfs_rtbxlen_t ar_extcount;
17};
18
19typedef 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
26int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
31};
32
33typedef int (*xfs_rtalloc_query_range_fn)(
34 struct xfs_mount *mp,
35 struct xfs_trans *tp,
36 const struct xfs_rtalloc_rec *rec,
37 void *priv);
38
39#ifdef CONFIG_XFS_RT
40int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
27 xfs_rtblock_t block, int issum, struct xfs_buf **bpp);
41 xfs_fileoff_t block, int issum, struct xfs_buf **bpp);
28int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp,
42int 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);
43 xfs_rtxnum_t start, xfs_rtxlen_t len, int val,
44 xfs_rtxnum_t *new, int *stat);
31int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp,
45int 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);
46 xfs_rtxnum_t start, xfs_rtxnum_t limit,
47 xfs_rtxnum_t *rtblock);
34int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp,
48int 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);
49 xfs_rtxnum_t start, xfs_rtxnum_t limit,
50 xfs_rtxnum_t *rtblock);
37int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
51int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
38 xfs_rtblock_t start, xfs_rtxlen_t len, int val);
52 xfs_rtxnum_t start, xfs_rtxlen_t len, int val);
39int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
53int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
40 int log, xfs_rtblock_t bbno, int delta,
41 struct xfs_buf **rbpp, xfs_fsblock_t *rsb,
54 int log, xfs_fileoff_t bbno, int delta,
55 struct xfs_buf **rbpp, xfs_fileoff_t *rsb,
42 xfs_suminfo_t *sum);
43int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
56 xfs_suminfo_t *sum);
57int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
44 xfs_rtblock_t bbno, int delta, struct xfs_buf **rbpp,
45 xfs_fsblock_t *rsb);
58 xfs_fileoff_t bbno, int delta, struct xfs_buf **rbpp,
59 xfs_fileoff_t *rsb);
46int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
60int 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_fsblock_t *rsb);
61 xfs_rtxnum_t start, xfs_rtxlen_t len,
62 struct xfs_buf **rbpp, xfs_fileoff_t *rsb);
49int 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);
53int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
54 xfs_rtalloc_query_range_fn fn,
55 void *priv);
56int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
63int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
64 const struct xfs_rtalloc_rec *low_rec,
65 const struct xfs_rtalloc_rec *high_rec,
66 xfs_rtalloc_query_range_fn fn, void *priv);
67int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
68 xfs_rtalloc_query_range_fn fn,
69 void *priv);
70int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
57 xfs_rtblock_t start, xfs_rtxlen_t len,
71 xfs_rtxnum_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 */
63int /* error */
64xfs_rtfree_extent(
65 struct xfs_trans *tp, /* transaction pointer */
72 bool *is_free);
73/*
74 * Free an extent in the realtime subvolume. Length is expressed in
75 * realtime extents, as is the block number.
76 */
77int /* error */
78xfs_rtfree_extent(
79 struct xfs_trans *tp, /* transaction pointer */
66 xfs_rtblock_t bno, /* starting block number to free */
80 xfs_rtxnum_t start, /* starting rtext number to free */
67 xfs_rtxlen_t len); /* length of extent freed */
68
69/* Same as above, but in units of rt blocks. */
70int 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__ */
81 xfs_rtxlen_t len); /* length of extent freed */
82
83/* Same as above, but in units of rt blocks. */
84int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno,
85 xfs_filblks_t rtlen);
86#else /* CONFIG_XFS_RT */
87# define xfs_rtfree_extent(t,b,l) (-ENOSYS)
88# define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS)
89# define xfs_rtalloc_query_range(m,t,l,h,f,p) (-ENOSYS)
90# define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS)
91# define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS)
92# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS)
93#endif /* CONFIG_XFS_RT */
94
95#endif /* __XFS_RTBITMAP_H__ */