fs/jfs/jfs_txnmgr.c
Source file repositories/reference/linux-study-clean/fs/jfs/jfs_txnmgr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jfs/jfs_txnmgr.c- Extension
.c- Size
- 74770 bytes
- Lines
- 3022
- 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
linux/fs.hlinux/vmalloc.hlinux/completion.hlinux/freezer.hlinux/module.hlinux/moduleparam.hlinux/kthread.hlinux/seq_file.hjfs_incore.hjfs_inode.hjfs_filsys.hjfs_metapage.hjfs_dinode.hjfs_imap.hjfs_dmap.hjfs_superblock.hjfs_debug.h
Detected Declarations
function TXN_SLEEP_DROP_LOCKfunction txLockAllocfunction txLockFreefunction txInitfunction txExitfunction txBeginfunction COMMIT_INODEfunction txBeginAnonfunction test_bitfunction txEndfunction txLockfunction txCommitfunction txReleasefunction txUnlockfunction txUpdateMapfunction txLinelockfunction committedfunction txLogfunction diLogfunction dataLogfunction dtLogfunction xtLogfunction mapLogfunction txEAfunction txForcefunction txUpdateMapfunction txAllocPMapfunction txFreeMapfunction txFreelockfunction txAbortfunction txLazyCommitfunction jfs_lazycommitfunction list_for_each_entryfunction txLazyUnlockfunction LogSyncReleasefunction txQuiescefunction txResumefunction jfs_syncfunction jfs_txanchor_proc_showfunction jfs_txstats_proc_show
Annotated Snippet
if (nTxBlock == -1) {
/* Base default on memory size */
si_meminfo(&si);
if (si.totalram > (256 * 1024)) /* 1 GB */
nTxLock = 64 * 1024;
else
nTxLock = si.totalram >> 2;
} else if (nTxBlock > (8 * 1024))
nTxLock = 64 * 1024;
else
nTxLock = nTxBlock << 3;
}
if (nTxBlock == -1)
nTxBlock = nTxLock >> 3;
/* Verify tunable parameters */
if (nTxBlock < 16)
nTxBlock = 16; /* No one should set it this low */
if (nTxBlock > 65536)
nTxBlock = 65536;
if (nTxLock < 256)
nTxLock = 256; /* No one should set it this low */
if (nTxLock > 65536)
nTxLock = 65536;
printk(KERN_INFO "JFS: nTxBlock = %d, nTxLock = %d\n",
nTxBlock, nTxLock);
/*
* initialize transaction block (tblock) table
*
* transaction id (tid) = tblock index
* tid = 0 is reserved.
*/
TxLockLWM = (nTxLock * 4) / 10;
TxLockHWM = (nTxLock * 7) / 10;
TxLockVHWM = (nTxLock * 8) / 10;
size = sizeof(struct tblock) * nTxBlock;
TxBlock = vmalloc(size);
if (TxBlock == NULL)
return -ENOMEM;
for (k = 0; k < nTxBlock; k++) {
init_waitqueue_head(&TxBlock[k].gcwait);
init_waitqueue_head(&TxBlock[k].waitor);
INIT_LIST_HEAD(&TxBlock[k].synclist);
}
for (k = 1; k < nTxBlock - 1; k++) {
TxBlock[k].next = k + 1;
}
TxBlock[k].next = 0;
TxAnchor.freetid = 1;
init_waitqueue_head(&TxAnchor.freewait);
stattx.maxtid = 1; /* statistics */
/*
* initialize transaction lock (tlock) table
*
* transaction lock id = tlock index
* tlock id = 0 is reserved.
*/
size = sizeof(struct tlock) * nTxLock;
TxLock = vmalloc(size);
if (TxLock == NULL) {
vfree(TxBlock);
return -ENOMEM;
}
/* initialize tlock table */
for (k = 1; k < nTxLock - 1; k++)
TxLock[k].next = k + 1;
TxLock[k].next = 0;
init_waitqueue_head(&TxAnchor.freelockwait);
init_waitqueue_head(&TxAnchor.lowlockwait);
TxAnchor.freelock = 1;
TxAnchor.tlocksInUse = 0;
INIT_LIST_HEAD(&TxAnchor.anon_list);
INIT_LIST_HEAD(&TxAnchor.anon_list2);
LAZY_LOCK_INIT();
INIT_LIST_HEAD(&TxAnchor.unlock_queue);
stattx.maxlid = 1; /* statistics */
return 0;
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/vmalloc.h`, `linux/completion.h`, `linux/freezer.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/kthread.h`, `linux/seq_file.h`.
- Detected declarations: `function TXN_SLEEP_DROP_LOCK`, `function txLockAlloc`, `function txLockFree`, `function txInit`, `function txExit`, `function txBegin`, `function COMMIT_INODE`, `function txBeginAnon`, `function test_bit`, `function txEnd`.
- 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.