11da177e4SLinus Torvalds /* 27b718769SNathan Scott * Copyright (c) 2000,2005 Silicon Graphics, Inc. 37b718769SNathan Scott * All Rights Reserved. 41da177e4SLinus Torvalds * 57b718769SNathan Scott * This program is free software; you can redistribute it and/or 67b718769SNathan Scott * modify it under the terms of the GNU General Public License as 71da177e4SLinus Torvalds * published by the Free Software Foundation. 81da177e4SLinus Torvalds * 97b718769SNathan Scott * This program is distributed in the hope that it would be useful, 107b718769SNathan Scott * but WITHOUT ANY WARRANTY; without even the implied warranty of 117b718769SNathan Scott * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 127b718769SNathan Scott * GNU General Public License for more details. 131da177e4SLinus Torvalds * 147b718769SNathan Scott * You should have received a copy of the GNU General Public License 157b718769SNathan Scott * along with this program; if not, write the Free Software Foundation, 167b718769SNathan Scott * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 171da177e4SLinus Torvalds */ 181da177e4SLinus Torvalds #ifndef __XFS_EXTFREE_ITEM_H__ 191da177e4SLinus Torvalds #define __XFS_EXTFREE_ITEM_H__ 201da177e4SLinus Torvalds 21*9fbe24d9SDave Chinner /* kernel only EFI/EFD definitions */ 22*9fbe24d9SDave Chinner 231da177e4SLinus Torvalds struct xfs_mount; 241da177e4SLinus Torvalds struct kmem_zone; 251da177e4SLinus Torvalds 261da177e4SLinus Torvalds /* 271da177e4SLinus Torvalds * Max number of extents in fast allocation path. 281da177e4SLinus Torvalds */ 291da177e4SLinus Torvalds #define XFS_EFI_MAX_FAST_EXTENTS 16 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds /* 32b199c8a4SDave Chinner * Define EFI flag bits. Manipulated by set/clear/test_bit operators. 331da177e4SLinus Torvalds */ 34b199c8a4SDave Chinner #define XFS_EFI_RECOVERED 1 351da177e4SLinus Torvalds 361da177e4SLinus Torvalds /* 37666d644cSDave Chinner * This is the "extent free intention" log item. It is used to log the fact 38666d644cSDave Chinner * that some extents need to be free. It is used in conjunction with the 39666d644cSDave Chinner * "extent free done" log item described below. 40666d644cSDave Chinner * 41666d644cSDave Chinner * The EFI is reference counted so that it is not freed prior to both the EFI 42666d644cSDave Chinner * and EFD being committed and unpinned. This ensures that when the last 43666d644cSDave Chinner * reference goes away the EFI will always be in the AIL as it has been 44666d644cSDave Chinner * unpinned, regardless of whether the EFD is processed before or after the EFI. 451da177e4SLinus Torvalds */ 461da177e4SLinus Torvalds typedef struct xfs_efi_log_item { 471da177e4SLinus Torvalds xfs_log_item_t efi_item; 48666d644cSDave Chinner atomic_t efi_refcount; 49b199c8a4SDave Chinner atomic_t efi_next_extent; 50b199c8a4SDave Chinner unsigned long efi_flags; /* misc flags */ 511da177e4SLinus Torvalds xfs_efi_log_format_t efi_format; 521da177e4SLinus Torvalds } xfs_efi_log_item_t; 531da177e4SLinus Torvalds 541da177e4SLinus Torvalds /* 551da177e4SLinus Torvalds * This is the "extent free done" log item. It is used to log 561da177e4SLinus Torvalds * the fact that some extents earlier mentioned in an efi item 571da177e4SLinus Torvalds * have been freed. 581da177e4SLinus Torvalds */ 591da177e4SLinus Torvalds typedef struct xfs_efd_log_item { 601da177e4SLinus Torvalds xfs_log_item_t efd_item; 611da177e4SLinus Torvalds xfs_efi_log_item_t *efd_efip; 621da177e4SLinus Torvalds uint efd_next_extent; 631da177e4SLinus Torvalds xfs_efd_log_format_t efd_format; 641da177e4SLinus Torvalds } xfs_efd_log_item_t; 651da177e4SLinus Torvalds 661da177e4SLinus Torvalds /* 671da177e4SLinus Torvalds * Max number of extents in fast allocation path. 681da177e4SLinus Torvalds */ 691da177e4SLinus Torvalds #define XFS_EFD_MAX_FAST_EXTENTS 16 701da177e4SLinus Torvalds 711da177e4SLinus Torvalds extern struct kmem_zone *xfs_efi_zone; 721da177e4SLinus Torvalds extern struct kmem_zone *xfs_efd_zone; 731da177e4SLinus Torvalds 741da177e4SLinus Torvalds xfs_efi_log_item_t *xfs_efi_init(struct xfs_mount *, uint); 751da177e4SLinus Torvalds xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *, 761da177e4SLinus Torvalds uint); 776d192a9bSTim Shimmin int xfs_efi_copy_format(xfs_log_iovec_t *buf, 786d192a9bSTim Shimmin xfs_efi_log_format_t *dst_efi_fmt); 797d795ca3SChristoph Hellwig void xfs_efi_item_free(xfs_efi_log_item_t *); 807d795ca3SChristoph Hellwig 811da177e4SLinus Torvalds #endif /* __XFS_EXTFREE_ITEM_H__ */ 82