fs/jfs/jfs_logmgr.c
Source file repositories/reference/linux-study-clean/fs/jfs/jfs_logmgr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jfs/jfs_logmgr.c- Extension
.c- Size
- 59217 bytes
- Lines
- 2486
- 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/blkdev.hlinux/interrupt.hlinux/completion.hlinux/kthread.hlinux/buffer_head.hlinux/bio.hlinux/freezer.hlinux/export.hlinux/delay.hlinux/mutex.hlinux/seq_file.hlinux/slab.hjfs_incore.hjfs_filsys.hjfs_metapage.hjfs_superblock.hjfs_txnmgr.hjfs_debug.h
Detected Declarations
function write_special_inodesfunction list_for_each_entryfunction lmLogfunction lmWriteRecordfunction lmNextPagefunction lmGroupCommitfunction lmGCwritefunction list_for_each_entryfunction lmPostGCfunction lmLogSyncfunction jfs_syncptfunction lmLogOpenfunction open_inline_logfunction open_dummy_logfunction logredofunction lmLogClosefunction jfs_flush_journalfunction list_for_each_entryfunction lmLogShutdownfunction vms_iowaitfunction managerfunction lbmLogShutdownfunction lbmAllocatefunction lbmFreefunction lbmfreefunction lbmRedrivefunction lbmReadfunction lbmWritefunction lbmDirectWritefunction lbmStartIOfunction lbmIOWaitfunction lbmIODonefunction jfsIOWaitfunction lmLogFormatfunction jfs_lmstats_proc_show
Annotated Snippet
if (diffp < difft) {
/* update tblock lsn with page lsn */
tblk->lsn = mp->lsn;
/* move tblock after page on logsynclist */
list_move(&tblk->synclist, &mp->synclist);
}
}
LOGSYNC_UNLOCK(log, flags);
/*
* write the log record
*/
writeRecord:
lsn = lmWriteRecord(log, tblk, lrd, tlck);
/*
* forward log syncpt if log reached next syncpt trigger
*/
logdiff(diffp, lsn, log);
if (diffp >= log->nextsync)
lsn = lmLogSync(log, 0);
/* update end-of-log lsn */
log->lsn = lsn;
LOG_UNLOCK(log);
/* return end-of-log address */
return lsn;
}
/*
* NAME: lmWriteRecord()
*
* FUNCTION: move the log record to current log page
*
* PARAMETER: cd - commit descriptor
*
* RETURN: end-of-log address
*
* serialization: LOG_LOCK() held on entry/exit
*/
static int
lmWriteRecord(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
struct tlock * tlck)
{
int lsn = 0; /* end-of-log address */
struct lbuf *bp; /* dst log page buffer */
struct logpage *lp; /* dst log page */
caddr_t dst; /* destination address in log page */
int dstoffset; /* end-of-log offset in log page */
int freespace; /* free space in log page */
caddr_t p; /* src meta-data page */
caddr_t src;
int srclen;
int nbytes; /* number of bytes to move */
int i;
int len;
struct linelock *linelock;
struct lv *lv;
struct lvd *lvd;
int l2linesize;
len = 0;
/* retrieve destination log page to write */
bp = (struct lbuf *) log->bp;
lp = (struct logpage *) bp->l_ldata;
dstoffset = log->eor;
/* any log data to write ? */
if (tlck == NULL)
goto moveLrd;
/*
* move log record data
*/
/* retrieve source meta-data page to log */
if (tlck->flag & tlckPAGELOCK) {
p = (caddr_t) (tlck->mp->data);
linelock = (struct linelock *) & tlck->lock;
}
/* retrieve source in-memory inode to log */
else if (tlck->flag & tlckINODELOCK) {
if (tlck->type & tlckDTREE)
p = (caddr_t) &JFS_IP(tlck->ip)->i_dtroot;
else
p = (caddr_t) &JFS_IP(tlck->ip)->i_xtroot;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/blkdev.h`, `linux/interrupt.h`, `linux/completion.h`, `linux/kthread.h`, `linux/buffer_head.h`, `linux/bio.h`, `linux/freezer.h`.
- Detected declarations: `function write_special_inodes`, `function list_for_each_entry`, `function lmLog`, `function lmWriteRecord`, `function lmNextPage`, `function lmGroupCommit`, `function lmGCwrite`, `function list_for_each_entry`, `function lmPostGC`, `function lmLogSync`.
- 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.