From: Dave Chinner Date: Wed, 13 Nov 2013 06:40:48 +0000 (+0000) Subject: db: verify and calculate dquot CRCs X-Git-Tag: v3.2.0-alpha2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=66a40d020d7abb6fe09693f4392b6af2b30aa3b3;p=thirdparty%2Fxfsprogs-dev.git db: verify and calculate dquot CRCs 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 Reviewed-by: Christoph Hellwig Signed-off-by: Rich Johnston --- diff --git a/db/io.c b/db/io.c index 6e3282e50..123214d16 100644 --- 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 1f8270dcf..4f24c83b8 100644 --- 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 */