xfs
[Top] [All Lists]

[RFC PATCH 09/12] db: verify and calculate dquot CRCs

To: xfs@xxxxxxxxxxx
Subject: [RFC PATCH 09/12] db: verify and calculate dquot CRCs
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 5 Sep 2013 22:13:30 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1378383213-16155-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1378383213-16155-1-git-send-email-david@xxxxxxxxxxxxx>
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@xxxxxxxxxx>
---
 db/io.c | 5 ++++-
 db/io.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/db/io.c b/db/io.c
index 5f2e492..04f1879 100644
--- a/db/io.c
+++ b/db/io.c
@@ -464,7 +464,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
@@ -532,6 +534,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 1f8270d..4f24c83 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 */
-- 
1.8.3.2

<Prev in Thread] Current Thread [Next in Thread>