fs/xfs/xfs_extfree_item.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_extfree_item.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_extfree_item.c- Extension
.c- Size
- 28899 bytes
- Lines
- 1030
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xfs_platform.hxfs_fs.hxfs_format.hxfs_log_format.hxfs_trans_resv.hxfs_bit.hxfs_shared.hxfs_mount.hxfs_ag.hxfs_defer.hxfs_trans.hxfs_trans_priv.hxfs_extfree_item.hxfs_log.hxfs_btree.hxfs_rmap.hxfs_alloc.hxfs_bmap.hxfs_trace.hxfs_error.hxfs_log_priv.hxfs_log_recover.hxfs_rtalloc.hxfs_inode.hxfs_rtbitmap.hxfs_rtgroup.hxfs_zone_alloc.h
Detected Declarations
function xfs_efi_item_freefunction xfs_efi_releasefunction xfs_efi_item_sizefunction xfs_efi_log_spacefunction xfs_efi_item_formatfunction xfs_efi_item_unpinfunction xfs_efi_item_releasefunction xfs_efi_initfunction formfunction xfs_efd_item_freefunction xfs_efd_item_sizefunction xfs_efd_log_spacefunction xfs_efd_item_formatfunction xfs_efd_item_releasefunction xfs_efd_item_intentfunction xfs_efi_item_isrtfunction xfs_efd_from_efifunction xfs_efd_add_extentfunction xfs_extent_free_diff_itemsfunction xfs_extent_free_log_itemfunction __xfs_extent_free_create_intentfunction xfs_extent_free_create_intentfunction xfs_efd_type_from_efifunction xfs_extent_free_create_donefunction xefi_opsfunction xfs_extent_free_defer_addfunction xfs_extent_free_cancel_itemfunction xfs_extent_free_finish_itemfunction xfs_extent_free_abort_intentfunction xfs_agfl_free_finish_itemfunction xfs_efi_validate_extfunction xfs_efi_recover_workfunction xfs_extent_free_recover_workfunction xfs_extent_free_relog_intentfunction xfs_rtextent_free_create_intentfunction xfs_rtextent_free_finish_itemfunction xfs_efi_item_matchfunction xlog_recover_efi_commit_pass2function xlog_recover_rtefi_commit_pass2function xlog_recover_rtefi_commit_pass2function xlog_recover_efd_commit_pass2function xlog_recover_rtefd_commit_pass2
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*/
#include "xfs_platform.h"
#include "xfs_fs.h"
#include "xfs_format.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_bit.h"
#include "xfs_shared.h"
#include "xfs_mount.h"
#include "xfs_ag.h"
#include "xfs_defer.h"
#include "xfs_trans.h"
#include "xfs_trans_priv.h"
#include "xfs_extfree_item.h"
#include "xfs_log.h"
#include "xfs_btree.h"
#include "xfs_rmap.h"
#include "xfs_alloc.h"
#include "xfs_bmap.h"
#include "xfs_trace.h"
#include "xfs_error.h"
#include "xfs_log_priv.h"
#include "xfs_log_recover.h"
#include "xfs_rtalloc.h"
#include "xfs_inode.h"
#include "xfs_rtbitmap.h"
#include "xfs_rtgroup.h"
#include "xfs_zone_alloc.h"
struct kmem_cache *xfs_efi_cache;
struct kmem_cache *xfs_efd_cache;
static const struct xfs_item_ops xfs_efi_item_ops;
static inline struct xfs_efi_log_item *EFI_ITEM(struct xfs_log_item *lip)
{
return container_of(lip, struct xfs_efi_log_item, efi_item);
}
STATIC void
xfs_efi_item_free(
struct xfs_efi_log_item *efip)
{
kvfree(efip->efi_item.li_lv_shadow);
if (efip->efi_format.efi_nextents > XFS_EFI_MAX_FAST_EXTENTS)
kfree(efip);
else
kmem_cache_free(xfs_efi_cache, efip);
}
/*
* Freeing the efi requires that we remove it from the AIL if it has already
* been placed there. However, the EFI may not yet have been placed in the AIL
* when called by xfs_efi_release() from EFD processing due to the ordering of
* committed vs unpin operations in bulk insert operations. Hence the reference
* count to ensure only the last caller frees the EFI.
*/
STATIC void
xfs_efi_release(
struct xfs_efi_log_item *efip)
{
ASSERT(atomic_read(&efip->efi_refcount) > 0);
if (!atomic_dec_and_test(&efip->efi_refcount))
return;
xfs_trans_ail_delete(&efip->efi_item, 0);
xfs_efi_item_free(efip);
}
STATIC void
xfs_efi_item_size(
struct xfs_log_item *lip,
int *nvecs,
int *nbytes)
{
struct xfs_efi_log_item *efip = EFI_ITEM(lip);
*nvecs += 1;
*nbytes += xfs_efi_log_format_sizeof(efip->efi_format.efi_nextents);
}
unsigned int xfs_efi_log_space(unsigned int nr)
{
return xlog_item_space(1, xfs_efi_log_format_sizeof(nr));
}
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_format.h`, `xfs_log_format.h`, `xfs_trans_resv.h`, `xfs_bit.h`, `xfs_shared.h`, `xfs_mount.h`.
- Detected declarations: `function xfs_efi_item_free`, `function xfs_efi_release`, `function xfs_efi_item_size`, `function xfs_efi_log_space`, `function xfs_efi_item_format`, `function xfs_efi_item_unpin`, `function xfs_efi_item_release`, `function xfs_efi_init`, `function form`, `function xfs_efd_item_free`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.