Centos-kernel-stream-9/fs/xfs
Bill O'Donnell ea5491aa47 xfs: active perag reference counting
JIRA: https://issues.redhat.com/browse/RHEL-2002

commit c4d5660afbdcd3f0fa3bbf563e059511fba8445f
Author: Dave Chinner <dchinner@redhat.com>
Date:   Mon Feb 13 09:14:42 2023 +1100

    xfs: active perag reference counting

    We need to be able to dynamically remove instantiated AGs from
    memory safely, either for shrinking the filesystem or paging AG
    state in and out of memory (e.g. supporting millions of AGs). This
    means we need to be able to safely exclude operations from accessing
    perags while dynamic removal is in progress.

    To do this, introduce the concept of active and passive references.
    Active references are required for high level operations that make
    use of an AG for a given operation (e.g. allocation) and pin the
    perag in memory for the duration of the operation that is operating
    on the perag (e.g. transaction scope). This means we can fail to get
    an active reference to an AG, hence callers of the new active
    reference API must be able to handle lookup failure gracefully.

    Passive references are used in low level code, where we might need
    to access the perag structure for the purposes of completing high
    level operations. For example, buffers need to use passive
    references because:
    - we need to be able to do metadata IO during operations like grow
      and shrink transactions where high level active references to the
      AG have already been blocked
    - buffers need to pin the perag until they are reclaimed from
      memory, something that high level code has no direct control over.
    - unused cached buffers should not prevent a shrink from being
      started.

    Hence we have active references that will form exclusion barriers
    for operations to be performed on an AG, and passive references that
    will prevent reclaim of the perag until all objects with passive
    references have been reclaimed themselves.

    This patch introduce xfs_perag_grab()/xfs_perag_rele() as the API
    for active AG reference functionality. We also need to convert the
    for_each_perag*() iterators to use active references, which will
    start the process of converting high level code over to using active
    references. Conversion of non-iterator based code to active
    references will be done in followup patches.

    Note that the implementation using reference counting is really just
    a development vehicle for the API to ensure we don't have any leaks
    in the callers. Once we need to remove perag structures from memory
    dyanmically, we will need a much more robust per-ag state transition
    mechanism for preventing new references from being taken while we
    wait for existing references to drain before removal from memory can
    occur....

    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
2023-11-10 07:22:20 -06:00
..
libxfs xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
scrub xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
Kconfig
Makefile
kmem.c
kmem.h
mrlock.h
xfs.h
xfs_acl.c
xfs_acl.h
xfs_aops.c xfs: add debug knob to slow down writeback for fun 2023-11-10 07:22:17 -06:00
xfs_aops.h
xfs_attr_inactive.c
xfs_attr_item.c xfs: dump corrupt recovered log intent items to dmesg consistently 2023-11-06 19:42:18 -06:00
xfs_attr_item.h
xfs_attr_list.c
xfs_bio_io.c
xfs_bmap_item.c xfs: fix confusing variable names in xfs_bmap_item.c 2023-11-10 07:22:19 -06:00
xfs_bmap_item.h
xfs_bmap_util.c xfs: t_firstblock is tracking AGs not blocks 2023-11-10 07:22:20 -06:00
xfs_bmap_util.h
xfs_buf.c xfs: invalidate block device page cache during unmount 2023-11-10 07:22:17 -06:00
xfs_buf.h
xfs_buf_item.c xfs: fix super block buf log item UAF during force shutdown 2023-11-10 07:22:18 -06:00
xfs_buf_item.h
xfs_buf_item_recover.c
xfs_dir2_readdir.c xfs: rearrange the logic and remove the broken comment for xfs_dir2_isxx 2023-11-06 19:42:17 -06:00
xfs_discard.c
xfs_discard.h
xfs_dquot.c
xfs_dquot.h
xfs_dquot_item.c
xfs_dquot_item.h
xfs_dquot_item_recover.c
xfs_error.c xfs: make kobj_type structures constant 2023-11-10 07:22:20 -06:00
xfs_error.h xfs: add debug knob to slow down writeback for fun 2023-11-10 07:22:17 -06:00
xfs_export.c
xfs_export.h
xfs_extent_busy.c xfs: fix extent busy updating 2023-11-10 07:22:19 -06:00
xfs_extent_busy.h
xfs_extfree_item.c xfs: fix confusing xfs_extent_item variable names 2023-11-10 07:22:19 -06:00
xfs_extfree_item.h xfs: refactor all the EFI/EFD log item sizeof logic 2023-11-06 19:42:18 -06:00
xfs_file.c
xfs_filestream.c
xfs_filestream.h
xfs_fsmap.c xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
xfs_fsmap.h
xfs_fsops.c
xfs_fsops.h
xfs_globals.c
xfs_health.c
xfs_icache.c xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
xfs_icache.h
xfs_icreate_item.c
xfs_icreate_item.h
xfs_inode.c xfs: t_firstblock is tracking AGs not blocks 2023-11-10 07:22:20 -06:00
xfs_inode.h
xfs_inode_item.c
xfs_inode_item.h
xfs_inode_item_recover.c xfs: clean up "%Ld/%Lu" which doesn't meet C standard 2023-11-06 19:27:41 -06:00
xfs_ioctl.c
xfs_ioctl.h
xfs_ioctl32.c
xfs_ioctl32.h
xfs_iomap.c xfs: make xfs_iomap_page_ops static 2023-11-10 07:22:18 -06:00
xfs_iomap.h
xfs_iops.c
xfs_iops.h xfs: remove xfs_setattr_time() declaration 2023-11-06 19:42:17 -06:00
xfs_itable.c
xfs_itable.h
xfs_iunlink_item.c
xfs_iunlink_item.h
xfs_iwalk.c xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
xfs_iwalk.h
xfs_linux.h
xfs_log.c xfs: Print XFS UUID on mount and umount events. 2023-11-10 07:22:17 -06:00
xfs_log.h
xfs_log_cil.c
xfs_log_priv.h
xfs_log_recover.c xfs: avoid a UAF when log intent item recovery fails 2023-11-06 19:42:17 -06:00
xfs_message.c
xfs_message.h
xfs_mount.c xfs: simplify if-else condition in xfs_validate_new_dalign 2023-11-06 19:27:41 -06:00
xfs_mount.h
xfs_mru_cache.c
xfs_mru_cache.h
xfs_notify_failure.c
xfs_ondisk.h xfs: fix memcpy fortify errors in EFI log format copying 2023-11-06 19:42:18 -06:00
xfs_pnfs.c
xfs_pnfs.h
xfs_pwork.c
xfs_pwork.h
xfs_qm.c xfs: xfs_qm: remove unnecessary ‘0’ values from error 2023-11-10 07:22:19 -06:00
xfs_qm.h
xfs_qm_bhv.c
xfs_qm_syscalls.c
xfs_quota.h
xfs_quotaops.c
xfs_refcount_item.c xfs: fix confusing variable names in xfs_refcount_item.c 2023-11-10 07:22:20 -06:00
xfs_refcount_item.h
xfs_reflink.c xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
xfs_reflink.h
xfs_rmap_item.c xfs: fix confusing variable names in xfs_rmap_item.c 2023-11-10 07:22:19 -06:00
xfs_rmap_item.h
xfs_rtalloc.c
xfs_rtalloc.h
xfs_stats.c xfs: replace unnecessary seq_printf with seq_puts 2023-11-06 19:27:41 -06:00
xfs_stats.h
xfs_super.c xfs: Print XFS UUID on mount and umount events. 2023-11-10 07:22:17 -06:00
xfs_super.h
xfs_symlink.c
xfs_symlink.h
xfs_sysctl.c
xfs_sysctl.h
xfs_sysfs.c xfs: make kobj_type structures constant 2023-11-10 07:22:20 -06:00
xfs_sysfs.h xfs: make kobj_type structures constant 2023-11-10 07:22:20 -06:00
xfs_trace.c xfs: add debug knob to slow down writeback for fun 2023-11-10 07:22:17 -06:00
xfs_trace.h xfs: active perag reference counting 2023-11-10 07:22:20 -06:00
xfs_trans.c xfs: don't assert fail on transaction cancel with deferred ops 2023-11-10 07:22:20 -06:00
xfs_trans.h xfs: t_firstblock is tracking AGs not blocks 2023-11-10 07:22:20 -06:00
xfs_trans_ail.c xfs: shut up -Wuninitialized in xfsaild_push 2023-11-10 07:22:18 -06:00
xfs_trans_buf.c
xfs_trans_dquot.c
xfs_trans_priv.h
xfs_xattr.c xfs: revert commit 8954c44ff477 2023-11-10 07:22:20 -06:00
xfs_xattr.h