Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
0004  * All Rights Reserved.
0005  */
0006 #ifndef __XFS_BUF_ITEM_H__
0007 #define __XFS_BUF_ITEM_H__
0008 
0009 /* kernel only definitions */
0010 
0011 struct xfs_buf;
0012 struct xfs_mount;
0013 
0014 /* buf log item flags */
0015 #define XFS_BLI_HOLD        (1u << 0)
0016 #define XFS_BLI_DIRTY       (1u << 1)
0017 #define XFS_BLI_STALE       (1u << 2)
0018 #define XFS_BLI_LOGGED      (1u << 3)
0019 #define XFS_BLI_INODE_ALLOC_BUF (1u << 4)
0020 #define XFS_BLI_STALE_INODE (1u << 5)
0021 #define XFS_BLI_INODE_BUF   (1u << 6)
0022 #define XFS_BLI_ORDERED     (1u << 7)
0023 
0024 #define XFS_BLI_FLAGS \
0025     { XFS_BLI_HOLD,     "HOLD" }, \
0026     { XFS_BLI_DIRTY,    "DIRTY" }, \
0027     { XFS_BLI_STALE,    "STALE" }, \
0028     { XFS_BLI_LOGGED,   "LOGGED" }, \
0029     { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
0030     { XFS_BLI_STALE_INODE,  "STALE_INODE" }, \
0031     { XFS_BLI_INODE_BUF,    "INODE_BUF" }, \
0032     { XFS_BLI_ORDERED,  "ORDERED" }
0033 
0034 /*
0035  * This is the in core log item structure used to track information
0036  * needed to log buffers.  It tracks how many times the lock has been
0037  * locked, and which 128 byte chunks of the buffer are dirty.
0038  */
0039 struct xfs_buf_log_item {
0040     struct xfs_log_item bli_item;   /* common item structure */
0041     struct xfs_buf      *bli_buf;   /* real buffer pointer */
0042     unsigned int        bli_flags;  /* misc flags */
0043     unsigned int        bli_recur;  /* lock recursion count */
0044     atomic_t        bli_refcount;   /* cnt of tp refs */
0045     int         bli_format_count;   /* count of headers */
0046     struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */
0047     struct xfs_buf_log_format __bli_format; /* embedded in-log header */
0048 };
0049 
0050 int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
0051 void    xfs_buf_item_done(struct xfs_buf *bp);
0052 void    xfs_buf_item_relse(struct xfs_buf *);
0053 bool    xfs_buf_item_put(struct xfs_buf_log_item *);
0054 void    xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
0055 bool    xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
0056 void    xfs_buf_inode_iodone(struct xfs_buf *);
0057 void    xfs_buf_inode_io_fail(struct xfs_buf *bp);
0058 #ifdef CONFIG_XFS_QUOTA
0059 void    xfs_buf_dquot_iodone(struct xfs_buf *);
0060 void    xfs_buf_dquot_io_fail(struct xfs_buf *bp);
0061 #else
0062 static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
0063 {
0064 }
0065 static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
0066 {
0067 }
0068 #endif /* CONFIG_XFS_QUOTA */
0069 void    xfs_buf_iodone(struct xfs_buf *);
0070 bool    xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
0071 
0072 extern struct kmem_cache    *xfs_buf_item_cache;
0073 
0074 #endif  /* __XFS_BUF_ITEM_H__ */