]>
Commit | Line | Data |
---|---|---|
340785cc DW |
1 | /* |
2 | * Copyright (C) 2016 Oracle. All Rights Reserved. | |
3 | * | |
4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it would be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write the Free Software Foundation, | |
18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | */ | |
20 | #ifndef __XFS_RMAP_H__ | |
21 | #define __XFS_RMAP_H__ | |
22 | ||
23 | static inline void | |
24 | xfs_rmap_ag_owner( | |
25 | struct xfs_owner_info *oi, | |
26 | uint64_t owner) | |
27 | { | |
28 | oi->oi_owner = owner; | |
29 | oi->oi_offset = 0; | |
30 | oi->oi_flags = 0; | |
31 | } | |
32 | ||
33 | static inline void | |
34 | xfs_rmap_ino_bmbt_owner( | |
35 | struct xfs_owner_info *oi, | |
36 | xfs_ino_t ino, | |
37 | int whichfork) | |
38 | { | |
39 | oi->oi_owner = ino; | |
40 | oi->oi_offset = 0; | |
41 | oi->oi_flags = XFS_OWNER_INFO_BMBT_BLOCK; | |
42 | if (whichfork == XFS_ATTR_FORK) | |
43 | oi->oi_flags |= XFS_OWNER_INFO_ATTR_FORK; | |
44 | } | |
45 | ||
46 | static inline void | |
47 | xfs_rmap_ino_owner( | |
48 | struct xfs_owner_info *oi, | |
49 | xfs_ino_t ino, | |
50 | int whichfork, | |
51 | xfs_fileoff_t offset) | |
52 | { | |
53 | oi->oi_owner = ino; | |
54 | oi->oi_offset = offset; | |
55 | oi->oi_flags = 0; | |
56 | if (whichfork == XFS_ATTR_FORK) | |
57 | oi->oi_flags |= XFS_OWNER_INFO_ATTR_FORK; | |
58 | } | |
59 | ||
60 | static inline void | |
61 | xfs_rmap_skip_owner_update( | |
62 | struct xfs_owner_info *oi) | |
63 | { | |
64 | oi->oi_owner = XFS_RMAP_OWN_UNKNOWN; | |
65 | } | |
66 | ||
673930c3 DW |
67 | /* Reverse mapping functions. */ |
68 | ||
69 | struct xfs_buf; | |
70 | ||
71 | int xfs_rmap_alloc(struct xfs_trans *tp, struct xfs_buf *agbp, | |
72 | xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len, | |
73 | struct xfs_owner_info *oinfo); | |
74 | int xfs_rmap_free(struct xfs_trans *tp, struct xfs_buf *agbp, | |
75 | xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len, | |
76 | struct xfs_owner_info *oinfo); | |
77 | ||
340785cc | 78 | #endif /* __XFS_RMAP_H__ */ |