2023-10-16 09:21:47 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_RTBITMAP_H__
|
|
|
|
#define __XFS_RTBITMAP_H__
|
|
|
|
|
2023-10-16 09:32:54 -07:00
|
|
|
static inline xfs_rtblock_t
|
|
|
|
xfs_rtx_to_rtb(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
xfs_rtxnum_t rtx)
|
|
|
|
{
|
|
|
|
return rtx * mp->m_sb.sb_rextsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline xfs_extlen_t
|
|
|
|
xfs_rtxlen_to_extlen(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
xfs_rtxlen_t rtxlen)
|
|
|
|
{
|
|
|
|
return rtxlen * mp->m_sb.sb_rextsize;
|
|
|
|
}
|
|
|
|
|
2023-10-16 09:34:39 -07:00
|
|
|
/* Compute the misalignment between an extent length and a realtime extent .*/
|
|
|
|
static inline unsigned int
|
|
|
|
xfs_extlen_to_rtxmod(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
xfs_extlen_t len)
|
|
|
|
{
|
|
|
|
return len % mp->m_sb.sb_rextsize;
|
|
|
|
}
|
|
|
|
|
2023-10-16 09:21:47 -07:00
|
|
|
/*
|
2023-10-16 09:32:45 -07:00
|
|
|
* Functions for walking free space rtextents in the realtime bitmap.
|
2023-10-16 09:21:47 -07:00
|
|
|
*/
|
|
|
|
struct xfs_rtalloc_rec {
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t ar_startext;
|
2023-10-16 09:31:12 -07:00
|
|
|
xfs_rtbxlen_t ar_extcount;
|
2023-10-16 09:21:47 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef int (*xfs_rtalloc_query_range_fn)(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
struct xfs_trans *tp,
|
|
|
|
const struct xfs_rtalloc_rec *rec,
|
|
|
|
void *priv);
|
|
|
|
|
|
|
|
#ifdef CONFIG_XFS_RT
|
|
|
|
int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:31:11 -07:00
|
|
|
xfs_fileoff_t block, int issum, struct xfs_buf **bpp);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, xfs_rtxlen_t len, int val,
|
|
|
|
xfs_rtxnum_t *new, int *stat);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, xfs_rtxnum_t limit,
|
|
|
|
xfs_rtxnum_t *rtblock);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, xfs_rtxnum_t limit,
|
|
|
|
xfs_rtxnum_t *rtblock);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, xfs_rtxlen_t len, int val);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:31:11 -07:00
|
|
|
int log, xfs_fileoff_t bbno, int delta,
|
|
|
|
struct xfs_buf **rbpp, xfs_fileoff_t *rsb,
|
2023-10-16 09:21:47 -07:00
|
|
|
xfs_suminfo_t *sum);
|
|
|
|
int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
|
2023-10-16 09:31:11 -07:00
|
|
|
xfs_fileoff_t bbno, int delta, struct xfs_buf **rbpp,
|
|
|
|
xfs_fileoff_t *rsb);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, xfs_rtxlen_t len,
|
2023-10-16 09:31:11 -07:00
|
|
|
struct xfs_buf **rbpp, xfs_fileoff_t *rsb);
|
2023-10-16 09:21:47 -07:00
|
|
|
int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
|
|
|
const struct xfs_rtalloc_rec *low_rec,
|
|
|
|
const struct xfs_rtalloc_rec *high_rec,
|
|
|
|
xfs_rtalloc_query_range_fn fn, void *priv);
|
|
|
|
int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
|
|
|
|
xfs_rtalloc_query_range_fn fn,
|
|
|
|
void *priv);
|
|
|
|
int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, xfs_rtxlen_t len,
|
2023-10-16 09:21:47 -07:00
|
|
|
bool *is_free);
|
|
|
|
/*
|
|
|
|
* Free an extent in the realtime subvolume. Length is expressed in
|
|
|
|
* realtime extents, as is the block number.
|
|
|
|
*/
|
|
|
|
int /* error */
|
|
|
|
xfs_rtfree_extent(
|
|
|
|
struct xfs_trans *tp, /* transaction pointer */
|
2023-10-16 09:32:45 -07:00
|
|
|
xfs_rtxnum_t start, /* starting rtext number to free */
|
2023-10-16 09:31:11 -07:00
|
|
|
xfs_rtxlen_t len); /* length of extent freed */
|
2023-10-16 09:21:47 -07:00
|
|
|
|
|
|
|
/* Same as above, but in units of rt blocks. */
|
|
|
|
int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno,
|
|
|
|
xfs_filblks_t rtlen);
|
|
|
|
#else /* CONFIG_XFS_RT */
|
|
|
|
# define xfs_rtfree_extent(t,b,l) (-ENOSYS)
|
|
|
|
# define xfs_rtfree_blocks(t,rb,rl) (-ENOSYS)
|
|
|
|
# define xfs_rtalloc_query_range(m,t,l,h,f,p) (-ENOSYS)
|
|
|
|
# define xfs_rtalloc_query_all(m,t,f,p) (-ENOSYS)
|
|
|
|
# define xfs_rtbuf_get(m,t,b,i,p) (-ENOSYS)
|
|
|
|
# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS)
|
|
|
|
#endif /* CONFIG_XFS_RT */
|
|
|
|
|
|
|
|
#endif /* __XFS_RTBITMAP_H__ */
|