Thread (6 messages) 6 messages, 3 authors, 2008-01-28

Re: [PATCH] Fix commit block write in JBD

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2008-01-27 06:02:45

On Wed, 23 Jan 2008 20:09:43 +0100 Jan Kara [off-list ref] wrote:

Commit block is expected to have several copies of the header. Fix the
bug Andrew has spotted ages ago.
"ages" indeed.
quoted hunk ↗ jump to hunk
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index 610264b..a69b240 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -116,9 +116,8 @@ static int journal_write_commit_record(journal_t *journal,
 
 	bh = jh2bh(descriptor);
 
-	/* AKPM: buglet - add `i' to tmp! */
 	for (i = 0; i < bh->b_size; i += 512) {
-		journal_header_t *tmp = (journal_header_t*)bh->b_data;
+		journal_header_t *tmp = (journal_header_t*)(bh->b_data+i);
 		tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
 		tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
 		tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
But I don't think we can _use_ this feature now.  Because there are
100000000000 disks out there which didn't implement it.

So why not just remove the loop and do a single write?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help