xref: /linux/fs/xfs/xfs_attr_item.h (revision 36ec807b627b4c0a0a382f0ae48eac7187d14b2b)
1fd920008SAllison Henderson /* SPDX-License-Identifier: GPL-2.0-or-later
2fd920008SAllison Henderson  *
3fd920008SAllison Henderson  * Copyright (C) 2022 Oracle.  All Rights Reserved.
4fd920008SAllison Henderson  * Author: Allison Henderson <allison.henderson@oracle.com>
5fd920008SAllison Henderson  */
6fd920008SAllison Henderson #ifndef	__XFS_ATTR_ITEM_H__
7fd920008SAllison Henderson #define	__XFS_ATTR_ITEM_H__
8fd920008SAllison Henderson 
9fd920008SAllison Henderson /* kernel only ATTRI/ATTRD definitions */
10fd920008SAllison Henderson 
11fd920008SAllison Henderson struct xfs_mount;
12fd920008SAllison Henderson struct kmem_zone;
13fd920008SAllison Henderson 
144183e4f2SDarrick J. Wong struct xfs_attri_log_nameval {
154183e4f2SDarrick J. Wong 	struct xfs_log_iovec	name;
16*5773f7f8SDarrick J. Wong 	struct xfs_log_iovec	new_name;	/* PPTR_REPLACE only */
174183e4f2SDarrick J. Wong 	struct xfs_log_iovec	value;
18*5773f7f8SDarrick J. Wong 	struct xfs_log_iovec	new_value;	/* PPTR_REPLACE only */
194183e4f2SDarrick J. Wong 	refcount_t		refcount;
204183e4f2SDarrick J. Wong 
214183e4f2SDarrick J. Wong 	/* name and value follow the end of this struct */
224183e4f2SDarrick J. Wong };
234183e4f2SDarrick J. Wong 
24fd920008SAllison Henderson /*
25fd920008SAllison Henderson  * This is the "attr intention" log item.  It is used to log the fact that some
26fd920008SAllison Henderson  * extended attribute operations need to be processed.  An operation is
27fd920008SAllison Henderson  * currently either a set or remove.  Set or remove operations are described by
28e3c5de22SDarrick J. Wong  * the xfs_attr_intent which may be logged to this intent.
29fd920008SAllison Henderson  *
30fd920008SAllison Henderson  * During a normal attr operation, name and value point to the name and value
31fd920008SAllison Henderson  * fields of the caller's xfs_da_args structure.  During a recovery, the name
32fd920008SAllison Henderson  * and value buffers are copied from the log, and stored in a trailing buffer
33e3c5de22SDarrick J. Wong  * attached to the xfs_attr_intent until they are committed.  They are freed
34e3c5de22SDarrick J. Wong  * when the xfs_attr_intent itself is freed when the work is done.
35fd920008SAllison Henderson  */
36fd920008SAllison Henderson struct xfs_attri_log_item {
37fd920008SAllison Henderson 	struct xfs_log_item		attri_item;
38fd920008SAllison Henderson 	atomic_t			attri_refcount;
394183e4f2SDarrick J. Wong 	struct xfs_attri_log_nameval	*attri_nameval;
40fd920008SAllison Henderson 	struct xfs_attri_log_format	attri_format;
41fd920008SAllison Henderson };
42fd920008SAllison Henderson 
43fd920008SAllison Henderson /*
44fd920008SAllison Henderson  * This is the "attr done" log item.  It is used to log the fact that some attrs
45fd920008SAllison Henderson  * earlier mentioned in an attri item have been freed.
46fd920008SAllison Henderson  */
47fd920008SAllison Henderson struct xfs_attrd_log_item {
48fd920008SAllison Henderson 	struct xfs_log_item		attrd_item;
49fd920008SAllison Henderson 	struct xfs_attri_log_item	*attrd_attrip;
50fd920008SAllison Henderson 	struct xfs_attrd_log_format	attrd_format;
51fd920008SAllison Henderson };
52fd920008SAllison Henderson 
534136e38aSDarrick J. Wong extern struct kmem_cache	*xfs_attri_cache;
544136e38aSDarrick J. Wong extern struct kmem_cache	*xfs_attrd_cache;
554136e38aSDarrick J. Wong 
569713dc88SDarrick J. Wong enum xfs_attr_defer_op {
579713dc88SDarrick J. Wong 	XFS_ATTR_DEFER_SET,
589713dc88SDarrick J. Wong 	XFS_ATTR_DEFER_REMOVE,
599713dc88SDarrick J. Wong 	XFS_ATTR_DEFER_REPLACE,
609713dc88SDarrick J. Wong };
619713dc88SDarrick J. Wong 
629713dc88SDarrick J. Wong void xfs_attr_defer_add(struct xfs_da_args *args, enum xfs_attr_defer_op op);
639713dc88SDarrick J. Wong 
64fd920008SAllison Henderson #endif	/* __XFS_ATTR_ITEM_H__ */
65