fs/jfs/jfs_xtree.c
Source file repositories/reference/linux-study-clean/fs/jfs/jfs_xtree.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jfs/jfs_xtree.c- Extension
.c- Size
- 69875 bytes
- Lines
- 2931
- 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/module.hlinux/quotaops.hlinux/seq_file.hjfs_incore.hjfs_filsys.hjfs_metapage.hjfs_dmap.hjfs_dinode.hjfs_superblock.hjfs_debug.h
Detected Declarations
struct xtsplitfunction pagefunction le16_to_cpufunction xtLookupfunction containsfunction entryfunction xtInsertfunction xtSplitUpfunction splitfunction offunction xtSplitPagefunction tailfunction xtSplitRootfunction xtExtendfunction xtSplitUpfunction xtUpdatefunction xtAppendfunction xtInitRootfunction xtTruncatefunction lid_to_tlockfunction xtTruncate_pmapfunction jfs_xtstat_proc_show
Annotated Snippet
struct xtsplit {
struct metapage *mp;
s16 index;
u8 flag;
s64 off;
s64 addr;
int len;
struct pxdlist *pxdlist;
};
/*
* statistics
*/
#ifdef CONFIG_JFS_STATISTICS
static struct {
uint search;
uint fastSearch;
uint split;
} xtStat;
#endif
/*
* forward references
*/
static int xtSearch(struct inode *ip, s64 xoff, s64 *next, int *cmpp,
struct btstack * btstack, int flag);
static int xtSplitUp(tid_t tid,
struct inode *ip,
struct xtsplit * split, struct btstack * btstack);
static int xtSplitPage(tid_t tid, struct inode *ip, struct xtsplit * split,
struct metapage ** rmpp, s64 * rbnp);
static int xtSplitRoot(tid_t tid, struct inode *ip,
struct xtsplit * split, struct metapage ** rmpp);
/*
* xt_getpage()
*
* function: get the page buffer for a specified block address.
*
* parameters:
* ip - pointer to the inode
* bn - block number (s64) of the xtree page to be retrieved;
* mp - pointer to a metapage pointer where the page buffer is returned;
*
* returns:
* A pointer to the xtree page (xtpage_t) on success, -EIO on error.
*/
static inline xtpage_t *xt_getpage(struct inode *ip, s64 bn, struct metapage **mp)
{
xtpage_t *p;
int rc;
BT_GETPAGE(ip, bn, *mp, xtpage_t, PSIZE, p, rc, i_xtroot);
if (rc)
return ERR_PTR(rc);
if ((le16_to_cpu(p->header.nextindex) < XTENTRYSTART) ||
(le16_to_cpu(p->header.nextindex) >
le16_to_cpu(p->header.maxentry)) ||
(le16_to_cpu(p->header.maxentry) >
((bn == 0) ? XTROOTMAXSLOT : PSIZE >> L2XTSLOTSIZE))) {
jfs_error(ip->i_sb, "xt_getpage: xtree page corrupt\n");
BT_PUTPAGE(*mp);
*mp = NULL;
return ERR_PTR(-EIO);
}
return p;
}
/*
* xtLookup()
*
* function: map a single page into a physical extent;
*/
int xtLookup(struct inode *ip, s64 lstart,
s64 llen, int *pflag, s64 * paddr, s32 * plen, int no_check)
{
int rc = 0;
struct btstack btstack;
int cmp;
s64 bn;
struct metapage *mp;
xtpage_t *p;
int index;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/module.h`, `linux/quotaops.h`, `linux/seq_file.h`, `jfs_incore.h`, `jfs_filsys.h`, `jfs_metapage.h`, `jfs_dmap.h`.
- Detected declarations: `struct xtsplit`, `function page`, `function le16_to_cpu`, `function xtLookup`, `function contains`, `function entry`, `function xtInsert`, `function xtSplitUp`, `function split`, `function of`.
- 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.