hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/fs/xfs/libxfs/xfs_rmap.h
....@@ -7,16 +7,6 @@
77 #define __XFS_RMAP_H__
88
99 static inline void
10
-xfs_rmap_ag_owner(
11
- struct xfs_owner_info *oi,
12
- uint64_t owner)
13
-{
14
- oi->oi_owner = owner;
15
- oi->oi_offset = 0;
16
- oi->oi_flags = 0;
17
-}
18
-
19
-static inline void
2010 xfs_rmap_ino_bmbt_owner(
2111 struct xfs_owner_info *oi,
2212 xfs_ino_t ino,
....@@ -43,25 +33,11 @@
4333 oi->oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
4434 }
4535
46
-static inline void
47
-xfs_rmap_skip_owner_update(
48
- struct xfs_owner_info *oi)
49
-{
50
- xfs_rmap_ag_owner(oi, XFS_RMAP_OWN_NULL);
51
-}
52
-
5336 static inline bool
5437 xfs_rmap_should_skip_owner_update(
55
- struct xfs_owner_info *oi)
38
+ const struct xfs_owner_info *oi)
5639 {
5740 return oi->oi_owner == XFS_RMAP_OWN_NULL;
58
-}
59
-
60
-static inline void
61
-xfs_rmap_any_owner_update(
62
- struct xfs_owner_info *oi)
63
-{
64
- xfs_rmap_ag_owner(oi, XFS_RMAP_OWN_UNKNOWN);
6541 }
6642
6743 /* Reverse mapping functions. */
....@@ -92,6 +68,7 @@
9268 if (offset & ~(XFS_RMAP_OFF_MASK | XFS_RMAP_OFF_FLAGS))
9369 return -EFSCORRUPTED;
9470 irec->rm_offset = XFS_RMAP_OFF(offset);
71
+ irec->rm_flags = 0;
9572 if (offset & XFS_RMAP_OFF_ATTR_FORK)
9673 irec->rm_flags |= XFS_RMAP_ATTR_FORK;
9774 if (offset & XFS_RMAP_OFF_BMBT_BLOCK)
....@@ -103,12 +80,12 @@
10380
10481 static inline void
10582 xfs_owner_info_unpack(
106
- struct xfs_owner_info *oinfo,
107
- uint64_t *owner,
108
- uint64_t *offset,
109
- unsigned int *flags)
83
+ const struct xfs_owner_info *oinfo,
84
+ uint64_t *owner,
85
+ uint64_t *offset,
86
+ unsigned int *flags)
11087 {
111
- unsigned int r = 0;
88
+ unsigned int r = 0;
11289
11390 *owner = oinfo->oi_owner;
11491 *offset = oinfo->oi_offset;
....@@ -137,10 +114,10 @@
137114
138115 int xfs_rmap_alloc(struct xfs_trans *tp, struct xfs_buf *agbp,
139116 xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len,
140
- struct xfs_owner_info *oinfo);
117
+ const struct xfs_owner_info *oinfo);
141118 int xfs_rmap_free(struct xfs_trans *tp, struct xfs_buf *agbp,
142119 xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len,
143
- struct xfs_owner_info *oinfo);
120
+ const struct xfs_owner_info *oinfo);
144121
145122 int xfs_rmap_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno,
146123 xfs_extlen_t len, uint64_t owner, uint64_t offset,
....@@ -185,16 +162,16 @@
185162 };
186163
187164 /* functions for updating the rmapbt based on bmbt map/unmap operations */
188
-int xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
165
+void xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
189166 int whichfork, struct xfs_bmbt_irec *imap);
190
-int xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
167
+void xfs_rmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
191168 int whichfork, struct xfs_bmbt_irec *imap);
192
-int xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp,
169
+void xfs_rmap_convert_extent(struct xfs_mount *mp, struct xfs_trans *tp,
193170 struct xfs_inode *ip, int whichfork,
194171 struct xfs_bmbt_irec *imap);
195
-int xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
172
+void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
196173 xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
197
-int xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
174
+void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
198175 xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
199176
200177 void xfs_rmap_finish_one_cleanup(struct xfs_trans *tp,
....@@ -218,11 +195,21 @@
218195 int xfs_rmap_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno,
219196 xfs_extlen_t len, bool *exists);
220197 int xfs_rmap_record_exists(struct xfs_btree_cur *cur, xfs_agblock_t bno,
221
- xfs_extlen_t len, struct xfs_owner_info *oinfo,
198
+ xfs_extlen_t len, const struct xfs_owner_info *oinfo,
222199 bool *has_rmap);
223200 int xfs_rmap_has_other_keys(struct xfs_btree_cur *cur, xfs_agblock_t bno,
224
- xfs_extlen_t len, struct xfs_owner_info *oinfo,
201
+ xfs_extlen_t len, const struct xfs_owner_info *oinfo,
225202 bool *has_rmap);
226203 int xfs_rmap_map_raw(struct xfs_btree_cur *cur, struct xfs_rmap_irec *rmap);
227204
205
+extern const struct xfs_owner_info XFS_RMAP_OINFO_SKIP_UPDATE;
206
+extern const struct xfs_owner_info XFS_RMAP_OINFO_ANY_OWNER;
207
+extern const struct xfs_owner_info XFS_RMAP_OINFO_FS;
208
+extern const struct xfs_owner_info XFS_RMAP_OINFO_LOG;
209
+extern const struct xfs_owner_info XFS_RMAP_OINFO_AG;
210
+extern const struct xfs_owner_info XFS_RMAP_OINFO_INOBT;
211
+extern const struct xfs_owner_info XFS_RMAP_OINFO_INODES;
212
+extern const struct xfs_owner_info XFS_RMAP_OINFO_REFC;
213
+extern const struct xfs_owner_info XFS_RMAP_OINFO_COW;
214
+
228215 #endif /* __XFS_RMAP_H__ */