* [PATCH] libext2fs: don't swap extent-based journal backup on read
@ 2009-11-10 20:45 Eric Sandeen
2009-11-10 23:14 ` Andreas Dilger
2009-11-13 3:45 ` Theodore Tso
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2009-11-10 20:45 UTC (permalink / raw)
To: ext4 development
The f_illitable_flexbg test was failing on ppc, because
e2fsck_move_ext3_journal is doing a direct memcmp of i_block with
s_jnl_blocks, and failing.
This is because we don't swap extent data on read from disk; rather
we do it when we access the extents. However, ext2fs_swap_super
was swapping s_jnl_blocks unconditionally, so these didn't match.
Looks like we need to treat s_jnl_blocks the same as i_block, and
swap it on access, not on read. Except for the last i_size bit...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 42bc01e..38f5f9b 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -73,9 +73,19 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written);
for (i=0; i < 4; i++)
sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
+
+ /* if journal backup is for a valid extent-based journal... */
+ if (!ext2fs_extent_header_verify(sb->s_jnl_blocks,
+ sizeof(sb->s_jnl_blocks))) {
+ /* ... swap only the journal i_size */
+ sb->s_jnl_blocks[16] = ext2fs_swab32(sb->s_jnl_blocks[16]);
+ /* and the extent data is not swapped on read */
+ return;
+ }
+
+ /* direct/indirect journal: swap it all */
for (i=0; i < 17; i++)
sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libext2fs: don't swap extent-based journal backup on read
2009-11-10 20:45 [PATCH] libext2fs: don't swap extent-based journal backup on read Eric Sandeen
@ 2009-11-10 23:14 ` Andreas Dilger
2009-11-13 3:45 ` Theodore Tso
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2009-11-10 23:14 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development
On 2009-11-10, at 13:45, Eric Sandeen wrote:
> The f_illitable_flexbg test was failing on ppc, because
> e2fsck_move_ext3_journal is doing a direct memcmp of i_block with
> s_jnl_blocks, and failing.
>
> This is because we don't swap extent data on read from disk; rather
> we do it when we access the extents. However, ext2fs_swap_super
> was swapping s_jnl_blocks unconditionally, so these didn't match.
>
> Looks like we need to treat s_jnl_blocks the same as i_block, and
> swap it on access, not on read. Except for the last i_size bit...
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Makes sense:
Reviewed-by: Andreas Dilger <adilger@sun.com>
> ---
>
> diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
> index 42bc01e..38f5f9b 100644
> --- a/lib/ext2fs/swapfs.c
> +++ b/lib/ext2fs/swapfs.c
> @@ -73,9 +73,19 @@ void ext2fs_swap_super(struct ext2_super_block *
> sb)
> sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written);
> for (i=0; i < 4; i++)
> sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
> +
> + /* if journal backup is for a valid extent-based journal... */
> + if (!ext2fs_extent_header_verify(sb->s_jnl_blocks,
> + sizeof(sb->s_jnl_blocks))) {
> + /* ... swap only the journal i_size */
> + sb->s_jnl_blocks[16] = ext2fs_swab32(sb->s_jnl_blocks[16]);
> + /* and the extent data is not swapped on read */
> + return;
> + }
> +
> + /* direct/indirect journal: swap it all */
> for (i=0; i < 17; i++)
> sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]);
I wouldn't object to fixing the formatting above to "for (i = 0; ...)"
> }
>
> void ext2fs_swap_group_desc(struct ext2_group_desc *gdp)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libext2fs: don't swap extent-based journal backup on read
2009-11-10 20:45 [PATCH] libext2fs: don't swap extent-based journal backup on read Eric Sandeen
2009-11-10 23:14 ` Andreas Dilger
@ 2009-11-13 3:45 ` Theodore Tso
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Tso @ 2009-11-13 3:45 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development
On Tue, Nov 10, 2009 at 02:45:44PM -0600, Eric Sandeen wrote:
> The f_illitable_flexbg test was failing on ppc, because
> e2fsck_move_ext3_journal is doing a direct memcmp of i_block with
> s_jnl_blocks, and failing.
>
> This is because we don't swap extent data on read from disk; rather
> we do it when we access the extents. However, ext2fs_swap_super
> was swapping s_jnl_blocks unconditionally, so these didn't match.
>
> Looks like we need to treat s_jnl_blocks the same as i_block, and
> swap it on access, not on read. Except for the last i_size bit...
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Applied to the maint branch, thanks.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-13 3:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 20:45 [PATCH] libext2fs: don't swap extent-based journal backup on read Eric Sandeen
2009-11-10 23:14 ` Andreas Dilger
2009-11-13 3:45 ` Theodore Tso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).