/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) International Business Machines Corp., 2000-2004 * Portions Copyright (C) Christoph Hellwig, 2001-2002 */ #ifndef _H_JFS_LOGMGR #define _H_JFS_LOGMGR #include <linux/uuid.h> #include "jfs_filsys.h" #include "jfs_lock.h" /* * log manager configuration parameters */ /* log page size */ #define LOGPSIZE … #define L2LOGPSIZE … #define LOGPAGES … /* * log logical volume * * a log is used to make the commit operation on journalled * files within the same logical volume group atomic. * a log is implemented with a logical volume. * there is one log per logical volume group. * * block 0 of the log logical volume is not used (ipl etc). * block 1 contains a log "superblock" and is used by logFormat(), * lmLogInit(), lmLogShutdown(), and logRedo() to record status * of the log but is not otherwise used during normal processing. * blocks 2 - (N-1) are used to contain log records. * * when a volume group is varied-on-line, logRedo() must have * been executed before the file systems (logical volumes) in * the volume group can be mounted. */ /* * log superblock (block 1 of logical volume) */ #define LOGSUPER_B … #define LOGSTART_B … #define LOGMAGIC … #define LOGVERSION … #define MAX_ACTIVE … struct logsuper { … }; /* log flag: commit option (see jfs_filsys.h) */ /* log state */ #define LOGMOUNT … #define LOGREDONE … #define LOGWRAP … #define LOGREADERR … /* * log logical page * * (this comment should be rewritten !) * the header and trailer structures (h,t) will normally have * the same page and eor value. * An exception to this occurs when a complete page write is not * accomplished on a power failure. Since the hardware may "split write" * sectors in the page, any out of order sequence may occur during powerfail * and needs to be recognized during log replay. The xor value is * an "exclusive or" of all log words in the page up to eor. This * 32 bit eor is stored with the top 16 bits in the header and the * bottom 16 bits in the trailer. logredo can easily recognize pages * that were not completed by reconstructing this eor and checking * the log page. * * Previous versions of the operating system did not allow split * writes and detected partially written records in logredo by * ordering the updates to the header, trailer, and the move of data * into the logdata area. The order: (1) data is moved (2) header * is updated (3) trailer is updated. In logredo, when the header * differed from the trailer, the header and trailer were reconciled * as follows: if h.page != t.page they were set to the smaller of * the two and h.eor and t.eor set to 8 (i.e. empty page). if (only) * h.eor != t.eor they were set to the smaller of their two values. */ struct logpage { … }; #define LOGPHDRSIZE … #define LOGPTLRSIZE … /* * log record * * (this comment should be rewritten !) * jfs uses only "after" log records (only a single writer is allowed * in a page, pages are written to temporary paging space if * they must be written to disk before commit, and i/o is * scheduled for modified pages to their home location after * the log records containing the after values and the commit * record is written to the log on disk, undo discards the copy * in main-memory.) * * a log record consists of a data area of variable length followed by * a descriptor of fixed size LOGRDSIZE bytes. * the data area is rounded up to an integral number of 4-bytes and * must be no longer than LOGPSIZE. * the descriptor is of size of multiple of 4-bytes and aligned on a * 4-byte boundary. * records are packed one after the other in the data area of log pages. * (sometimes a DUMMY record is inserted so that at least one record ends * on every page or the longest record is placed on at most two pages). * the field eor in page header/trailer points to the byte following * the last record on a page. */ /* log record types */ #define LOG_COMMIT … #define LOG_SYNCPT … #define LOG_MOUNT … #define LOG_REDOPAGE … #define LOG_NOREDOPAGE … #define LOG_NOREDOINOEXT … #define LOG_UPDATEMAP … #define LOG_NOREDOFILE … /* REDOPAGE/NOREDOPAGE log record data type */ #define LOG_INODE … #define LOG_XTREE … #define LOG_DTREE … #define LOG_BTROOT … #define LOG_EA … #define LOG_ACL … #define LOG_DATA … #define LOG_NEW … #define LOG_EXTEND … #define LOG_RELOCATE … #define LOG_DIR_XTREE … /* UPDATEMAP log record descriptor type */ #define LOG_ALLOCXADLIST … #define LOG_ALLOCPXDLIST … #define LOG_ALLOCXAD … #define LOG_ALLOCPXD … #define LOG_FREEXADLIST … #define LOG_FREEPXDLIST … #define LOG_FREEXAD … #define LOG_FREEPXD … struct lrd { … }; /* (36) */ #define LOGRDSIZE … /* * line vector descriptor */ struct lvd { … }; /* * log logical volume */ struct jfs_log { … }; /* * Log flag */ #define log_INLINELOG … #define log_SYNCBARRIER … #define log_QUIESCE … #define log_FLUSH … /* * group commit flag */ /* jfs_log */ #define logGC_PAGEOUT … /* tblock/lbuf */ #define tblkGC_QUEUE … #define tblkGC_READY … #define tblkGC_COMMIT … #define tblkGC_COMMITTED … #define tblkGC_EOP … #define tblkGC_FREE … #define tblkGC_LEADER … #define tblkGC_ERROR … #define tblkGC_LAZY … #define tblkGC_UNLOCKED … /* * log cache buffer header */ struct lbuf { … }; /* Reuse l_freelist for redrive list */ #define l_redrive_next … /* * logsynclist block * * common logsyncblk prefix for jbuf_t and tblock */ struct logsyncblk { … }; /* * logsynclist serialization (per log) */ #define LOGSYNC_LOCK_INIT(log) … #define LOGSYNC_LOCK(log, flags) … #define LOGSYNC_UNLOCK(log, flags) … /* compute the difference in bytes of lsn from sync point */ #define logdiff(diff, lsn, log) … extern int lmLogOpen(struct super_block *sb); extern int lmLogClose(struct super_block *sb); extern int lmLogShutdown(struct jfs_log * log); extern int lmLogInit(struct jfs_log * log); extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); extern int lmGroupCommit(struct jfs_log *, struct tblock *); extern int jfsIOWait(void *); extern void jfs_flush_journal(struct jfs_log * log, int wait); extern void jfs_syncpt(struct jfs_log *log, int hard_sync); #endif /* _H_JFS_LOGMGR */