Re: [PATCH 13/13] xfs: add CRC checks for quota blocks

Josef 'Jeff' Sipek
2009-02-12T06:42:35Z

On Tue, Feb 10, 2009 at 03:22:54PM -0500, Christoph Hellwig wrote:
> Use the reserved space in struct xfs_dqblk to store a UUID and a crc
> for the quota blocks.
>
> I'm pondering if we should just move the crc check into xfs_qm_dqcheck
> where all the other validity checks are located.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs/fs/xfs/xfs_quota.h
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_quota.h 2009-02-09 08:47:34.234069111 +0100
> +++ xfs/fs/xfs/xfs_quota.h 2009-02-10 20:15:36.874947481 +0100
> @@ -77,7 +77,13 @@ typedef struct xfs_disk_dquot {
> */
> typedef struct xfs_dqblk {
> xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */
> - char dd_fill[32]; /* filling for posterity */
> + char dd_fill[12]; /* filling for posterity */
> +
> + /*
> + * These two are only present one filesystems with the CRC bits set.
> + */
> + __be32 dd_crc; /* checksum */
> + uuid_t dd_uuid; /* location information */
> } xfs_dqblk_t;

Again, why put the crc/uuid at the end?

> Index: xfs/fs/xfs/quota/xfs_dquot.c
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_dquot.c 2009-02-10 19:55:01.982070089 +0100
> +++ xfs/fs/xfs/quota/xfs_dquot.c 2009-02-10 20:23:25.618944664 +0100
> @@ -368,6 +369,40 @@ xfs_qm_adjust_dqtimers(
...
> +STATIC int
> +xfs_dquot_verify_crc(
> + struct xfs_mount *mp,
> + struct xfs_buf *bp)
> +{
> + struct xfs_dqblk *d = (struct xfs_dqblk *)XFS_BUF_PTR(bp);
> + int i;
> +
> + for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++) {
> + if (!xfs_verify_cksum((char *)d, sizeof(struct xfs_dqblk),
> + offsetof(struct xfs_dqblk, dd_crc))) {
> +// !uuid_equal(&agfl->agfl_uuid, &mp->m_sb.sb_uuid) ||

Dead code?

Josef 'Jeff' Sipek.

--
FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #19
A: To be or not to be.
Q: What is the square root of 4b^2?