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 void xfs_rt_resv_free(struct xfs_mount *mp); 38 int xfs_rt_resv_init(struct xfs_mount *mp); 39 40 /* 41 * Grow the realtime area of the filesystem. 42 */ 43 int 44 xfs_growfs_rt( 45 struct xfs_mount *mp, /* file system mount structure */ 46 xfs_growfs_rt_t *in); /* user supplied growfs struct */ 47 48 int xfs_rtalloc_reinit_frextents(struct xfs_mount *mp); 49 int xfs_growfs_check_rtgeom(const struct xfs_mount *mp, xfs_rfsblock_t dblocks, 50 xfs_rfsblock_t rblocks, xfs_agblock_t rextsize); 51 #else 52 # define xfs_growfs_rt(mp,in) (-ENOSYS) 53 # define xfs_rtalloc_reinit_frextents(m) (0) 54 # define xfs_rtmount_readsb(mp) (0) 55 # define xfs_rtmount_freesb(mp) ((void)0) 56 static inline int /* error */ 57 xfs_rtmount_init( 58 xfs_mount_t *mp) /* file system mount structure */ 59 { 60 if (mp->m_sb.sb_rblocks == 0) 61 return 0; 62 63 xfs_warn(mp, "Not built with CONFIG_XFS_RT"); 64 return -ENOSYS; 65 } 66 # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (-ENOSYS)) 67 # define xfs_rtunmount_inodes(m) 68 # define xfs_rt_resv_free(mp) ((void)0) 69 # define xfs_rt_resv_init(mp) (0) 70 71 static inline int 72 xfs_growfs_check_rtgeom(const struct xfs_mount *mp, 73 xfs_rfsblock_t dblocks, xfs_rfsblock_t rblocks, 74 xfs_extlen_t rextsize) 75 { 76 return 0; 77 } 78 #endif /* CONFIG_XFS_RT */ 79 80 int xfs_rtallocate_rtgs(struct xfs_trans *tp, xfs_fsblock_t bno_hint, 81 xfs_rtxlen_t minlen, xfs_rtxlen_t maxlen, xfs_rtxlen_t prod, 82 bool wasdel, bool initial_user_data, xfs_rtblock_t *bno, 83 xfs_extlen_t *blen); 84 85 #endif /* __XFS_RTALLOC_H__ */ 86