]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/xfs_extfree_item.h
640f8e220560d448b3892d370c6b582ca3347337
[thirdparty/xfsprogs-dev.git] / include / xfs_extfree_item.h
1 /*
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32 #ifndef __XFS_EXTFREE_ITEM_H__
33 #define __XFS_EXTFREE_ITEM_H__
34
35 struct xfs_mount;
36 struct xfs_zone;
37
38 typedef struct xfs_extent {
39 xfs_dfsbno_t ext_start;
40 xfs_extlen_t ext_len;
41 } xfs_extent_t;
42
43 /*
44 * This is the structure used to lay out an efi log item in the
45 * log. The efi_extents field is a variable size array whose
46 * size is given by efi_nextents.
47 */
48 typedef struct xfs_efi_log_format {
49 unsigned short efi_type; /* efi log item type */
50 unsigned short efi_size; /* size of this item */
51 uint efi_nextents; /* # extents to free */
52 __uint64_t efi_id; /* efi identifier */
53 xfs_extent_t efi_extents[1]; /* array of extents to free */
54 } xfs_efi_log_format_t;
55
56 /*
57 * This is the structure used to lay out an efd log item in the
58 * log. The efd_extents array is a variable size array whose
59 * size is given by efd_nextents;
60 */
61 typedef struct xfs_efd_log_format {
62 unsigned short efd_type; /* efd log item type */
63 unsigned short efd_size; /* size of this item */
64 uint efd_nextents; /* # of extents freed */
65 __uint64_t efd_efi_id; /* id of corresponding efi */
66 xfs_extent_t efd_extents[1]; /* array of extents freed */
67 } xfs_efd_log_format_t;
68
69
70 #ifdef __KERNEL__
71
72 /*
73 * Max number of extents in fast allocation path.
74 */
75 #define XFS_EFI_MAX_FAST_EXTENTS 16
76
77 /*
78 * Define EFI flags.
79 */
80 #define XFS_EFI_RECOVERED 0x1
81 #define XFS_EFI_COMMITTED 0x2
82 #define XFS_EFI_CANCELED 0x4
83
84 /*
85 * This is the "extent free intention" log item. It is used
86 * to log the fact that some extents need to be free. It is
87 * used in conjunction with the "extent free done" log item
88 * described below.
89 */
90 typedef struct xfs_efi_log_item {
91 xfs_log_item_t efi_item;
92 uint efi_flags; /* misc flags */
93 uint efi_next_extent;
94 xfs_efi_log_format_t efi_format;
95 } xfs_efi_log_item_t;
96
97 /*
98 * This is the "extent free done" log item. It is used to log
99 * the fact that some extents earlier mentioned in an efi item
100 * have been freed.
101 */
102 typedef struct xfs_efd_log_item {
103 xfs_log_item_t efd_item;
104 xfs_efi_log_item_t *efd_efip;
105 uint efd_next_extent;
106 xfs_efd_log_format_t efd_format;
107 } xfs_efd_log_item_t;
108
109 /*
110 * Max number of extents in fast allocation path.
111 */
112 #define XFS_EFD_MAX_FAST_EXTENTS 16
113
114 extern struct xfs_zone *xfs_efi_zone;
115 extern struct xfs_zone *xfs_efd_zone;
116
117 xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint);
118 xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *,
119 uint);
120
121 #endif /* __KERNEL__ */
122
123 #endif /* __XFS_EXTFREE_ITEM_H__ */