xref: /linux/fs/xfs/xfs_rtalloc.h (revision c148bc7535650fbfa95a1f571b9ffa2ab478ea33)
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_RTALLOC_H__
7 #define	__XFS_RTALLOC_H__
8 
9 /* kernel only definitions and functions */
10 
11 struct xfs_mount;
12 struct xfs_trans;
13 
14 #ifdef CONFIG_XFS_RT
15 /* rtgroup superblock initialization */
16 int xfs_rtmount_readsb(struct xfs_mount *mp);
17 void xfs_rtmount_freesb(struct xfs_mount *mp);
18 
19 /*
20  * Initialize realtime fields in the mount structure.
21  */
22 int					/* error */
23 xfs_rtmount_init(
24 	struct xfs_mount	*mp);	/* file system mount structure */
25 void
26 xfs_rtunmount_inodes(
27 	struct xfs_mount	*mp);
28 
29 /*
30  * Get the bitmap and summary inodes into the mount structure
31  * at mount time.
32  */
33 int					/* error */
34 xfs_rtmount_inodes(
35 	struct xfs_mount	*mp);	/* file system mount structure */
36 
37 /*
38  * Grow the realtime area of the filesystem.
39  */
40 int
41 xfs_growfs_rt(
42 	struct xfs_mount	*mp,	/* file system mount structure */
43 	xfs_growfs_rt_t		*in);	/* user supplied growfs struct */
44 
45 int xfs_rtalloc_reinit_frextents(struct xfs_mount *mp);
46 int xfs_growfs_check_rtgeom(const struct xfs_mount *mp, xfs_rfsblock_t dblocks,
47 		xfs_rfsblock_t rblocks, xfs_agblock_t rextsize);
48 #else
49 # define xfs_growfs_rt(mp,in)				(-ENOSYS)
50 # define xfs_rtalloc_reinit_frextents(m)		(0)
51 # define xfs_rtmount_readsb(mp)				(0)
52 # define xfs_rtmount_freesb(mp)				((void)0)
53 static inline int		/* error */
xfs_rtmount_init(xfs_mount_t * mp)54 xfs_rtmount_init(
55 	xfs_mount_t	*mp)	/* file system mount structure */
56 {
57 	if (mp->m_sb.sb_rblocks == 0)
58 		return 0;
59 
60 	xfs_warn(mp, "Not built with CONFIG_XFS_RT");
61 	return -ENOSYS;
62 }
63 # define xfs_rtmount_inodes(m)  (((mp)->m_sb.sb_rblocks == 0)? 0 : (-ENOSYS))
64 # define xfs_rtunmount_inodes(m)
65 
66 static inline int
xfs_growfs_check_rtgeom(const struct xfs_mount * mp,xfs_rfsblock_t dblocks,xfs_rfsblock_t rblocks,xfs_extlen_t rextsize)67 xfs_growfs_check_rtgeom(const struct xfs_mount *mp,
68 		xfs_rfsblock_t dblocks, xfs_rfsblock_t rblocks,
69 		xfs_extlen_t rextsize)
70 {
71 	return 0;
72 }
73 #endif	/* CONFIG_XFS_RT */
74 
75 int xfs_rtallocate_rtgs(struct xfs_trans *tp, xfs_fsblock_t bno_hint,
76 		xfs_rtxlen_t minlen, xfs_rtxlen_t maxlen, xfs_rtxlen_t prod,
77 		bool wasdel, bool initial_user_data, xfs_rtblock_t *bno,
78 		xfs_extlen_t *blen);
79 
80 #endif	/* __XFS_RTALLOC_H__ */
81