aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-04 20:19:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-04 20:19:27 -0400
commitae67d9a888a000a9df43de10eb9950075e93508c (patch)
tree4251a8b5fb19fb294b917bd36b4d0b92d2e5c51b /fs/jbd2
parent71c7356f864dc41e4bd6b884596a422f8954afe0 (diff)
parentad4eec613536dc7e5ea0c6e59849e6edca634d8b (diff)
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 updates from Ted Ts'o: "New features for 3.12: - Added aggressive extent caching using the extent status tree. This can actually decrease memory usage in read-mostly workloads since the information is much more compactly stored in the extent status tree than if we had to keep the extent tree metadata blocks in the buffer cache. This also improves Asynchronous I/O since it is it makes much less likely that we need to do metadata I/O to lookup the extent tree information. - Improve the recovery after corrupted allocation bitmaps are found when running in errors=ignore mode. Also fixed some writeback vs truncate races when using a blocksize less than the page size" * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (25 commits) ext4: allow specifying external journal by pathname mount option ext4: mark group corrupt on group descriptor checksum ext4: mark block group as corrupt on inode bitmap error ext4: mark block group as corrupt on block bitmap error ext4: fix type declaration of ext4_validate_block_bitmap ext4: error out if verifying the block bitmap fails jbd2: Fix endian mixing problems in the checksumming code ext4: isolate ext4_extents.h file ext4: Fix misspellings using 'codespell' tool ext4: convert write_begin methods to stable_page_writes semantics ext4: fix use of potentially uninitialized variables in debugging code ext4: fix lost truncate due to race with writeback ext4: simplify truncation code in ext4_setattr() ext4: fix ext4_writepages() in presence of truncate ext4: move test whether extent to map can be extended to one place ext4: fix warning in ext4_da_update_reserve_space() quota: provide interface for readding allocated space into reserved space ext4: avoid reusing recently deleted inodes in no journal mode ext4: allocate delayed allocation blocks before rename ext4: start handle at least possible moment when renaming files ...
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/commit.c6
-rw-r--r--fs/jbd2/journal.c5
-rw-r--r--fs/jbd2/recovery.c24
3 files changed, 18 insertions, 17 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 559bec1a37b4..cf2fc0594063 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -343,14 +343,14 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
343 struct page *page = bh->b_page; 343 struct page *page = bh->b_page;
344 __u8 *addr; 344 __u8 *addr;
345 __u32 csum32; 345 __u32 csum32;
346 __be32 seq;
346 347
347 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 348 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
348 return; 349 return;
349 350
350 sequence = cpu_to_be32(sequence); 351 seq = cpu_to_be32(sequence);
351 addr = kmap_atomic(page); 352 addr = kmap_atomic(page);
352 csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence, 353 csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
353 sizeof(sequence));
354 csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data), 354 csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data),
355 bh->b_size); 355 bh->b_size);
356 kunmap_atomic(addr); 356 kunmap_atomic(addr);
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 02c7ad9d7a41..52032647dd4a 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -130,9 +130,10 @@ int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb)
130 return sb->s_checksum_type == JBD2_CRC32C_CHKSUM; 130 return sb->s_checksum_type == JBD2_CRC32C_CHKSUM;
131} 131}
132 132
133static __u32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb) 133static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb)
134{ 134{
135 __u32 csum, old_csum; 135 __u32 csum;
136 __be32 old_csum;
136 137
137 old_csum = sb->s_checksum; 138 old_csum = sb->s_checksum;
138 sb->s_checksum = 0; 139 sb->s_checksum = 0;
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index d4851464b57e..3929c50428b1 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -178,7 +178,8 @@ static int jbd2_descr_block_csum_verify(journal_t *j,
178 void *buf) 178 void *buf)
179{ 179{
180 struct jbd2_journal_block_tail *tail; 180 struct jbd2_journal_block_tail *tail;
181 __u32 provided, calculated; 181 __be32 provided;
182 __u32 calculated;
182 183
183 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 184 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
184 return 1; 185 return 1;
@@ -190,8 +191,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j,
190 calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize); 191 calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
191 tail->t_checksum = provided; 192 tail->t_checksum = provided;
192 193
193 provided = be32_to_cpu(provided); 194 return provided == cpu_to_be32(calculated);
194 return provided == calculated;
195} 195}
196 196
197/* 197/*
@@ -381,7 +381,8 @@ static int calc_chksums(journal_t *journal, struct buffer_head *bh,
381static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) 381static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
382{ 382{
383 struct commit_header *h; 383 struct commit_header *h;
384 __u32 provided, calculated; 384 __be32 provided;
385 __u32 calculated;
385 386
386 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 387 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
387 return 1; 388 return 1;
@@ -392,21 +393,20 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
392 calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize); 393 calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
393 h->h_chksum[0] = provided; 394 h->h_chksum[0] = provided;
394 395
395 provided = be32_to_cpu(provided); 396 return provided == cpu_to_be32(calculated);
396 return provided == calculated;
397} 397}
398 398
399static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag, 399static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag,
400 void *buf, __u32 sequence) 400 void *buf, __u32 sequence)
401{ 401{
402 __u32 csum32; 402 __u32 csum32;
403 __be32 seq;
403 404
404 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 405 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
405 return 1; 406 return 1;
406 407
407 sequence = cpu_to_be32(sequence); 408 seq = cpu_to_be32(sequence);
408 csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence, 409 csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
409 sizeof(sequence));
410 csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize); 410 csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize);
411 411
412 return tag->t_checksum == cpu_to_be16(csum32); 412 return tag->t_checksum == cpu_to_be16(csum32);
@@ -808,7 +808,8 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
808 void *buf) 808 void *buf)
809{ 809{
810 struct jbd2_journal_revoke_tail *tail; 810 struct jbd2_journal_revoke_tail *tail;
811 __u32 provided, calculated; 811 __be32 provided;
812 __u32 calculated;
812 813
813 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) 814 if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
814 return 1; 815 return 1;
@@ -820,8 +821,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
820 calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize); 821 calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
821 tail->r_checksum = provided; 822 tail->r_checksum = provided;
822 823
823 provided = be32_to_cpu(provided); 824 return provided == cpu_to_be32(calculated);
824 return provided == calculated;
825} 825}
826 826
827/* Scan a revoke record, marking all blocks mentioned as revoked. */ 827/* Scan a revoke record, marking all blocks mentioned as revoked. */