fs/freevxfs/vxfs_bmap.c
Source file repositories/reference/linux-study-clean/fs/freevxfs/vxfs_bmap.c
File Facts
- System
- Linux kernel
- Corpus path
fs/freevxfs/vxfs_bmap.c- Extension
.c- Size
- 6633 bytes
- Lines
- 272
- 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
linux/fs.hlinux/buffer_head.hlinux/kernel.hvxfs.hvxfs_inode.hvxfs_extern.h
Detected Declarations
function Copyrightfunction vxfs_bmap_ext4function vxfs_bmap_indirfunction vxfs_bmap_typedfunction vxfs_bmap1
Annotated Snippet
if (block < off) {
brelse(bp);
continue;
}
switch ((u_int32_t)(fs64_to_cpu(sbi, typ->vt_hdr) >>
VXFS_TYPED_TYPESHIFT)) {
case VXFS_TYPED_INDIRECT:
pblock = vxfs_bmap_indir(ip,
fs32_to_cpu(sbi, typ->vt_block),
fs32_to_cpu(sbi, typ->vt_size),
block - off);
if (pblock == -2)
break;
goto out;
case VXFS_TYPED_DATA:
if ((block - off) >= fs32_to_cpu(sbi, typ->vt_size))
break;
pblock = fs32_to_cpu(sbi, typ->vt_block) + block - off;
goto out;
case VXFS_TYPED_INDIRECT_DEV4:
case VXFS_TYPED_DATA_DEV4: {
struct vxfs_typed_dev4 *typ4 =
(struct vxfs_typed_dev4 *)typ;
printk(KERN_INFO "\n\nTYPED_DEV4 detected!\n");
printk(KERN_INFO "block: %llu\tsize: %lld\tdev: %d\n",
fs64_to_cpu(sbi, typ4->vd4_block),
fs64_to_cpu(sbi, typ4->vd4_size),
fs32_to_cpu(sbi, typ4->vd4_dev));
goto fail;
}
default:
printk(KERN_ERR "%s:%d vt_hdr %llu\n", __func__,
__LINE__, fs64_to_cpu(sbi, typ->vt_hdr));
BUG();
}
brelse(bp);
}
fail:
pblock = 0;
out:
brelse(bp);
return (pblock);
}
/**
* vxfs_bmap_typed - bmap for typed extents
* @ip: pointer to the inode we do bmap for
* @iblock: logical block
*
* Description:
* Performs the bmap operation for typed extents.
*
* Returns:
* The physical block number on success, else Zero.
*/
static daddr_t
vxfs_bmap_typed(struct inode *ip, long iblock)
{
struct vxfs_inode_info *vip = VXFS_INO(ip);
struct vxfs_sb_info *sbi = VXFS_SBI(ip->i_sb);
daddr_t pblock = 0;
int i;
for (i = 0; i < VXFS_NTYPED; i++) {
struct vxfs_typed *typ = vip->vii_org.typed + i;
u64 hdr = fs64_to_cpu(sbi, typ->vt_hdr);
int64_t off = (hdr & VXFS_TYPED_OFFSETMASK);
#ifdef DIAGNOSTIC
vxfs_typdump(typ);
#endif
if (iblock < off)
continue;
switch ((u32)(hdr >> VXFS_TYPED_TYPESHIFT)) {
case VXFS_TYPED_INDIRECT:
pblock = vxfs_bmap_indir(ip,
fs32_to_cpu(sbi, typ->vt_block),
fs32_to_cpu(sbi, typ->vt_size),
iblock - off);
if (pblock == -2)
break;
return (pblock);
case VXFS_TYPED_DATA:
if ((iblock - off) < fs32_to_cpu(sbi, typ->vt_size))
return (fs32_to_cpu(sbi, typ->vt_block) +
iblock - off);
break;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/buffer_head.h`, `linux/kernel.h`, `vxfs.h`, `vxfs_inode.h`, `vxfs_extern.h`.
- Detected declarations: `function Copyright`, `function vxfs_bmap_ext4`, `function vxfs_bmap_indir`, `function vxfs_bmap_typed`, `function vxfs_bmap1`.
- 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.