static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, tid_t sequence, struct recovery_info *info) { journal_revoke_header_t *header; int offset, max; int record_len = 4; header = (journal_revoke_header_t *) bh->b_data; offset = sizeof(journal_revoke_header_t); max = be32_to_cpu(header->r_count); if (!jbd2_revoke_block_csum_verify(journal, header)) return -EINVAL; if (JFS_HAS_INCOMPAT_FEATURE(journal, JFS_FEATURE_INCOMPAT_64BIT)) record_len = 8; while (offset < max) { unsigned long long blocknr; int err; if (record_len == 4) blocknr = ext2fs_be32_to_cpu(*((__be32 *)(bh->b_data + offset))); else blocknr = ext2fs_be64_to_cpu(*((__be64 *)(bh->b_data + offset))); offset += record_len; err = journal_set_revoke(journal, blocknr, sequence); if (err) return err; ++info->nr_revokes; } return 0; }
static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, tid_t sequence, struct recovery_info *info) { journal_revoke_header_t *header; int offset, max; int csum_size = 0; __u32 rcount; int record_len = 4; header = (journal_revoke_header_t *) bh->b_data; offset = sizeof(journal_revoke_header_t); rcount = ext2fs_be32_to_cpu(header->r_count); if (!jbd2_revoke_block_csum_verify(journal, header)) return -EFSBADCRC; if (journal_has_csum_v2or3(journal)) csum_size = sizeof(struct journal_revoke_tail); if (rcount > journal->j_blocksize - csum_size) return -EINVAL; max = rcount; if (jfs_has_feature_64bit(journal)) record_len = 8; while (offset + record_len <= max) { unsigned long long blocknr; int err; if (record_len == 4) blocknr = ext2fs_be32_to_cpu(* ((__u32 *) (bh->b_data+offset))); else blocknr = ext2fs_be64_to_cpu(* ((__u64 *) (bh->b_data+offset))); offset += record_len; err = journal_set_revoke(journal, blocknr, sequence); if (err) return err; ++info->nr_revokes; } return 0; }