diff options
author | Christoph Hellwig <hch@lst.de> | 2013-04-03 01:11:17 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-04-21 16:03:33 -0400 |
commit | 93848a999cf9b9e4f4f77dba843a48c393f33c59 (patch) | |
tree | 92c2fb4e741a8d70e70f9d31df308d1a30ecaef6 /fs/xfs/xfs_inode.h | |
parent | 3fe58f30b4fc3f8a9084b035a02bc0c67bee8d00 (diff) |
xfs: add version 3 inode format with CRCs
Add a new inode version with a larger core. The primary objective is
to allow for a crc of the inode, and location information (uuid and ino)
to verify it was written in the right place. We also extend it by:
a creation time (for Samba);
a changecount (for NFSv4);
a flush sequence (in LSN format for recovery);
an additional inode flags field; and
some additional padding.
These additional fields are not implemented yet, but already laid
out in the structure.
[dchinner@redhat.com] Added LSN and flags field, some factoring and rework to
capture all the necessary information in the crc calculation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r-- | fs/xfs/xfs_inode.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index b8520b5c3a18..91129794aaec 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -150,13 +150,38 @@ typedef struct xfs_icdinode { | |||
150 | __uint16_t di_dmstate; /* DMIG state info */ | 150 | __uint16_t di_dmstate; /* DMIG state info */ |
151 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ | 151 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ |
152 | __uint32_t di_gen; /* generation number */ | 152 | __uint32_t di_gen; /* generation number */ |
153 | |||
154 | /* di_next_unlinked is the only non-core field in the old dinode */ | ||
155 | xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ | ||
156 | |||
157 | /* start of the extended dinode, writable fields */ | ||
158 | __uint32_t di_crc; /* CRC of the inode */ | ||
159 | __uint64_t di_changecount; /* number of attribute changes */ | ||
160 | xfs_lsn_t di_lsn; /* flush sequence */ | ||
161 | __uint64_t di_flags2; /* more random flags */ | ||
162 | __uint8_t di_pad2[16]; /* more padding for future expansion */ | ||
163 | |||
164 | /* fields only written to during inode creation */ | ||
165 | xfs_ictimestamp_t di_crtime; /* time created */ | ||
166 | xfs_ino_t di_ino; /* inode number */ | ||
167 | uuid_t di_uuid; /* UUID of the filesystem */ | ||
168 | |||
169 | /* structure must be padded to 64 bit alignment */ | ||
153 | } xfs_icdinode_t; | 170 | } xfs_icdinode_t; |
154 | 171 | ||
172 | static inline uint xfs_icdinode_size(int version) | ||
173 | { | ||
174 | if (version == 3) | ||
175 | return sizeof(struct xfs_icdinode); | ||
176 | return offsetof(struct xfs_icdinode, di_next_unlinked); | ||
177 | } | ||
178 | |||
155 | /* | 179 | /* |
156 | * Flags for xfs_ichgtime(). | 180 | * Flags for xfs_ichgtime(). |
157 | */ | 181 | */ |
158 | #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ | 182 | #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ |
159 | #define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ | 183 | #define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ |
184 | #define XFS_ICHGTIME_CREATE 0x4 /* inode create timestamp */ | ||
160 | 185 | ||
161 | /* | 186 | /* |
162 | * Per-fork incore inode flags. | 187 | * Per-fork incore inode flags. |
@@ -556,6 +581,7 @@ int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *, | |||
556 | struct xfs_buf **, uint, uint); | 581 | struct xfs_buf **, uint, uint); |
557 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, | 582 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, |
558 | struct xfs_inode *, uint); | 583 | struct xfs_inode *, uint); |
584 | void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *); | ||
559 | void xfs_dinode_to_disk(struct xfs_dinode *, | 585 | void xfs_dinode_to_disk(struct xfs_dinode *, |
560 | struct xfs_icdinode *); | 586 | struct xfs_icdinode *); |
561 | void xfs_idestroy_fork(struct xfs_inode *, int); | 587 | void xfs_idestroy_fork(struct xfs_inode *, int); |