journal.c (e4adf8b837087b5bb57fff6827e10ec877a50f64) journal.c (18dad509e7bd3189ac1e7f7904faf1561a908871)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * linux/fs/jbd2/journal.c
4 *
5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998
6 *
7 * Copyright 1998 Red Hat corp --- All Rights Reserved
8 *

--- 101 unchanged lines hidden (view full) ---

110 vaf.fmt = fmt;
111 vaf.va = &args;
112 printk(KERN_DEBUG "%s: (%s, %u): %pV", file, func, line, &vaf);
113 va_end(args);
114}
115#endif
116
117/* Checksumming functions */
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * linux/fs/jbd2/journal.c
4 *
5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998
6 *
7 * Copyright 1998 Red Hat corp --- All Rights Reserved
8 *

--- 101 unchanged lines hidden (view full) ---

110 vaf.fmt = fmt;
111 vaf.va = &args;
112 printk(KERN_DEBUG "%s: (%s, %u): %pV", file, func, line, &vaf);
113 va_end(args);
114}
115#endif
116
117/* Checksumming functions */
118static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb)
119{
120 if (!jbd2_journal_has_csum_v2or3_feature(j))
121 return 1;
122
123 return sb->s_checksum_type == JBD2_CRC32C_CHKSUM;
124}
125
126static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb)
127{
128 __u32 csum;
129 __be32 old_csum;
130
131 old_csum = sb->s_checksum;
132 sb->s_checksum = 0;
133 csum = jbd2_chksum(j, ~0, (char *)sb, sizeof(journal_superblock_t));

--- 1290 unchanged lines hidden (view full) ---

1424 if (jbd2_journal_has_csum_v2or3_feature(journal) &&
1425 jbd2_has_feature_checksum(journal)) {
1426 /* Can't have checksum v1 and v2 on at the same time! */
1427 printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2/3 "
1428 "at the same time!\n");
1429 goto out;
1430 }
1431
118static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb)
119{
120 __u32 csum;
121 __be32 old_csum;
122
123 old_csum = sb->s_checksum;
124 sb->s_checksum = 0;
125 csum = jbd2_chksum(j, ~0, (char *)sb, sizeof(journal_superblock_t));

--- 1290 unchanged lines hidden (view full) ---

1416 if (jbd2_journal_has_csum_v2or3_feature(journal) &&
1417 jbd2_has_feature_checksum(journal)) {
1418 /* Can't have checksum v1 and v2 on at the same time! */
1419 printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2/3 "
1420 "at the same time!\n");
1421 goto out;
1422 }
1423
1432 if (!jbd2_verify_csum_type(journal, sb)) {
1433 printk(KERN_ERR "JBD2: Unknown checksum type\n");
1434 goto out;
1435 }
1436
1437 /* Load the checksum driver */
1438 if (jbd2_journal_has_csum_v2or3_feature(journal)) {
1424 /* Load the checksum driver */
1425 if (jbd2_journal_has_csum_v2or3_feature(journal)) {
1426 if (sb->s_checksum_type != JBD2_CRC32C_CHKSUM) {
1427 printk(KERN_ERR "JBD2: Unknown checksum type\n");
1428 goto out;
1429 }
1430
1439 journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
1440 if (IS_ERR(journal->j_chksum_driver)) {
1441 printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
1442 err = PTR_ERR(journal->j_chksum_driver);
1443 journal->j_chksum_driver = NULL;
1444 goto out;
1445 }
1446 /* Check superblock checksum */

--- 1744 unchanged lines hidden ---
1431 journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
1432 if (IS_ERR(journal->j_chksum_driver)) {
1433 printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
1434 err = PTR_ERR(journal->j_chksum_driver);
1435 journal->j_chksum_driver = NULL;
1436 goto out;
1437 }
1438 /* Check superblock checksum */

--- 1744 unchanged lines hidden ---