linux/fs/xfs/xfs_attr_item.h
Allison Henderson fd92000878 xfs: Set up infrastructure for log attribute replay
Currently attributes are modified directly across one or more
transactions. But they are not logged or replayed in the event of an
error. The goal of log attr replay is to enable logging and replaying
of attribute operations using the existing delayed operations
infrastructure.  This will later enable the attributes to become part of
larger multi part operations that also must first be recorded to the
log.  This is mostly of interest in the scheme of parent pointers which
would need to maintain an attribute containing parent inode information
any time an inode is moved, created, or removed.  Parent pointers would
then be of interest to any feature that would need to quickly derive an
inode path from the mount point. Online scrub, nfs lookups and fs grow
or shrink operations are all features that could take advantage of this.

This patch adds two new log item types for setting or removing
attributes as deferred operations.  The xfs_attri_log_item will log an
intent to set or remove an attribute.  The corresponding
xfs_attrd_log_item holds a reference to the xfs_attri_log_item and is
freed once the transaction is done.  Both log items use a generic
xfs_attr_log_format structure that contains the attribute name, value,
flags, inode, and an op_flag that indicates if the operations is a set
or remove.

[dchinner: added extra little bits needed for intent whiteouts]

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2022-05-04 12:41:02 +10:00

47 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later
*
* Copyright (C) 2022 Oracle. All Rights Reserved.
* Author: Allison Henderson <allison.henderson@oracle.com>
*/
#ifndef __XFS_ATTR_ITEM_H__
#define __XFS_ATTR_ITEM_H__
/* kernel only ATTRI/ATTRD definitions */
struct xfs_mount;
struct kmem_zone;
/*
* This is the "attr intention" log item. It is used to log the fact that some
* extended attribute operations need to be processed. An operation is
* currently either a set or remove. Set or remove operations are described by
* the xfs_attr_item which may be logged to this intent.
*
* During a normal attr operation, name and value point to the name and value
* fields of the caller's xfs_da_args structure. During a recovery, the name
* and value buffers are copied from the log, and stored in a trailing buffer
* attached to the xfs_attr_item until they are committed. They are freed when
* the xfs_attr_item itself is freed when the work is done.
*/
struct xfs_attri_log_item {
struct xfs_log_item attri_item;
atomic_t attri_refcount;
int attri_name_len;
int attri_value_len;
void *attri_name;
void *attri_value;
struct xfs_attri_log_format attri_format;
};
/*
* This is the "attr done" log item. It is used to log the fact that some attrs
* earlier mentioned in an attri item have been freed.
*/
struct xfs_attrd_log_item {
struct xfs_log_item attrd_item;
struct xfs_attri_log_item *attrd_attrip;
struct xfs_attrd_log_format attrd_format;
};
#endif /* __XFS_ATTR_ITEM_H__ */