Skip to contentSkip to conversation

xfsprogs: add hex offset for superblock structure

RFC PATCH In review Li Zhong 2 participants 2 messages Sep 23, 2013

lore
Share & tools
lore

Li Zhong

author
#0 lore raw

RFC PATCH 1/1 xfsprogs: add hex offset for superblock structure

It would be a little bit easier if somebody uses something like hexdump to check the superblock of one device.

---
 include/xfs_sb.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
include/xfs_sb.h +17 -17
index c8d8898..bb9e2df 100644
@@ -185,27 +185,27 @@ typedef struct xfs_sb {
  * Must be padded to 64 bit alignment.
  */
 typedef struct xfs_dsb {
-	__be32		sb_magicnum;	/* magic number == XFS_SB_MAGIC */
+/*00*/	__be32		sb_magicnum;	/* magic number == XFS_SB_MAGIC */
 	__be32		sb_blocksize;	/* logical block size, bytes */
 	__be64		sb_dblocks;	/* number of data blocks */
-	__be64		sb_rblocks;	/* number of realtime blocks */
+/*10*/	__be64		sb_rblocks;	/* number of realtime blocks */
 	__be64		sb_rextents;	/* number of realtime extents */
-	uuid_t		sb_uuid;	/* file system unique id */
-	__be64		sb_logstart;	/* starting block of log if internal */
+/*20*/	uuid_t		sb_uuid;	/* file system unique id */
+/*30*/	__be64		sb_logstart;	/* starting block of log if internal */
 	__be64		sb_rootino;	/* root inode number */
-	__be64		sb_rbmino;	/* bitmap inode for realtime extents */
+/*40*/	__be64		sb_rbmino;	/* bitmap inode for realtime extents */
 	__be64		sb_rsumino;	/* summary inode for rt bitmap */
-	__be32		sb_rextsize;	/* realtime extent size, blocks */
+/*50*/	__be32		sb_rextsize;	/* realtime extent size, blocks */
 	__be32		sb_agblocks;	/* size of an allocation group */
 	__be32		sb_agcount;	/* number of allocation groups */
 	__be32		sb_rbmblocks;	/* number of rt bitmap blocks */
-	__be32		sb_logblocks;	/* number of log blocks */
+/*60*/	__be32		sb_logblocks;	/* number of log blocks */
 	__be16		sb_versionnum;	/* header version == XFS_SB_VERSION */
 	__be16		sb_sectsize;	/* volume sector size, bytes */
 	__be16		sb_inodesize;	/* inode size, bytes */
 	__be16		sb_inopblock;	/* inodes per block */
-	char		sb_fname[12];	/* file system name */
-	__u8		sb_blocklog;	/* log2 of sb_blocksize */
+/*6C*/	char		sb_fname[12];	/* file system name */
+/*78*/	__u8		sb_blocklog;	/* log2 of sb_blocksize */
 	__u8		sb_sectlog;	/* log2 of sb_sectsize */
 	__u8		sb_inodelog;	/* log2 of sb_inodesize */
 	__u8		sb_inopblog;	/* log2 of sb_inopblock */
@@ -219,22 +219,22 @@ typedef struct xfs_dsb {
 	 * want to change their layout, make sure you fix the
 	 * code in xfs_trans_apply_sb_deltas().
 	 */
-	__be64		sb_icount;	/* allocated inodes */
+/*80*/	__be64		sb_icount;	/* allocated inodes */
 	__be64		sb_ifree;	/* free inodes */
-	__be64		sb_fdblocks;	/* free data blocks */
+/*90*/	__be64		sb_fdblocks;	/* free data blocks */
 	__be64		sb_frextents;	/* free realtime extents */
 	/*
 	 * End contiguous fields.
 	 */
-	__be64		sb_uquotino;	/* user quota inode */
+/*A0*/	__be64		sb_uquotino;	/* user quota inode */
 	__be64		sb_gquotino;	/* group quota inode */
-	__be16		sb_qflags;	/* quota flags */
+/*B0*/	__be16		sb_qflags;	/* quota flags */
 	__u8		sb_flags;	/* misc. flags */
 	__u8		sb_shared_vn;	/* shared version number */
 	__be32		sb_inoalignmt;	/* inode chunk alignment, fsblocks */
 	__be32		sb_unit;	/* stripe or raid unit */
 	__be32		sb_width;	/* stripe or raid width */
-	__u8		sb_dirblklog;	/* log2 of dir block size (fsbs) */
+/*C0*/	__u8		sb_dirblklog;	/* log2 of dir block size (fsbs) */
 	__u8		sb_logsectlog;	/* log2 of the log sector size */
 	__be16		sb_logsectsize;	/* sector size for the log, bytes */
 	__be32		sb_logsunit;	/* stripe unit size for the log */
@@ -250,16 +250,16 @@ typedef struct xfs_dsb {
 	/* version 5 superblock fields start here */
 
 	/* feature masks */
-	__be32		sb_features_compat;
+/*D0*/	__be32		sb_features_compat;
 	__be32		sb_features_ro_compat;
 	__be32		sb_features_incompat;
 	__be32		sb_features_log_incompat;
 
-	__le32		sb_crc;		/* superblock crc */
+/*E0*/	__le32		sb_crc;		/* superblock crc */
 	__be32		sb_pad;
 
 	__be64		sb_pquotino;	/* project quota inode */
-	__be64		sb_lsn;		/* last write sequence */
+/*F0*/	__be64		sb_lsn;		/* last write sequence */
 
 	/* must be padded to 64 bit alignment */
 } xfs_dsb_t;
Signature · 7 lines
1.8.1.4


_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 2 lines · Li Zhong

It would be a little bit easier if somebody uses something like hexdump to check the superblock of one device.

NACK. If you want this information, use pahole.

Cheers,

Dave.

$ pahole fs/xfs/xfs_sb.o |grep -A 61 "struct xfs_dsb"
struct xfs_dsb {
        __be32                     sb_magicnum;          /*     0     4 */
        __be32                     sb_blocksize;         /*     4     4 */
        __be64                     sb_dblocks;           /*     8     8 */
        __be64                     sb_rblocks;           /*    16     8 */
        __be64                     sb_rextents;          /*    24     8 */
        uuid_t                     sb_uuid;              /*    32    16 */
        __be64                     sb_logstart;          /*    48     8 */
        __be64                     sb_rootino;           /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        __be64                     sb_rbmino;            /*    64     8 */
        __be64                     sb_rsumino;           /*    72     8 */
        __be32                     sb_rextsize;          /*    80     4 */
        __be32                     sb_agblocks;          /*    84     4 */
        __be32                     sb_agcount;           /*    88     4 */
        __be32                     sb_rbmblocks;         /*    92     4 */
        __be32                     sb_logblocks;         /*    96     4 */
        __be16                     sb_versionnum;        /*   100     2 */
        __be16                     sb_sectsize;          /*   102     2 */
        __be16                     sb_inodesize;         /*   104     2 */
        __be16                     sb_inopblock;         /*   106     2 */
        char                       sb_fname[12];         /*   108    12 */
        __u8                       sb_blocklog;          /*   120     1 */
        __u8                       sb_sectlog;           /*   121     1 */
        __u8                       sb_inodelog;          /*   122     1 */
        __u8                       sb_inopblog;          /*   123     1 */
        __u8                       sb_agblklog;          /*   124     1 */
        __u8                       sb_rextslog;          /*   125     1 */
        __u8                       sb_inprogress;        /*   126     1 */
        __u8                       sb_imax_pct;          /*   127     1 */
        /* --- cacheline 2 boundary (128 bytes) --- */
        __be64                     sb_icount;            /*   128     8 */
        __be64                     sb_ifree;             /*   136     8 */
        __be64                     sb_fdblocks;          /*   144     8 */
        __be64                     sb_frextents;         /*   152     8 */
        __be64                     sb_uquotino;          /*   160     8 */
        __be64                     sb_gquotino;          /*   168     8 */
        __be16                     sb_qflags;            /*   176     2 */
        __u8                       sb_flags;             /*   178     1 */
        __u8                       sb_shared_vn;         /*   179     1 */
        __be32                     sb_inoalignmt;        /*   180     4 */
        __be32                     sb_unit;              /*   184     4 */
        __be32                     sb_width;             /*   188     4 */
        /* --- cacheline 3 boundary (192 bytes) --- */
        __u8                       sb_dirblklog;         /*   192     1 */
        __u8                       sb_logsectlog;        /*   193     1 */
        __be16                     sb_logsectsize;       /*   194     2 */
        __be32                     sb_logsunit;          /*   196     4 */
        __be32                     sb_features2;         /*   200     4 */
        __be32                     sb_bad_features2;     /*   204     4 */
        __be32                     sb_features_compat;   /*   208     4 */
        __be32                     sb_features_ro_compat; /*   212     4 */
        __be32                     sb_features_incompat; /*   216     4 */
        __be32                     sb_features_log_incompat; /*   220     4 */
        __le32                     sb_crc;               /*   224     4 */
        __be32                     sb_pad;               /*   228     4 */
        __be64                     sb_pquotino;          /*   232     8 */
        __be64                     sb_lsn;               /*   240     8 */
        /* size: 248, cachelines: 4, members: 54 */
        /* last cacheline: 56 bytes */
};
Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs