linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] debugfs: fix printing for sequence in descriptor/revoke block
@ 2025-06-27 21:23 zhangjian
  0 siblings, 0 replies; 5+ messages in thread
From: zhangjian @ 2025-06-27 21:23 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

When cursor cross the last journal block and will dump old journal blocks
sequence number will be lower than transaction number. Sequence number
should be read from descriptor block rather than accelerating transaction.

For example:
A snippet from "logdump -aO"
===============================================================
Found expected sequence 6, type 1 (descriptor block) at block 13
Dumping descriptor block, sequence 13, at block 13:
  FS block 276 logged at journal block 14 (flags 0x0)
  FS block 2 logged at journal block 15 (flags 0x2)
  FS block 295 logged at journal block 16 (flags 0x2)
  FS block 292 logged at journal block 17 (flags 0x2)
  FS block 7972 logged at journal block 18 (flags 0x2)
  FS block 1 logged at journal block 19 (flags 0x2)
  FS block 263 logged at journal block 20 (flags 0xa)
Found sequence 6 (not 13) at block 21: end of journal.
===============================================================

sequence number should be 6 from header->h_sequence, rather than 13 from
transaction accelerating from jsb->s_sequence

Signed-off-by: zhangjian <zhangjian496@huawei.com>
---
 debugfs/logdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 324ed425..56f36291 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -532,7 +532,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
 		case JBD2_DESCRIPTOR_BLOCK:
 			dump_descriptor_block(out_file, source, buf, jsb,
 					      &blocknr, blocksize, maxlen,
-					      transaction);
+					      sequence);
 			continue;
 
 		case JBD2_COMMIT_BLOCK:
@@ -545,7 +545,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
 		case JBD2_REVOKE_BLOCK:
 			dump_revoke_block(out_file, buf, jsb,
 					  blocknr, blocksize,
-					  transaction);
+					  seqeunce);
 			blocknr++;
 			WRAP(jsb, blocknr, maxlen);
 			continue;
-- 
2.33.0


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

* [PATCH] debugfs: fix printing for sequence in descriptor/revoke block
@ 2025-06-27 21:24 zhangjian
  2025-06-30 15:17 ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: zhangjian @ 2025-06-27 21:24 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

When cursor cross the last journal block and will dump old journal blocks
sequence number will be lower than transaction number. Sequence number
should be read from descriptor block rather than accelerating transaction.

For example:
A snippet from "logdump -aO"
===============================================================
Found expected sequence 6, type 1 (descriptor block) at block 13
Dumping descriptor block, sequence 13, at block 13:
  FS block 276 logged at journal block 14 (flags 0x0)
  FS block 2 logged at journal block 15 (flags 0x2)
  FS block 295 logged at journal block 16 (flags 0x2)
  FS block 292 logged at journal block 17 (flags 0x2)
  FS block 7972 logged at journal block 18 (flags 0x2)
  FS block 1 logged at journal block 19 (flags 0x2)
  FS block 263 logged at journal block 20 (flags 0xa)
Found sequence 6 (not 13) at block 21: end of journal.
===============================================================

sequence number should be 6 from header->h_sequence, rather than 13 from
transaction accelerating from jsb->s_sequence

Signed-off-by: zhangjian <zhangjian496@huawei.com>
Signed-off-by: zhanchengbin <zhanchengbin1@h-partners.com>
---
 debugfs/logdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 324ed425..56f36291 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -532,7 +532,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
 		case JBD2_DESCRIPTOR_BLOCK:
 			dump_descriptor_block(out_file, source, buf, jsb,
 					      &blocknr, blocksize, maxlen,
-					      transaction);
+					      sequence);
 			continue;
 
 		case JBD2_COMMIT_BLOCK:
@@ -545,7 +545,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
 		case JBD2_REVOKE_BLOCK:
 			dump_revoke_block(out_file, buf, jsb,
 					  blocknr, blocksize,
-					  transaction);
+					  seqeunce);
 			blocknr++;
 			WRAP(jsb, blocknr, maxlen);
 			continue;
-- 
2.33.0


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

* Re: [PATCH] debugfs: fix printing for sequence in descriptor/revoke block
  2025-06-27 21:24 [PATCH] debugfs: fix printing for sequence in descriptor/revoke block zhangjian
@ 2025-06-30 15:17 ` Darrick J. Wong
  2025-07-01  1:22   ` zhangjian (CG)
  2025-07-01 12:40   ` Theodore Ts'o
  0 siblings, 2 replies; 5+ messages in thread
From: Darrick J. Wong @ 2025-06-30 15:17 UTC (permalink / raw)
  To: zhangjian; +Cc: tytso, linux-ext4

On Sat, Jun 28, 2025 at 05:24:51AM +0800, zhangjian wrote:
> When cursor cross the last journal block and will dump old journal blocks
> sequence number will be lower than transaction number. Sequence number
> should be read from descriptor block rather than accelerating transaction.
> 
> For example:
> A snippet from "logdump -aO"
> ===============================================================
> Found expected sequence 6, type 1 (descriptor block) at block 13
> Dumping descriptor block, sequence 13, at block 13:
>   FS block 276 logged at journal block 14 (flags 0x0)
>   FS block 2 logged at journal block 15 (flags 0x2)
>   FS block 295 logged at journal block 16 (flags 0x2)
>   FS block 292 logged at journal block 17 (flags 0x2)
>   FS block 7972 logged at journal block 18 (flags 0x2)
>   FS block 1 logged at journal block 19 (flags 0x2)
>   FS block 263 logged at journal block 20 (flags 0xa)
> Found sequence 6 (not 13) at block 21: end of journal.
> ===============================================================
> 
> sequence number should be 6 from header->h_sequence, rather than 13 from
> transaction accelerating from jsb->s_sequence
> 
> Signed-off-by: zhangjian <zhangjian496@huawei.com>
> Signed-off-by: zhanchengbin <zhanchengbin1@h-partners.com>
> ---
>  debugfs/logdump.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/debugfs/logdump.c b/debugfs/logdump.c
> index 324ed425..56f36291 100644
> --- a/debugfs/logdump.c
> +++ b/debugfs/logdump.c
> @@ -532,7 +532,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
>  		case JBD2_DESCRIPTOR_BLOCK:
>  			dump_descriptor_block(out_file, source, buf, jsb,
>  					      &blocknr, blocksize, maxlen,
> -					      transaction);
> +					      sequence);
>  			continue;
>  
>  		case JBD2_COMMIT_BLOCK:
> @@ -545,7 +545,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
>  		case JBD2_REVOKE_BLOCK:
>  			dump_revoke_block(out_file, buf, jsb,
>  					  blocknr, blocksize,
> -					  transaction);
> +					  seqeunce);

If you're going to resend the patch in rapid succession, you could at
least fix the typo build errors too...

$ pwd
/home/djwong/e2fsprogs
$ git grep seqeunce
$

--D

>  			blocknr++;
>  			WRAP(jsb, blocknr, maxlen);
>  			continue;
> -- 
> 2.33.0
> 
> 

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

* Re: [PATCH] debugfs: fix printing for sequence in descriptor/revoke block
  2025-06-30 15:17 ` Darrick J. Wong
@ 2025-07-01  1:22   ` zhangjian (CG)
  2025-07-01 12:40   ` Theodore Ts'o
  1 sibling, 0 replies; 5+ messages in thread
From: zhangjian (CG) @ 2025-07-01  1:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: tytso, linux-ext4

yes, it should be sequence, thanks a lot.

On 2025/6/30 23:17, Darrick J. Wong wrote:
> On Sat, Jun 28, 2025 at 05:24:51AM +0800, zhangjian wrote:
>> When cursor cross the last journal block and will dump old journal blocks
>> sequence number will be lower than transaction number. Sequence number
>> should be read from descriptor block rather than accelerating transaction.
>>
>> For example:
>> A snippet from "logdump -aO"
>> ===============================================================
>> Found expected sequence 6, type 1 (descriptor block) at block 13
>> Dumping descriptor block, sequence 13, at block 13:
>>   FS block 276 logged at journal block 14 (flags 0x0)
>>   FS block 2 logged at journal block 15 (flags 0x2)
>>   FS block 295 logged at journal block 16 (flags 0x2)
>>   FS block 292 logged at journal block 17 (flags 0x2)
>>   FS block 7972 logged at journal block 18 (flags 0x2)
>>   FS block 1 logged at journal block 19 (flags 0x2)
>>   FS block 263 logged at journal block 20 (flags 0xa)
>> Found sequence 6 (not 13) at block 21: end of journal.
>> ===============================================================
>>
>> sequence number should be 6 from header->h_sequence, rather than 13 from
>> transaction accelerating from jsb->s_sequence
>>
>> Signed-off-by: zhangjian <zhangjian496@huawei.com>
>> Signed-off-by: zhanchengbin <zhanchengbin1@h-partners.com>
>> ---
>>  debugfs/logdump.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/debugfs/logdump.c b/debugfs/logdump.c
>> index 324ed425..56f36291 100644
>> --- a/debugfs/logdump.c
>> +++ b/debugfs/logdump.c
>> @@ -532,7 +532,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
>>  		case JBD2_DESCRIPTOR_BLOCK:
>>  			dump_descriptor_block(out_file, source, buf, jsb,
>>  					      &blocknr, blocksize, maxlen,
>> -					      transaction);
>> +					      sequence);
>>  			continue;
>>  
>>  		case JBD2_COMMIT_BLOCK:
>> @@ -545,7 +545,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
>>  		case JBD2_REVOKE_BLOCK:
>>  			dump_revoke_block(out_file, buf, jsb,
>>  					  blocknr, blocksize,
>> -					  transaction);
>> +					  seqeunce);
> 
> If you're going to resend the patch in rapid succession, you could at
> least fix the typo build errors too...
> 
> $ pwd
> /home/djwong/e2fsprogs
> $ git grep seqeunce
> $
> 
> --D
> 
>>  			blocknr++;
>>  			WRAP(jsb, blocknr, maxlen);
>>  			continue;
>> -- 
>> 2.33.0
>>
>>
> 


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

* Re: [PATCH] debugfs: fix printing for sequence in descriptor/revoke block
  2025-06-30 15:17 ` Darrick J. Wong
  2025-07-01  1:22   ` zhangjian (CG)
@ 2025-07-01 12:40   ` Theodore Ts'o
  1 sibling, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2025-07-01 12:40 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zhangjian, linux-ext4

Also, to clarify the code, please
also change the parameter names in dump_descriptor_block,
dump_revoke_block, and dump_metadata_block from transaction to
sequence.  That will make it clear that what these functions do with
the parameter is to print the sequence number, and avoid the confusion
steming from:

		fprintf(out_file, "Dumping revoke block, sequence %u, at "
			"block %u:\n", transaction, blocknr);

Thanks,

						- Ted

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

end of thread, other threads:[~2025-07-01 12:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 21:24 [PATCH] debugfs: fix printing for sequence in descriptor/revoke block zhangjian
2025-06-30 15:17 ` Darrick J. Wong
2025-07-01  1:22   ` zhangjian (CG)
2025-07-01 12:40   ` Theodore Ts'o
  -- strict thread matches above, loose matches on Subject: below --
2025-06-27 21:23 zhangjian

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