11da177e4SLinus Torvalds /* 27b718769SNathan Scott * Copyright (c) 2000-2001,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_BUF_ITEM_H__ 191da177e4SLinus Torvalds #define __XFS_BUF_ITEM_H__ 201da177e4SLinus Torvalds 21*a8da0da2SDave Chinner /* kernel only definitions */ 22a8272ce0SDavid Chinner 23*a8da0da2SDave Chinner /* buf log item flags */ 241da177e4SLinus Torvalds #define XFS_BLI_HOLD 0x01 251da177e4SLinus Torvalds #define XFS_BLI_DIRTY 0x02 261da177e4SLinus Torvalds #define XFS_BLI_STALE 0x04 271da177e4SLinus Torvalds #define XFS_BLI_LOGGED 0x08 281da177e4SLinus Torvalds #define XFS_BLI_INODE_ALLOC_BUF 0x10 291da177e4SLinus Torvalds #define XFS_BLI_STALE_INODE 0x20 30ccf7c23fSDave Chinner #define XFS_BLI_INODE_BUF 0x40 315f6bed76SDave Chinner #define XFS_BLI_ORDERED 0x80 321da177e4SLinus Torvalds 330b1b213fSChristoph Hellwig #define XFS_BLI_FLAGS \ 340b1b213fSChristoph Hellwig { XFS_BLI_HOLD, "HOLD" }, \ 350b1b213fSChristoph Hellwig { XFS_BLI_DIRTY, "DIRTY" }, \ 360b1b213fSChristoph Hellwig { XFS_BLI_STALE, "STALE" }, \ 370b1b213fSChristoph Hellwig { XFS_BLI_LOGGED, "LOGGED" }, \ 380b1b213fSChristoph Hellwig { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \ 39ccf7c23fSDave Chinner { XFS_BLI_STALE_INODE, "STALE_INODE" }, \ 405f6bed76SDave Chinner { XFS_BLI_INODE_BUF, "INODE_BUF" }, \ 415f6bed76SDave Chinner { XFS_BLI_ORDERED, "ORDERED" } 420b1b213fSChristoph Hellwig 431da177e4SLinus Torvalds 441da177e4SLinus Torvalds struct xfs_buf; 451da177e4SLinus Torvalds struct xfs_mount; 461da177e4SLinus Torvalds struct xfs_buf_log_item; 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds /* 491da177e4SLinus Torvalds * This is the in core log item structure used to track information 501da177e4SLinus Torvalds * needed to log buffers. It tracks how many times the lock has been 511da177e4SLinus Torvalds * locked, and which 128 byte chunks of the buffer are dirty. 521da177e4SLinus Torvalds */ 531da177e4SLinus Torvalds typedef struct xfs_buf_log_item { 541da177e4SLinus Torvalds xfs_log_item_t bli_item; /* common item structure */ 551da177e4SLinus Torvalds struct xfs_buf *bli_buf; /* real buffer pointer */ 561da177e4SLinus Torvalds unsigned int bli_flags; /* misc flags */ 571da177e4SLinus Torvalds unsigned int bli_recur; /* lock recursion count */ 581da177e4SLinus Torvalds atomic_t bli_refcount; /* cnt of tp refs */ 59372cc85eSDave Chinner int bli_format_count; /* count of headers */ 60372cc85eSDave Chinner struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */ 61b9438173SMark Tinguely struct xfs_buf_log_format __bli_format; /* embedded in-log header */ 621da177e4SLinus Torvalds } xfs_buf_log_item_t; 631da177e4SLinus Torvalds 641da177e4SLinus Torvalds void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); 651da177e4SLinus Torvalds void xfs_buf_item_relse(struct xfs_buf *); 661da177e4SLinus Torvalds void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint); 671da177e4SLinus Torvalds uint xfs_buf_item_dirty(xfs_buf_log_item_t *); 681da177e4SLinus Torvalds void xfs_buf_attach_iodone(struct xfs_buf *, 691da177e4SLinus Torvalds void(*)(struct xfs_buf *, xfs_log_item_t *), 701da177e4SLinus Torvalds xfs_log_item_t *); 711da177e4SLinus Torvalds void xfs_buf_iodone_callbacks(struct xfs_buf *); 72ca30b2a7SChristoph Hellwig void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *); 731da177e4SLinus Torvalds 7461fe135cSDave Chinner void xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *, 7561fe135cSDave Chinner enum xfs_blft); 7661fe135cSDave Chinner void xfs_trans_buf_copy_type(struct xfs_buf *dst_bp, struct xfs_buf *src_bp); 7761fe135cSDave Chinner 78*a8da0da2SDave Chinner extern kmem_zone_t *xfs_buf_item_zone; 791da177e4SLinus Torvalds 801da177e4SLinus Torvalds #endif /* __XFS_BUF_ITEM_H__ */ 81