[PATCH] fs/9p/: possible cleanups
[linux-2.6/libata-dev.git] / fs / xfs / xfs_extfree_item.h
blob5bf681708fec915348cf0324b9392c81fa7f0287
1 /*
2 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
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.
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.
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
18 #ifndef __XFS_EXTFREE_ITEM_H__
19 #define __XFS_EXTFREE_ITEM_H__
21 struct xfs_mount;
22 struct kmem_zone;
24 typedef struct xfs_extent {
25 xfs_dfsbno_t ext_start;
26 xfs_extlen_t ext_len;
27 } xfs_extent_t;
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.
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;
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;
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;
56 #ifdef __KERNEL__
59 * Max number of extents in fast allocation path.
61 #define XFS_EFI_MAX_FAST_EXTENTS 16
64 * Define EFI flags.
66 #define XFS_EFI_RECOVERED 0x1
67 #define XFS_EFI_COMMITTED 0x2
68 #define XFS_EFI_CANCELED 0x4
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.
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;
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.
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;
96 * Max number of extents in fast allocation path.
98 #define XFS_EFD_MAX_FAST_EXTENTS 16
100 extern struct kmem_zone *xfs_efi_zone;
101 extern struct kmem_zone *xfs_efd_zone;
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);
107 void xfs_efi_item_free(xfs_efi_log_item_t *);
109 #endif /* __KERNEL__ */
111 #endif /* __XFS_EXTFREE_ITEM_H__ */