^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) International Business Machines Corp., 2000-2004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Portions Copyright (C) Christoph Hellwig, 2001-2002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef _H_JFS_LOGMGR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define _H_JFS_LOGMGR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/uuid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "jfs_filsys.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "jfs_lock.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * log manager configuration parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* log page size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define LOGPSIZE 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define L2LOGPSIZE 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define LOGPAGES 16 /* Log pages per mounted file system */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * log logical volume
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * a log is used to make the commit operation on journalled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * files within the same logical volume group atomic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * a log is implemented with a logical volume.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * there is one log per logical volume group.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * block 0 of the log logical volume is not used (ipl etc).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * block 1 contains a log "superblock" and is used by logFormat(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * lmLogInit(), lmLogShutdown(), and logRedo() to record status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * of the log but is not otherwise used during normal processing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * blocks 2 - (N-1) are used to contain log records.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * when a volume group is varied-on-line, logRedo() must have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * been executed before the file systems (logical volumes) in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * the volume group can be mounted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * log superblock (block 1 of logical volume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define LOGSUPER_B 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define LOGSTART_B 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define LOGMAGIC 0x87654321
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define LOGVERSION 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define MAX_ACTIVE 128 /* Max active file systems sharing log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct logsuper {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) __le32 magic; /* 4: log lv identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __le32 version; /* 4: version number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) __le32 serial; /* 4: log open/mount counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) __le32 size; /* 4: size in number of LOGPSIZE blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) __le32 bsize; /* 4: logical block size in byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) __le32 l2bsize; /* 4: log2 of bsize */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) __le32 flag; /* 4: option */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) __le32 state; /* 4: state - see below */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) __le32 end; /* 4: addr of last log record set by logredo */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) uuid_t uuid; /* 16: 128-bit journal uuid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) char label[16]; /* 16: journal label */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) uuid_t uuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) } active[MAX_ACTIVE]; /* 2048: active file systems list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* log flag: commit option (see jfs_filsys.h) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* log state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define LOGMOUNT 0 /* log mounted by lmLogInit() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define LOGREDONE 1 /* log shutdown by lmLogShutdown().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * log redo completed by logredo().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define LOGWRAP 2 /* log wrapped */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define LOGREADERR 3 /* log read error detected in logredo() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * log logical page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * (this comment should be rewritten !)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * the header and trailer structures (h,t) will normally have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * the same page and eor value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * An exception to this occurs when a complete page write is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * accomplished on a power failure. Since the hardware may "split write"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * sectors in the page, any out of order sequence may occur during powerfail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * and needs to be recognized during log replay. The xor value is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * an "exclusive or" of all log words in the page up to eor. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * 32 bit eor is stored with the top 16 bits in the header and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * bottom 16 bits in the trailer. logredo can easily recognize pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * that were not completed by reconstructing this eor and checking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * the log page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * Previous versions of the operating system did not allow split
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * writes and detected partially written records in logredo by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * ordering the updates to the header, trailer, and the move of data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * into the logdata area. The order: (1) data is moved (2) header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * is updated (3) trailer is updated. In logredo, when the header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * differed from the trailer, the header and trailer were reconciled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * as follows: if h.page != t.page they were set to the smaller of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * the two and h.eor and t.eor set to 8 (i.e. empty page). if (only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * h.eor != t.eor they were set to the smaller of their two values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct logpage {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct { /* header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __le32 page; /* 4: log sequence page number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __le16 rsrvd; /* 2: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __le16 eor; /* 2: end-of-log offset of lasrt record write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) } h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) __le32 data[LOGPSIZE / 4 - 4]; /* log record area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct { /* trailer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) __le32 page; /* 4: normally the same as h.page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) __le16 rsrvd; /* 2: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __le16 eor; /* 2: normally the same as h.eor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) } t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define LOGPHDRSIZE 8 /* log page header size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define LOGPTLRSIZE 8 /* log page trailer size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * log record
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * (this comment should be rewritten !)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * jfs uses only "after" log records (only a single writer is allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * in a page, pages are written to temporary paging space if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * if they must be written to disk before commit, and i/o is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * scheduled for modified pages to their home location after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * the log records containing the after values and the commit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * record is written to the log on disk, undo discards the copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * in main-memory.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * a log record consists of a data area of variable length followed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * a descriptor of fixed size LOGRDSIZE bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * the data area is rounded up to an integral number of 4-bytes and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * must be no longer than LOGPSIZE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * the descriptor is of size of multiple of 4-bytes and aligned on a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * 4-byte boundary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * records are packed one after the other in the data area of log pages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * (sometimes a DUMMY record is inserted so that at least one record ends
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * on every page or the longest record is placed on at most two pages).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * the field eor in page header/trailer points to the byte following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * the last record on a page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* log record types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define LOG_COMMIT 0x8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define LOG_SYNCPT 0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #define LOG_MOUNT 0x2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #define LOG_REDOPAGE 0x0800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #define LOG_NOREDOPAGE 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #define LOG_NOREDOINOEXT 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) #define LOG_UPDATEMAP 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #define LOG_NOREDOFILE 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /* REDOPAGE/NOREDOPAGE log record data type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #define LOG_INODE 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define LOG_XTREE 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #define LOG_DTREE 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define LOG_BTROOT 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #define LOG_EA 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #define LOG_ACL 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define LOG_DATA 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #define LOG_NEW 0x0100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) #define LOG_EXTEND 0x0200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define LOG_RELOCATE 0x0400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #define LOG_DIR_XTREE 0x0800 /* Xtree is in directory inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* UPDATEMAP log record descriptor type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define LOG_ALLOCXADLIST 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #define LOG_ALLOCPXDLIST 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) #define LOG_ALLOCXAD 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #define LOG_ALLOCPXD 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) #define LOG_FREEXADLIST 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #define LOG_FREEPXDLIST 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) #define LOG_FREEXAD 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define LOG_FREEPXD 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) struct lrd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * type independent area
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __le32 logtid; /* 4: log transaction identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) __le32 backchain; /* 4: ptr to prev record of same transaction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) __le16 type; /* 2: record type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) __le16 length; /* 2: length of data in record (in byte) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) __le32 aggregate; /* 4: file system lv/aggregate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /* (16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * type dependent area (20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * COMMIT: commit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) * transaction commit: no type-dependent information;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * REDOPAGE: after-image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * apply after-image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) __le32 fileset; /* 4: fileset number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) __le32 inode; /* 4: inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) __le16 type; /* 2: REDOPAGE record type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) __le16 l2linesize; /* 2: log2 of line size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) pxd_t pxd; /* 8: on-disk page pxd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) } redopage; /* (20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) * NOREDOPAGE: the page is freed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * do not apply after-image records which precede this record
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) * in the log with the same page block number to this page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) * N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) __le32 fileset; /* 4: fileset number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) __le32 inode; /* 4: inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) __le16 type; /* 2: NOREDOPAGE record type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) __le16 rsrvd; /* 2: reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) pxd_t pxd; /* 8: on-disk page pxd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) } noredopage; /* (20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) * UPDATEMAP: update block allocation map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) * either in-line PXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) * or out-of-line XADLIST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) * N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) __le32 fileset; /* 4: fileset number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) __le32 inode; /* 4: inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) __le16 type; /* 2: UPDATEMAP record type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) __le16 nxd; /* 2: number of extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) pxd_t pxd; /* 8: pxd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) } updatemap; /* (20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * NOREDOINOEXT: the inode extent is freed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * do not apply after-image records which precede this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * record in the log with the any of the 4 page block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * numbers in this inode extent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * NOTE: The fileset and pxd fields MUST remain in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * the same fields in the REDOPAGE record format.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) __le32 fileset; /* 4: fileset number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __le32 iagnum; /* 4: IAG number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __le32 inoext_idx; /* 4: inode extent index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) pxd_t pxd; /* 8: on-disk page pxd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) } noredoinoext; /* (20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * SYNCPT: log sync point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) * replay log up to syncpt address specified;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) __le32 sync; /* 4: syncpt address (0 = here) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) } syncpt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * MOUNT: file system mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * file system mount: no type-dependent information;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) * ? FREEXTENT: free specified extent(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * free specified extent(s) from block allocation map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * N.B.: nextents should be length of data/sizeof(xad_t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) __le32 type; /* 4: FREEXTENT record type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) __le32 nextent; /* 4: number of extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) /* data: PXD or XAD list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) } freextent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) * ? NOREDOFILE: this file is freed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) * do not apply records which precede this record in the log
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) * with the same inode number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * NOREDOFILE must be the first to be written at commit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * (last to be read in logredo()) - it prevents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) * replay of preceding updates of all preceding generations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) * of the inumber esp. the on-disk inode itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) __le32 fileset; /* 4: fileset number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) __le32 inode; /* 4: inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) } noredofile;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) * ? NEWPAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * metadata type dependent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) __le32 fileset; /* 4: fileset number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) __le32 inode; /* 4: inode number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) __le32 type; /* 4: NEWPAGE record type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) pxd_t pxd; /* 8: on-disk page pxd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) } newpage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) * ? DUMMY: filler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) * no type-dependent information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) } log;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) }; /* (36) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) #define LOGRDSIZE (sizeof(struct lrd))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * line vector descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) struct lvd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) __le16 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) __le16 length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * log logical volume
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) struct jfs_log {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) struct list_head sb_list;/* This is used to sync metadata
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) * before writing syncpt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) struct list_head journal_list; /* Global list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) struct block_device *bdev; /* 4: log lv pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) int serial; /* 4: log mount serial number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) s64 base; /* @8: log extent address (inline log ) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) int size; /* 4: log size in log page (in page) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) int l2bsize; /* 4: log2 of bsize */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) unsigned long flag; /* 4: flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) struct lbuf *lbuf_free; /* 4: free lbufs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) wait_queue_head_t free_wait; /* 4: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) /* log write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) int logtid; /* 4: log tid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) int page; /* 4: page number of eol page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) int eor; /* 4: eor of last record in eol page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) struct lbuf *bp; /* 4: current log page buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) struct mutex loglock; /* 4: log write serialization lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) /* syncpt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) int nextsync; /* 4: bytes to write before next syncpt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) int active; /* 4: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) wait_queue_head_t syncwait; /* 4: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /* commit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) uint cflag; /* 4: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) struct list_head cqueue; /* FIFO commit queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) struct tblock *flush_tblk; /* tblk we're waiting on for flush */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) int gcrtc; /* 4: GC_READY transaction count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) struct tblock *gclrt; /* 4: latest GC_READY transaction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) spinlock_t gclock; /* 4: group commit lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) int logsize; /* 4: log data area size in byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) int lsn; /* 4: end-of-log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) int clsn; /* 4: clsn */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) int syncpt; /* 4: addr of last syncpt record */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) int sync; /* 4: addr from last logsync() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) struct list_head synclist; /* 8: logsynclist anchor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) spinlock_t synclock; /* 4: synclist lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) struct lbuf *wqueue; /* 4: log pageout queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) int count; /* 4: count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) uuid_t uuid; /* 16: 128-bit uuid of log device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) int no_integrity; /* 3: flag to disable journaling to disk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) * Log flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) #define log_INLINELOG 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) #define log_SYNCBARRIER 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) #define log_QUIESCE 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) #define log_FLUSH 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) * group commit flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) /* jfs_log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) #define logGC_PAGEOUT 0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) /* tblock/lbuf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) #define tblkGC_QUEUE 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) #define tblkGC_READY 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) #define tblkGC_COMMIT 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) #define tblkGC_COMMITTED 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) #define tblkGC_EOP 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) #define tblkGC_FREE 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) #define tblkGC_LEADER 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) #define tblkGC_ERROR 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) #define tblkGC_LAZY 0x0100 // D230860
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) #define tblkGC_UNLOCKED 0x0200 // D230860
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * log cache buffer header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) struct lbuf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) struct jfs_log *l_log; /* 4: log associated with buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) * data buffer base area
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) uint l_flag; /* 4: pageout control flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) struct lbuf *l_wqnext; /* 4: write queue link */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) struct lbuf *l_freelist; /* 4: freelistlink */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) int l_pn; /* 4: log page number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) int l_eor; /* 4: log record eor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) int l_ceor; /* 4: committed log record eor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) s64 l_blkno; /* 8: log page block number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) caddr_t l_ldata; /* 4: data page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) struct page *l_page; /* The page itself */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) uint l_offset; /* Offset of l_ldata within the page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) wait_queue_head_t l_ioevent; /* 4: i/o done event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) /* Reuse l_freelist for redrive list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) #define l_redrive_next l_freelist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) * logsynclist block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) * common logsyncblk prefix for jbuf_t and tblock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) struct logsyncblk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) u16 xflag; /* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) u16 flag; /* only meaninful in tblock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) lid_t lid; /* lock id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) s32 lsn; /* log sequence number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) struct list_head synclist; /* log sync list link */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) * logsynclist serialization (per log)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) #define LOGSYNC_LOCK_INIT(log) spin_lock_init(&(log)->synclock)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) #define LOGSYNC_LOCK(log, flags) spin_lock_irqsave(&(log)->synclock, flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) #define LOGSYNC_UNLOCK(log, flags) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) spin_unlock_irqrestore(&(log)->synclock, flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) /* compute the difference in bytes of lsn from sync point */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) #define logdiff(diff, lsn, log)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) diff = (lsn) - (log)->syncpt;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) if (diff < 0)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) diff += (log)->logsize;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) extern int lmLogOpen(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) extern int lmLogClose(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) extern int lmLogShutdown(struct jfs_log * log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) extern int lmLogInit(struct jfs_log * log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) extern int lmGroupCommit(struct jfs_log *, struct tblock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) extern int jfsIOWait(void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) extern void jfs_flush_journal(struct jfs_log * log, int wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) extern void jfs_syncpt(struct jfs_log *log, int hard_sync);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) #endif /* _H_JFS_LOGMGR */