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 static inline int 50 xfs_growfs_rt( 51 struct xfs_mount *mp, 52 struct xfs_growfs_rt *in) 53 { 54 return -ENOSYS; 55 } 56 57 static inline int 58 xfs_rtalloc_reinit_frextents( 59 struct xfs_mount *mp) 60 { 61 return 0; 62 } 63 64 static inline int 65 xfs_rtmount_readsb( 66 struct xfs_mount *mp) 67 { 68 return 0; 69 } 70 71 static inline void 72 xfs_rtmount_freesb( 73 struct xfs_mount *mp) 74 { 75 } 76 77 static inline int /* error */ 78 xfs_rtmount_init( 79 xfs_mount_t *mp) /* file system mount structure */ 80 { 81 if (mp->m_sb.sb_rblocks == 0) 82 return 0; 83 84 xfs_warn(mp, "Not built with CONFIG_XFS_RT"); 85 return -ENOSYS; 86 } 87 88 static inline int 89 xfs_rtmount_inodes( 90 struct xfs_mount *mp) 91 { 92 if (mp->m_sb.sb_rblocks) 93 return -ENOSYS; 94 return 0; 95 } 96 97 static inline void 98 xfs_rtunmount_inodes( 99 struct xfs_mount *mp) 100 { 101 } 102 103 static inline int 104 xfs_growfs_check_rtgeom(const struct xfs_mount *mp, 105 xfs_rfsblock_t dblocks, xfs_rfsblock_t rblocks, 106 xfs_extlen_t rextsize) 107 { 108 return 0; 109 } 110 #endif /* CONFIG_XFS_RT */ 111 112 int xfs_rtallocate_rtgs(struct xfs_trans *tp, xfs_fsblock_t bno_hint, 113 xfs_rtxlen_t minlen, xfs_rtxlen_t maxlen, xfs_rtxlen_t prod, 114 bool wasdel, bool initial_user_data, xfs_rtblock_t *bno, 115 xfs_extlen_t *blen); 116 117 #endif /* __XFS_RTALLOC_H__ */ 118