public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix commit block write in JBD
@ 2008-01-23 19:09 Jan Kara
  2008-01-23 19:10 ` [PATCH] Fix commit block write in JBD2 Jan Kara
  2008-01-27  6:02 ` [PATCH] Fix commit block write in JBD Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Kara @ 2008-01-23 19:09 UTC (permalink / raw)
  To: linux-ext4; +Cc: Andrew Morton

  Hi,

  the patch below fixes preparation of commit block in
journal_write_commit_record(). Obviously the bug doesn't really matter
since nobody reported it so far but let's cleanup the code... Andrew, could
you please queue it up? Thanks.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---

Commit block is expected to have several copies of the header. Fix the
bug Andrew has spotted ages ago.

Signed-off-by: Jan Kara <jack@suse.cz>

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);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] Fix commit block write in JBD2
  2008-01-23 19:09 [PATCH] Fix commit block write in JBD Jan Kara
@ 2008-01-23 19:10 ` Jan Kara
  2008-01-23 21:18   ` Girish Shilamkar
  2008-01-27  6:02 ` [PATCH] Fix commit block write in JBD Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Kara @ 2008-01-23 19:10 UTC (permalink / raw)
  To: linux-ext4; +Cc: Andrew Morton

On Wed 23-01-08 20:09:43, Jan Kara wrote:
>   Hi,
> 
>   the patch below fixes preparation of commit block in
> journal_write_commit_record(). Obviously the bug doesn't really matter
> since nobody reported it so far but let's cleanup the code... Andrew, could
> you please queue it up? Thanks.
  And the same fix for JBD2.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---

Commit block is expected to have several copies of the header. Fix the
bug Andrew has spotted ages ago.

Signed-off-by: Jan Kara <jack@suse.cz>

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 6986f33..ed61283 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/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(JBD2_MAGIC_NUMBER);
 		tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK);
 		tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix commit block write in JBD2
  2008-01-23 19:10 ` [PATCH] Fix commit block write in JBD2 Jan Kara
@ 2008-01-23 21:18   ` Girish Shilamkar
  2008-01-23 22:01     ` Jan Kara
  0 siblings, 1 reply; 6+ messages in thread
From: Girish Shilamkar @ 2008-01-23 21:18 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4, Andrew Morton

Hi,
	The loop was removed in journal checksum patch. There had been a
discussion (11 Jul 2007: [EXT4 set 8][PATCH 1/1]Add journal checksums)
about this part of code as checksum info was added to commit block. 

Regards,
Girish
On Wed, 2008-01-23 at 20:10 +0100, Jan Kara wrote:
> On Wed 23-01-08 20:09:43, Jan Kara wrote:
> >   Hi,
> > 
> >   the patch below fixes preparation of commit block in
> > journal_write_commit_record(). Obviously the bug doesn't really matter
> > since nobody reported it so far but let's cleanup the code... Andrew, could
> > you please queue it up? Thanks.
>   And the same fix for JBD2.
> 
> 									Honza

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix commit block write in JBD2
  2008-01-23 21:18   ` Girish Shilamkar
@ 2008-01-23 22:01     ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2008-01-23 22:01 UTC (permalink / raw)
  To: Girish Shilamkar; +Cc: linux-ext4, Andrew Morton

  Hi,

On Thu 24-01-08 02:48:41, Girish Shilamkar wrote:
> 	The loop was removed in journal checksum patch. There had been a
> discussion (11 Jul 2007: [EXT4 set 8][PATCH 1/1]Add journal checksums)
> about this part of code as checksum info was added to commit block. 
  Ah, OK, thanks for explanation. So for JBD2 we don't need the patch
anymore. But for JBD it's still needed.

									Honza

> On Wed, 2008-01-23 at 20:10 +0100, Jan Kara wrote:
> > On Wed 23-01-08 20:09:43, Jan Kara wrote:
> > >   Hi,
> > > 
> > >   the patch below fixes preparation of commit block in
> > > journal_write_commit_record(). Obviously the bug doesn't really matter
> > > since nobody reported it so far but let's cleanup the code... Andrew, could
> > > you please queue it up? Thanks.
> >   And the same fix for JBD2.
> > 
> > 									Honza
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix commit block write in JBD
  2008-01-23 19:09 [PATCH] Fix commit block write in JBD Jan Kara
  2008-01-23 19:10 ` [PATCH] Fix commit block write in JBD2 Jan Kara
@ 2008-01-27  6:02 ` Andrew Morton
  2008-01-28 13:18   ` Jan Kara
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2008-01-27  6:02 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4

> On Wed, 23 Jan 2008 20:09:43 +0100 Jan Kara <jack@suse.cz> wrote:
> 
> Commit block is expected to have several copies of the header. Fix the
> bug Andrew has spotted ages ago.
> 

"ages" indeed.

> 
> 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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix commit block write in JBD
  2008-01-27  6:02 ` [PATCH] Fix commit block write in JBD Andrew Morton
@ 2008-01-28 13:18   ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2008-01-28 13:18 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-ext4

On Sat 26-01-08 22:02:07, Andrew Morton wrote:
> > On Wed, 23 Jan 2008 20:09:43 +0100 Jan Kara <jack@suse.cz> wrote:
> > 
> > Commit block is expected to have several copies of the header. Fix the
> > bug Andrew has spotted ages ago.
> > 
> 
> "ages" indeed.
> 
> > 
> > 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?
  Yes, but OTOH once the filesystem gets mounted with a new kernel, the
journal gets quickly rewritten and we'll have correct commit blocks there.
But since neither kernel nor e2fsprogs actually check for further sectors
(they check for the header just in the beginning of a block), I agree that
removing the loop completely is probably the best option. Nobody cared so
far so I guess they won't care in future as well. I'll send you a
replacement patch.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-01-28 13:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-23 19:09 [PATCH] Fix commit block write in JBD Jan Kara
2008-01-23 19:10 ` [PATCH] Fix commit block write in JBD2 Jan Kara
2008-01-23 21:18   ` Girish Shilamkar
2008-01-23 22:01     ` Jan Kara
2008-01-27  6:02 ` [PATCH] Fix commit block write in JBD Andrew Morton
2008-01-28 13:18   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox