1 The Lustre Log Facility
2 ~~~~~~~~~~~~~~~~~~~~~~~
5 The Lustre log (llog) file may contain a number of different types of
6 data structures, including redo records for uncommitted distributed
7 transactions such as unlink or ownership changes, configuration records
8 for targets and clients, or ChangeLog records to track changes to the
9 filesystem for external consumption, among others.
11 Each llog file begins with an 'llog_log_hdr' that describes the llog
12 file itself, followed by a series of log records that are appended
13 sequentially to the file. Each record, including the header itself,
14 begins with an 'llog_rec_hdr' and ends with an 'llog_rec_tail'.
27 The 'llog_logid' structure is used to identify a single Lustre log file.
28 It holds a <<struct-ost-id>> in 'lgl_oi', which is typically a FID.
35 struct llog_logid lgd_logid;
39 __u32 lgd_saved_index;
45 The lgd_llh_flags are:
48 LLOG_F_ZAP_WHEN_EMPTY = 0x1,
50 LLOG_F_IS_PLAIN = 0x4,
56 [[struct-llog-rec-hdr]]
66 The 'llog_rec_hdr' is at the start of each llog record and describes
67 the log record. 'lrh_len' holds the record size in bytes, including
68 the header and tail. 'lrh_index' is the record index within the llog
69 file and is sequentially increasing for each subsequent record. It
70 can be used to determine the offset within the llog file when searching
71 for an arbitrary record within the file. 'lrh_type' describes the type
72 of data stored in this record.
76 LLOG_PAD_MAGIC = LLOG_OP_MAGIC | 0x00000,
77 OST_SZ_REC = LLOG_OP_MAGIC | 0x00f00,
78 MDS_UNLINK64_REC = LLOG_OP_MAGIC | 0x90000 | (MDS_REINT << 8) |
80 MDS_SETATTR64_REC = LLOG_OP_MAGIC | 0x90000 | (MDS_REINT << 8) |
82 OBD_CFG_REC = LLOG_OP_MAGIC | 0x20000,
83 LLOG_GEN_REC = LLOG_OP_MAGIC | 0x40000,
84 CHANGELOG_REC = LLOG_OP_MAGIC | 0x60000,
85 CHANGELOG_USER_REC = LLOG_OP_MAGIC | 0x70000,
86 HSM_AGENT_REC = LLOG_OP_MAGIC | 0x80000,
87 UPDATE_REC = LLOG_OP_MAGIC | 0xa0000,
88 LLOG_HDR_MAGIC = LLOG_OP_MAGIC | 0x45539,
89 LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b,
95 [[struct-llog-rec-tail]]
97 struct llog_rec_tail {
103 The 'llog_rec_tail' is at the end of each llog record. The 'lrt_len'
104 and 'lrt_index' fields must be the same as 'lrh_len' and 'lrh_index'
105 in the header. They can be used to verify record integrity, as well
106 as allowing processing the llog records in reverse order.
108 LLog Log Header Information
109 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
110 [[struct-llog-log-hdr]]
112 struct llog_log_hdr {
113 struct llog_rec_hdr llh_hdr;
114 obd_time llh_timestamp;
116 __u32 llh_bitmap_offset;
120 /* for a catalog the first plain slot is next to it */
121 struct obd_uuid llh_tgtuuid;
122 __u32 llh_reserved[LLOG_HEADER_SIZE/sizeof(__u32) - 23];
123 __u32 llh_bitmap[LLOG_BITMAP_BYTES/sizeof(__u32)];
124 struct llog_rec_tail llh_tail;
128 The llog records start and end on a record size boundary, typically
129 8192 bytes, or as stored in 'llh_size', which allows some degree of
130 random access within the llog file, even with variable record sizes.
131 It is possible to interpolate the offset of an arbitrary record
132 within the file by estimating the byte offset of a particular record
133 index using 'llh_count' and the llog file size and aligning it to
134 the chunk boundary 'llh_size'. The record index in the 'llog_rec_hdr'
135 of the first record in that chunk can be used to further refine the
136 estimate of the offset of the desired index down to a single chunk,
137 and then sequential access can be used to find the actual record.