Whamcloud - gitweb
Sync kernel's unification of jbd2 revoke and tag block checksum handling
[tools/e2fsprogs.git] / e2fsck / jfs_user.h
index 46df997..239ac1d 100644 (file)
@@ -226,6 +226,22 @@ extern e2fsck_t e2fsck_global_ctx;  /* Try your very best not to use this! */
 #define EFSCORRUPTED   EXT2_ET_FILESYSTEM_CORRUPTED
 #endif
 
+static inline void jbd2_descriptor_block_csum_set(journal_t *j,
+                                                 struct buffer_head *bh)
+{
+       struct jbd2_journal_block_tail *tail;
+       __u32 csum;
+
+       if (!jbd2_journal_has_csum_v2or3(j))
+               return;
+
+       tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
+                       sizeof(struct jbd2_journal_block_tail));
+       tail->t_checksum = 0;
+       csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
+       tail->t_checksum = cpu_to_be32(csum);
+}
+
 /* recovery.c */
 extern int     jbd2_journal_recover    (journal_t *journal);
 extern int     jbd2_journal_skip_recovery (journal_t *);