Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377575
b: refs/heads/master
c: eee06c5
h: refs/heads/master
i:
  377573: 931f518
  377571: a68d604
  377567: 262c9fd
v: v3
  • Loading branch information
Darrick J. Wong authored and Theodore Ts'o committed May 28, 2013
1 parent 3d09ea6 commit 93e9800
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d9cf9c6254ddc551fb51072f59dfae60e579736
refs/heads/master: eee06c56784496805b198964c59fa8cd7c00bf48
13 changes: 7 additions & 6 deletions trunk/fs/jbd2/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,21 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
{
struct page *page = bh->b_page;
__u8 *addr;
__u32 csum;
__u32 csum32;

if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
return;

sequence = cpu_to_be32(sequence);
addr = kmap_atomic(page);
csum = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence,
sizeof(sequence));
csum = jbd2_chksum(j, csum, addr + offset_in_page(bh->b_data),
bh->b_size);
csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence,
sizeof(sequence));
csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data),
bh->b_size);
kunmap_atomic(addr);

tag->t_checksum = cpu_to_be32(csum);
/* We only have space to store the lower 16 bits of the crc32c. */
tag->t_checksum = cpu_to_be16(csum32);
}
/*
* jbd2_journal_commit_transaction
Expand Down
11 changes: 5 additions & 6 deletions trunk/fs/jbd2/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,17 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag,
void *buf, __u32 sequence)
{
__u32 provided, calculated;
__u32 csum32;

if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
return 1;

sequence = cpu_to_be32(sequence);
calculated = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence,
sizeof(sequence));
calculated = jbd2_chksum(j, calculated, buf, j->j_blocksize);
provided = be32_to_cpu(tag->t_checksum);
csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence,
sizeof(sequence));
csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize);

return provided == cpu_to_be32(calculated);
return tag->t_checksum == cpu_to_be16(csum32);
}

static int do_one_pass(journal_t *journal,
Expand Down

0 comments on commit 93e9800

Please sign in to comment.