Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
7b718769 NS |
2 | * Copyright (c) 2000,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
1da177e4 | 4 | * |
7b718769 NS |
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 | |
1da177e4 LT |
7 | * published by the Free Software Foundation. |
8 | * | |
7b718769 NS |
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. | |
1da177e4 | 13 | * |
7b718769 NS |
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 | |
1da177e4 LT |
17 | */ |
18 | #ifndef __XFS_EXTFREE_ITEM_H__ | |
19 | #define __XFS_EXTFREE_ITEM_H__ | |
20 | ||
9fbe24d9 DC |
21 | /* kernel only EFI/EFD definitions */ |
22 | ||
1da177e4 LT |
23 | struct xfs_mount; |
24 | struct kmem_zone; | |
25 | ||
1da177e4 LT |
26 | /* |
27 | * Max number of extents in fast allocation path. | |
28 | */ | |
29 | #define XFS_EFI_MAX_FAST_EXTENTS 16 | |
30 | ||
31 | /* | |
b199c8a4 | 32 | * Define EFI flag bits. Manipulated by set/clear/test_bit operators. |
1da177e4 | 33 | */ |
b199c8a4 | 34 | #define XFS_EFI_RECOVERED 1 |
1da177e4 LT |
35 | |
36 | /* | |
666d644c DC |
37 | * This is the "extent free intention" log item. It is used to log the fact |
38 | * that some extents need to be free. It is used in conjunction with the | |
39 | * "extent free done" log item described below. | |
40 | * | |
41 | * The EFI is reference counted so that it is not freed prior to both the EFI | |
42 | * and EFD being committed and unpinned. This ensures that when the last | |
43 | * reference goes away the EFI will always be in the AIL as it has been | |
44 | * unpinned, regardless of whether the EFD is processed before or after the EFI. | |
1da177e4 LT |
45 | */ |
46 | typedef struct xfs_efi_log_item { | |
47 | xfs_log_item_t efi_item; | |
666d644c | 48 | atomic_t efi_refcount; |
b199c8a4 DC |
49 | atomic_t efi_next_extent; |
50 | unsigned long efi_flags; /* misc flags */ | |
1da177e4 LT |
51 | xfs_efi_log_format_t efi_format; |
52 | } xfs_efi_log_item_t; | |
53 | ||
54 | /* | |
55 | * This is the "extent free done" log item. It is used to log | |
56 | * the fact that some extents earlier mentioned in an efi item | |
57 | * have been freed. | |
58 | */ | |
59 | typedef struct xfs_efd_log_item { | |
60 | xfs_log_item_t efd_item; | |
61 | xfs_efi_log_item_t *efd_efip; | |
62 | uint efd_next_extent; | |
63 | xfs_efd_log_format_t efd_format; | |
64 | } xfs_efd_log_item_t; | |
65 | ||
66 | /* | |
67 | * Max number of extents in fast allocation path. | |
68 | */ | |
69 | #define XFS_EFD_MAX_FAST_EXTENTS 16 | |
70 | ||
71 | extern struct kmem_zone *xfs_efi_zone; | |
72 | extern struct kmem_zone *xfs_efd_zone; | |
73 | ||
74 | xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint); | |
75 | xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *, | |
76 | uint); | |
6d192a9b TS |
77 | int xfs_efi_copy_format(xfs_log_iovec_t *buf, |
78 | xfs_efi_log_format_t *dst_efi_fmt); | |
7d795ca3 CH |
79 | void xfs_efi_item_free(xfs_efi_log_item_t *); |
80 | ||
1da177e4 | 81 | #endif /* __XFS_EXTFREE_ITEM_H__ */ |