From: Steven Whitehouse Date: Thu, 18 Jan 2018 16:07:09 +0000 Subject: [Cluster-devel] [GFS2 PATCH][v4] GFS2: Introduce new gfs2_log_header_v2 In-Reply-To: References: <831276753.3320025.1515084688898.JavaMail.zimbra@redhat.com> Message-ID: <494ed9da-4c6c-2f67-3774-56cc6aafa562@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, On 18/01/18 16:04, Andrew Price wrote: > On 04/01/18 16:51, Bob Peterson wrote: > >> diff --git a/include/uapi/linux/gfs2_ondisk.h >> b/include/uapi/linux/gfs2_ondisk.h >> index 09f0920f07e9..7eb73c32272f 100644 >> --- a/include/uapi/linux/gfs2_ondisk.h >> +++ b/include/uapi/linux/gfs2_ondisk.h >> @@ -403,7 +403,15 @@ struct gfs2_ea_header { >> ?? * Log header structure >> ?? */ >> ? -#define GFS2_LOG_HEAD_UNMOUNT??? 0x00000001??? /* log is clean */ >> +#define GFS2_LOG_HEAD_UNMOUNT??????? 0x00000001 /* log is clean */ >> +#define GFS2_LOG_HEAD_FLUSH_NORMAL??? 0x00000002 /* normal log flush */ >> +#define GFS2_LOG_HEAD_FLUSH_SYNC??? 0x00000004 /* Sync log flush */ >> +#define GFS2_LOG_HEAD_FLUSH_SHUTDOWN??? 0x00000008 /* Shutdown log >> flush */ >> +#define GFS2_LOG_HEAD_FLUSH_FREEZE??? 0x00000010 /* Freeze flush */ >> +#define GFS2_LOG_HEAD_RECOVERY??????? 0x00000020 /* Journal recovery */ >> +#define GFS2_LOG_HEAD_USERSPACE??????? 0x80000000 /* Written by >> gfs2-utils */ >> + >> +#define LH_V1_SIZE (offsetofend(struct gfs2_log_header, lh_hash)) >> ? ? struct gfs2_log_header { >> ????? struct gfs2_meta_header lh_header; >> @@ -413,6 +421,21 @@ struct gfs2_log_header { >> ????? __be32 lh_tail;??????? /* Block number of log tail */ >> ????? __be32 lh_blkno; >> ????? __be32 lh_hash; >> + >> +??? /* Version 2 additional fields start here */ >> +??? __be32 lh_crc;??????? /* crc32 of whole block with this field 0 */ >> +??? __be32 lh_nsec;??????? /* Nano second time stamp */ >> +??? __be64 lh_sec;??????? /* Second based time stamp */ >> +??? __be64 lh_addr;??????? /* Block addr of this log header >> (absolute) */ >> +??? __be64 lh_jinode;??? /* Journal inode number */ >> +??? __be64 lh_statfs_addr;??? /* Local statfs inode number */ >> +??? __be64 lh_quota_addr;??? /* Local quota change inode number */ >> + >> +??? /* Statfs local changes (i.e. diff from global statfs) */ >> +??? __be64 lh_local_total; >> +??? __be64 lh_local_free; >> +??? __be64 lh_local_dinodes; >> +??? __be32 lh_log_origin;??? /* The origin of this log header */ >> ? }; >> ? ? /* >> > > Thinking about tools like fsck.gfs2, which will be built with the new > header but could be looking at older structures on-disk, how would it > know whether to treat the log header as a v1 or v2? > > Andy The additional fields will all be zero in case it is a v1 header. Also we have the crc of everything there, and if that doesn't check out, then only the v1 fields should be used (assuming that the original checksum is correct, that is) Steve.