]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/gnu/fs/xfs/xfs_extfree_item.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / gnu / fs / xfs / xfs_extfree_item.h
1 /*
2  * Copyright (c) 2000,2005 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write the Free Software Foundation,
16  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 #ifndef __XFS_EXTFREE_ITEM_H__
19 #define __XFS_EXTFREE_ITEM_H__
20
21 struct xfs_mount;
22 struct kmem_zone;
23
24 typedef struct xfs_extent {
25         xfs_dfsbno_t    ext_start;
26         xfs_extlen_t    ext_len;
27 } xfs_extent_t;
28
29 /*
30  * This is the structure used to lay out an efi log item in the
31  * log.  The efi_extents field is a variable size array whose
32  * size is given by efi_nextents.
33  */
34 typedef struct xfs_efi_log_format {
35         unsigned short          efi_type;       /* efi log item type */
36         unsigned short          efi_size;       /* size of this item */
37         uint                    efi_nextents;   /* # extents to free */
38         __uint64_t              efi_id;         /* efi identifier */
39         xfs_extent_t            efi_extents[1]; /* array of extents to free */
40 } xfs_efi_log_format_t;
41
42 /*
43  * This is the structure used to lay out an efd log item in the
44  * log.  The efd_extents array is a variable size array whose
45  * size is given by efd_nextents;
46  */
47 typedef struct xfs_efd_log_format {
48         unsigned short          efd_type;       /* efd log item type */
49         unsigned short          efd_size;       /* size of this item */
50         uint                    efd_nextents;   /* # of extents freed */
51         __uint64_t              efd_efi_id;     /* id of corresponding efi */
52         xfs_extent_t            efd_extents[1]; /* array of extents freed */
53 } xfs_efd_log_format_t;
54
55
56 #ifdef __KERNEL__
57
58 /*
59  * Max number of extents in fast allocation path.
60  */
61 #define XFS_EFI_MAX_FAST_EXTENTS        16
62
63 /*
64  * Define EFI flags.
65  */
66 #define XFS_EFI_RECOVERED       0x1
67 #define XFS_EFI_COMMITTED       0x2
68 #define XFS_EFI_CANCELED        0x4
69
70 /*
71  * This is the "extent free intention" log item.  It is used
72  * to log the fact that some extents need to be free.  It is
73  * used in conjunction with the "extent free done" log item
74  * described below.
75  */
76 typedef struct xfs_efi_log_item {
77         xfs_log_item_t          efi_item;
78         uint                    efi_flags;      /* misc flags */
79         uint                    efi_next_extent;
80         xfs_efi_log_format_t    efi_format;
81 } xfs_efi_log_item_t;
82
83 /*
84  * This is the "extent free done" log item.  It is used to log
85  * the fact that some extents earlier mentioned in an efi item
86  * have been freed.
87  */
88 typedef struct xfs_efd_log_item {
89         xfs_log_item_t          efd_item;
90         xfs_efi_log_item_t      *efd_efip;
91         uint                    efd_next_extent;
92         xfs_efd_log_format_t    efd_format;
93 } xfs_efd_log_item_t;
94
95 /*
96  * Max number of extents in fast allocation path.
97  */
98 #define XFS_EFD_MAX_FAST_EXTENTS        16
99
100 extern struct kmem_zone *xfs_efi_zone;
101 extern struct kmem_zone *xfs_efd_zone;
102
103 xfs_efi_log_item_t      *xfs_efi_init(struct xfs_mount *, uint);
104 xfs_efd_log_item_t      *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *,
105                                       uint);
106
107 void                    xfs_efi_item_free(xfs_efi_log_item_t *);
108
109 #endif  /* __KERNEL__ */
110
111 #endif  /* __XFS_EXTFREE_ITEM_H__ */