]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
db: verify and calculate dquot CRCs
authorDave Chinner <david@fromorbit.com>
Wed, 13 Nov 2013 06:40:48 +0000 (06:40 +0000)
committerRich Johnston <rjohnston@sgi.com>
Wed, 13 Nov 2013 17:14:03 +0000 (11:14 -0600)
When we set the current Io cursor to point at a dquot block, verify
that the dquot CRC is intact. And prior to writing such an IO
cursor, calculate the dquot CRC.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
db/io.c
db/io.h

diff --git a/db/io.c b/db/io.c
index 6e3282e507d24d5a85ac3afc80273ed490308547..123214d16e90f63f72bf9bdc2731d65947daff5d 100644 (file)
--- a/db/io.c
+++ b/db/io.c
@@ -466,7 +466,9 @@ write_cur(void)
 
        if (iocur_top->ino_buf)
                libxfs_dinode_calc_crc(mp, iocur_top->data);
-
+       if (iocur_top->dquot_buf)
+               xfs_update_cksum(iocur_top->data, sizeof(struct xfs_dqblk),
+                                XFS_DQUOT_CRC_OFF);
        if (iocur_top->bbmap)
                write_cur_bbs();
        else
@@ -540,6 +542,7 @@ set_cur(
        iocur_top->dirino = dirino;
        iocur_top->mode = mode;
        iocur_top->ino_buf = 0;
+       iocur_top->dquot_buf = 0;
 
        /* store location in ring */
        if (ring_flag)
diff --git a/db/io.h b/db/io.h
index 1f8270dcfda549950074808f4e35a0bcee7484dc..4f24c83b8673dab0414181bcfeb7d3ff3452efd8 100644 (file)
--- a/db/io.h
+++ b/db/io.h
@@ -40,6 +40,7 @@ typedef struct iocur {
        struct xfs_buf          *bp;    /* underlying buffer */
        int                     ino_crc_ok:1;
        int                     ino_buf:1;
+       int                     dquot_buf:1;
 } iocur_t;
 
 #define DB_RING_ADD 1                   /* add to ring on set_cur */