hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/xfs/libxfs/xfs_alloc.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
44 * All Rights Reserved.
....@@ -54,7 +54,6 @@
5454 struct xfs_mount *mp; /* file system mount point */
5555 struct xfs_buf *agbp; /* buffer for a.g. freelist header */
5656 struct xfs_perag *pag; /* per-ag struct for this agno */
57
- struct xfs_inode *ip; /* for userdata zeroing method */
5857 xfs_fsblock_t fsbno; /* file system block number */
5958 xfs_agnumber_t agno; /* allocation group number */
6059 xfs_agblock_t agbno; /* allocation group-relative block # */
....@@ -83,20 +82,7 @@
8382 */
8483 #define XFS_ALLOC_USERDATA (1 << 0)/* allocation is for user data*/
8584 #define XFS_ALLOC_INITIAL_USER_DATA (1 << 1)/* special case start of file */
86
-#define XFS_ALLOC_USERDATA_ZERO (1 << 2)/* zero extent on allocation */
87
-#define XFS_ALLOC_NOBUSY (1 << 3)/* Busy extents not allowed */
88
-
89
-static inline bool
90
-xfs_alloc_is_userdata(int datatype)
91
-{
92
- return (datatype & ~XFS_ALLOC_NOBUSY) != 0;
93
-}
94
-
95
-static inline bool
96
-xfs_alloc_allow_busy_reuse(int datatype)
97
-{
98
- return (datatype & XFS_ALLOC_NOBUSY) == 0;
99
-}
85
+#define XFS_ALLOC_NOBUSY (1 << 2)/* Busy extents not allowed */
10086
10187 /* freespace limit calculations */
10288 #define XFS_ALLOC_AGFL_RESERVE 4
....@@ -182,7 +168,7 @@
182168 struct xfs_trans *tp, /* transaction pointer */
183169 xfs_fsblock_t bno, /* starting block number of extent */
184170 xfs_extlen_t len, /* length of extent */
185
- struct xfs_owner_info *oinfo, /* extent owner */
171
+ const struct xfs_owner_info *oinfo, /* extent owner */
186172 enum xfs_ag_resv_type type, /* block reservation type */
187173 bool skip_discard);
188174
....@@ -191,7 +177,7 @@
191177 struct xfs_trans *tp,
192178 xfs_fsblock_t bno,
193179 xfs_extlen_t len,
194
- struct xfs_owner_info *oinfo,
180
+ const struct xfs_owner_info *oinfo,
195181 enum xfs_ag_resv_type type)
196182 {
197183 return __xfs_free_extent(tp, bno, len, oinfo, type, false);
....@@ -250,4 +236,13 @@
250236 int xfs_agfl_walk(struct xfs_mount *mp, struct xfs_agf *agf,
251237 struct xfs_buf *agflbp, xfs_agfl_walk_fn walk_fn, void *priv);
252238
239
+static inline __be32 *
240
+xfs_buf_to_agfl_bno(
241
+ struct xfs_buf *bp)
242
+{
243
+ if (xfs_sb_version_hascrc(&bp->b_mount->m_sb))
244
+ return bp->b_addr + sizeof(struct xfs_agfl);
245
+ return bp->b_addr;
246
+}
247
+
253248 #endif /* __XFS_ALLOC_H__ */