fs/xfs/libxfs/xfs_trans_space.c
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_trans_space.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_trans_space.c- Extension
.c- Size
- 2472 bytes
- Lines
- 122
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xfs_platform.hxfs_fs.hxfs_shared.hxfs_format.hxfs_da_format.hxfs_log_format.hxfs_trans_resv.hxfs_mount.hxfs_da_btree.hxfs_bmap_btree.hxfs_trans_space.h
Detected Declarations
function Copyrightfunction xfs_create_space_resfunction xfs_mkdir_space_resfunction xfs_link_space_resfunction xfs_symlink_space_resfunction xfs_remove_space_resfunction xfs_rename_space_res
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*/
#include "xfs_platform.h"
#include "xfs_fs.h"
#include "xfs_shared.h"
#include "xfs_format.h"
#include "xfs_da_format.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_trans_space.h"
/* Calculate the disk space required to add a parent pointer. */
unsigned int
xfs_parent_calc_space_res(
struct xfs_mount *mp,
unsigned int namelen)
{
/*
* Parent pointers are always the first attr in an attr tree, and never
* larger than a block
*/
return XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK) +
XFS_NEXTENTADD_SPACE_RES(mp, namelen, XFS_ATTR_FORK);
}
unsigned int
xfs_create_space_res(
struct xfs_mount *mp,
unsigned int namelen)
{
unsigned int ret;
ret = XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp, namelen);
if (xfs_has_parent(mp))
ret += xfs_parent_calc_space_res(mp, namelen);
return ret;
}
unsigned int
xfs_mkdir_space_res(
struct xfs_mount *mp,
unsigned int namelen)
{
return xfs_create_space_res(mp, namelen);
}
unsigned int
xfs_link_space_res(
struct xfs_mount *mp,
unsigned int namelen)
{
unsigned int ret;
ret = XFS_DIRENTER_SPACE_RES(mp, namelen);
if (xfs_has_parent(mp))
ret += xfs_parent_calc_space_res(mp, namelen);
return ret;
}
unsigned int
xfs_symlink_space_res(
struct xfs_mount *mp,
unsigned int namelen,
unsigned int fsblocks)
{
unsigned int ret;
ret = XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp, namelen) +
fsblocks;
if (xfs_has_parent(mp))
ret += xfs_parent_calc_space_res(mp, namelen);
return ret;
}
unsigned int
xfs_remove_space_res(
struct xfs_mount *mp,
unsigned int namelen)
{
unsigned int ret = XFS_DIRREMOVE_SPACE_RES(mp);
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_da_format.h`, `xfs_log_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`.
- Detected declarations: `function Copyright`, `function xfs_create_space_res`, `function xfs_mkdir_space_res`, `function xfs_link_space_res`, `function xfs_symlink_space_res`, `function xfs_remove_space_res`, `function xfs_rename_space_res`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.