fs/jfs/jfs_dtree.c
Source file repositories/reference/linux-study-clean/fs/jfs/jfs_dtree.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jfs/jfs_dtree.c- Extension
.c- Size
- 101391 bytes
- Lines
- 4484
- 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.
- 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
linux/fs.hlinux/quotaops.hlinux/slab.hjfs_incore.hjfs_superblock.hjfs_filsys.hjfs_metapage.hjfs_dmap.hjfs_unicode.hjfs_debug.h
Detected Declarations
struct dtsplitstruct jfs_direntstruct dtoffsetstruct dtoffsetfunction read_index_pagefunction get_index_pagefunction find_indexfunction lock_indexfunction add_indexfunction free_indexfunction modify_indexfunction read_indexfunction dtSearchfunction keyfunction dtInsertfunction dtSplitUpfunction dtSplitUpfunction offunction entriesfunction dtSplitPagefunction itfunction dtExtendPagefunction dtSplitRootfunction dtDeletefunction dtDeleteUpfunction reachedfunction dtRelinkfunction dtInitRootfunction add_missing_indicesfunction jfs_readdirfunction dtReadFirstfunction dtReadNextfunction dtComparefunction ciComparefunction ciGetLeafPrefixKeyfunction dtGetKeyfunction segmentfunction dtInsertEntryfunction dtMoveEntryfunction dtDeleteEntryfunction dtTruncateEntryfunction dtLinelockFreelistfunction dtModifyfunction check_dtrootfunction check_dtpagefunction DTPAGEMAXSLOT
Annotated Snippet
struct dtsplit {
struct metapage *mp;
s16 index;
s16 nslot;
struct component_name *key;
ddata_t *data;
struct pxdlist *pxdlist;
};
#define DT_PAGE(IP, MP) BT_PAGE(IP, MP, dtpage_t, i_dtroot)
/* get page buffer for specified block address */
#define DT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
do { \
BT_GETPAGE(IP, BN, MP, dtpage_t, SIZE, P, RC, i_dtroot); \
if (!(RC)) { \
if ((BN) && !check_dtpage(P)) { \
BT_PUTPAGE(MP); \
jfs_error((IP)->i_sb, \
"DT_GETPAGE: dtree page corrupt\n"); \
MP = NULL; \
RC = -EIO; \
} \
} \
} while (0)
/* for consistency */
#define DT_PUTPAGE(MP) BT_PUTPAGE(MP)
#define DT_GETSEARCH(IP, LEAF, BN, MP, P, INDEX) \
BT_GETSEARCH(IP, LEAF, BN, MP, dtpage_t, P, INDEX, i_dtroot)
/*
* forward references
*/
static int dtSplitUp(tid_t tid, struct inode *ip,
struct dtsplit * split, struct btstack * btstack);
static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
struct metapage ** rmpp, dtpage_t ** rpp, pxd_t * rxdp);
static int dtExtendPage(tid_t tid, struct inode *ip,
struct dtsplit * split, struct btstack * btstack);
static int dtSplitRoot(tid_t tid, struct inode *ip,
struct dtsplit * split, struct metapage ** rmpp);
static int dtDeleteUp(tid_t tid, struct inode *ip, struct metapage * fmp,
dtpage_t * fp, struct btstack * btstack);
static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p);
static int dtReadFirst(struct inode *ip, struct btstack * btstack);
static int dtReadNext(struct inode *ip,
loff_t * offset, struct btstack * btstack);
static int dtCompare(struct component_name * key, dtpage_t * p, int si);
static int ciCompare(struct component_name * key, dtpage_t * p, int si,
int flag);
static void dtGetKey(dtpage_t * p, int i, struct component_name * key,
int flag);
static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
int ri, struct component_name * key, int flag);
static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
ddata_t * data, struct dt_lock **);
static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp,
struct dt_lock ** sdtlock, struct dt_lock ** ddtlock,
int do_index);
static void dtDeleteEntry(dtpage_t * p, int fi, struct dt_lock ** dtlock);
static void dtTruncateEntry(dtpage_t * p, int ti, struct dt_lock ** dtlock);
static void dtLinelockFreelist(dtpage_t * p, int m, struct dt_lock ** dtlock);
#define ciToUpper(c) UniStrupr((c)->name)
/*
* read_index_page()
*
* Reads a page of a directory's index table.
* Having metadata mapped into the directory inode's address space
* presents a multitude of problems. We avoid this by mapping to
* the absolute address space outside of the *_metapage routines
Annotation
- Immediate include surface: `linux/fs.h`, `linux/quotaops.h`, `linux/slab.h`, `jfs_incore.h`, `jfs_superblock.h`, `jfs_filsys.h`, `jfs_metapage.h`, `jfs_dmap.h`.
- Detected declarations: `struct dtsplit`, `struct jfs_dirent`, `struct dtoffset`, `struct dtoffset`, `function read_index_page`, `function get_index_page`, `function find_index`, `function lock_index`, `function add_index`, `function free_index`.
- 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.