Lines Matching +full:self +full:- +full:describing

1 .. SPDX-License-Identifier: GPL-2.0
5 XFS Self Describing Metadata
40 Self Describing Metadata
61 self describing metadata.
63 The first, fundamental requirement of self describing metadata is that the
70 Luckily, almost all XFS metadata has magic numbers embedded already - only the
72 magic numbers. Hence we can change the on-disk format of all these objects to
75 the metadata isn't self identifying. If it contains a new magic number, it is
76 self identifying and we can do much more expansive automated verification of the
79 As a primary concern, self describing metadata needs some form of overall
87 hence a 32 bit CRC is more than sufficient to detect multi-bit errors in
96 Self describing metadata needs to contain enough information so that the
100 mis-directed writes - a write might be misdirected to the wrong LUN and so be
123 Self describing metadata also needs to contain some indication of when it was
129 present that the run-time verification is not detecting.
151 Validation of self-describing metadata takes place at runtime in two places:
153 - immediately after a successful read from disk
154 - immediately prior to write IO submission
156 The verification is completely stateless - it is done independently of the
163 body, but in general most of the per-field validation is handled by the
182 Write verification is the opposite of the read verification - first the object
192 A typical on-disk structure needs to contain the following information::
211 - short btree blocks have a 32 bit owner (ag number) and a 32 bit block
216 - directory/attribute node blocks have a 16 bit magic number, and the
229 struct xfs_mount *mp = bp->b_mount;
231 if ((xfs_sb_version_hascrc(&mp->m_sb) &&
232 !xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),
235 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
252 struct xfs_mount *mp = bp->b_mount;
253 struct xfs_ondisk_hdr *hdr = bp->b_addr;
255 if (hdr->magic != cpu_to_be32(XFS_FOO_MAGIC))
258 if (!xfs_sb_version_hascrc(&mp->m_sb)) {
259 if (!uuid_equal(&hdr->uuid, &mp->m_sb.sb_uuid))
261 if (bp->b_bn != be64_to_cpu(hdr->blkno))
263 if (hdr->owner == 0)
279 struct xfs_mount *mp = bp->b_mount;
280 struct xfs_ondisk_hdr *hdr = bp->b_addr;
282 if (hdr->magic == cpu_to_be32(XFS_FOO_CRC_MAGIC)) {
283 if (!uuid_equal(&hdr->uuid, &mp->m_sb.sb_uuid))
285 if (bp->b_bn != be64_to_cpu(hdr->blkno))
287 if (hdr->owner == 0)
289 } else if (hdr->magic != cpu_to_be32(XFS_FOO_MAGIC))
304 struct xfs_mount *mp = bp->b_mount;
305 struct xfs_buf_log_item *bip = bp->b_fspriv;
308 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
313 if (!xfs_sb_version_hascrc(&mp->m_sb))
318 struct xfs_ondisk_hdr *hdr = bp->b_addr;
319 hdr->lsn = cpu_to_be64(bip->bli_item.li_lsn);
321 xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length), XFS_FOO_CRC_OFF);
333 Inodes and dquots are special snowflakes. They have per-object CRC and
334 self-identifiers, but they are packed so that there are multiple objects per
335 buffer. Hence we do not use per-buffer verifiers to do the work of per-object
336 verification and CRC calculations. The per-buffer verifiers simply perform basic
337 identification of the buffer - that they contain inodes or dquots, and that
352 log recovery. So, it's gone unnoticed until now. This won't matter immediately -
353 repair will probably complain about it - but it needs to be fixed.