Loading...
1/*
2 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
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.
8 *
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.
13 *
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
17 */
18#ifndef __XFS_INODE_ITEM_H__
19#define __XFS_INODE_ITEM_H__
20
21/* kernel only definitions */
22
23struct xfs_buf;
24struct xfs_bmbt_rec;
25struct xfs_inode;
26struct xfs_mount;
27
28typedef struct xfs_inode_log_item {
29 xfs_log_item_t ili_item; /* common portion */
30 struct xfs_inode *ili_inode; /* inode ptr */
31 xfs_lsn_t ili_flush_lsn; /* lsn at last flush */
32 xfs_lsn_t ili_last_lsn; /* lsn at last transaction */
33 unsigned short ili_lock_flags; /* lock flags */
34 unsigned short ili_logged; /* flushed logged data */
35 unsigned int ili_last_fields; /* fields when flushed */
36 unsigned int ili_fields; /* fields to be logged */
37} xfs_inode_log_item_t;
38
39static inline int xfs_inode_clean(xfs_inode_t *ip)
40{
41 return !ip->i_itemp || !(ip->i_itemp->ili_fields & XFS_ILOG_ALL);
42}
43
44extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
45extern void xfs_inode_item_destroy(struct xfs_inode *);
46extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *);
47extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *);
48extern void xfs_iflush_abort(struct xfs_inode *, bool);
49extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
50 xfs_inode_log_format_t *);
51
52extern struct kmem_zone *xfs_ili_zone;
53
54#endif /* __XFS_INODE_ITEM_H__ */
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#ifndef __XFS_INODE_ITEM_H__
7#define __XFS_INODE_ITEM_H__
8
9/* kernel only definitions */
10
11struct xfs_buf;
12struct xfs_bmbt_rec;
13struct xfs_inode;
14struct xfs_mount;
15
16struct xfs_inode_log_item {
17 struct xfs_log_item ili_item; /* common portion */
18 struct xfs_inode *ili_inode; /* inode ptr */
19 unsigned short ili_lock_flags; /* inode lock flags */
20 unsigned int ili_dirty_flags; /* dirty in current tx */
21 /*
22 * The ili_lock protects the interactions between the dirty state and
23 * the flush state of the inode log item. This allows us to do atomic
24 * modifications of multiple state fields without having to hold a
25 * specific inode lock to serialise them.
26 *
27 * We need atomic changes between inode dirtying, inode flushing and
28 * inode completion, but these all hold different combinations of
29 * ILOCK and IFLUSHING and hence we need some other method of
30 * serialising updates to the flush state.
31 */
32 spinlock_t ili_lock; /* flush state lock */
33 unsigned int ili_last_fields; /* fields when flushed */
34 unsigned int ili_fields; /* fields to be logged */
35 unsigned int ili_fsync_fields; /* logged since last fsync */
36 xfs_lsn_t ili_flush_lsn; /* lsn at last flush */
37 xfs_csn_t ili_commit_seq; /* last transaction commit */
38};
39
40static inline int xfs_inode_clean(struct xfs_inode *ip)
41{
42 return !ip->i_itemp || !(ip->i_itemp->ili_fields & XFS_ILOG_ALL);
43}
44
45extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
46extern void xfs_inode_item_destroy(struct xfs_inode *);
47extern void xfs_iflush_abort(struct xfs_inode *);
48extern void xfs_iflush_shutdown_abort(struct xfs_inode *);
49extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
50 struct xfs_inode_log_format *);
51
52extern struct kmem_cache *xfs_ili_cache;
53
54#endif /* __XFS_INODE_ITEM_H__ */