linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
       [not found] <20230802162840.331385-1-wangjianjian0@foxmail.com>
@ 2023-08-02 16:28 ` Wang Jianjian
  2023-08-16 15:27   ` Wang Jianjian
  2023-08-17 17:05   ` Theodore Ts'o
  0 siblings, 2 replies; 6+ messages in thread
From: Wang Jianjian @ 2023-08-02 16:28 UTC (permalink / raw)
  To: linux-ext4; +Cc: Wang Jianjian

When setup_system_zone, flex_bg is not initialzied so it is always 1.
ext4_num_base_meta_blocks() returns the meta blocks in this group
including reserved GDT blocks, so let's use this helper.

Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
---
 fs/ext4/block_validity.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 5504f72bbbbe..558e487a0b53 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -215,7 +215,6 @@ int ext4_setup_system_zone(struct super_block *sb)
 	struct ext4_system_blocks *system_blks;
 	struct ext4_group_desc *gdp;
 	ext4_group_t i;
-	int flex_size = ext4_flex_bg_size(sbi);
 	int ret;
 
 	system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL);
@@ -224,11 +223,11 @@ int ext4_setup_system_zone(struct super_block *sb)
 
 	for (i=0; i < ngroups; i++) {
 		cond_resched();
-		if (ext4_bg_has_super(sb, i) &&
-		    ((i < 5) || ((i % flex_size) == 0))) {
+		unsigned int meta_blks = ext4_num_base_meta_blocks(sb, i);
+		if (meta_blks != 0) {
 			ret = add_system_zone(system_blks,
 					ext4_group_first_block_no(sb, i),
-					ext4_bg_num_gdb(sb, i) + 1, 0);
+					meta_blks, 0);
 			if (ret)
 				goto err;
 		}
-- 
2.34.3


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

* Re: [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
  2023-08-02 16:28 ` [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone Wang Jianjian
@ 2023-08-16 15:27   ` Wang Jianjian
  2023-08-17 17:05   ` Theodore Ts'o
  1 sibling, 0 replies; 6+ messages in thread
From: Wang Jianjian @ 2023-08-16 15:27 UTC (permalink / raw)
  To: linux-ext4

Hi all,
Any comments?

On 8/3/23 00:28, Wang Jianjian wrote:
> When setup_system_zone, flex_bg is not initialzied so it is always 1.
> ext4_num_base_meta_blocks() returns the meta blocks in this group
> including reserved GDT blocks, so let's use this helper.
> 
> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
> ---
>   fs/ext4/block_validity.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
> index 5504f72bbbbe..558e487a0b53 100644
> --- a/fs/ext4/block_validity.c
> +++ b/fs/ext4/block_validity.c
> @@ -215,7 +215,6 @@ int ext4_setup_system_zone(struct super_block *sb)
>   	struct ext4_system_blocks *system_blks;
>   	struct ext4_group_desc *gdp;
>   	ext4_group_t i;
> -	int flex_size = ext4_flex_bg_size(sbi);
>   	int ret;
>   
>   	system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL);
> @@ -224,11 +223,11 @@ int ext4_setup_system_zone(struct super_block *sb)
>   
>   	for (i=0; i < ngroups; i++) {
>   		cond_resched();
> -		if (ext4_bg_has_super(sb, i) &&
> -		    ((i < 5) || ((i % flex_size) == 0))) {
> +		unsigned int meta_blks = ext4_num_base_meta_blocks(sb, i);
> +		if (meta_blks != 0) {
>   			ret = add_system_zone(system_blks,
>   					ext4_group_first_block_no(sb, i),
> -					ext4_bg_num_gdb(sb, i) + 1, 0);
> +					meta_blks, 0);
>   			if (ret)
>   				goto err;
>   		}
> 


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

* Re: [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
  2023-08-02 16:28 ` [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone Wang Jianjian
  2023-08-16 15:27   ` Wang Jianjian
@ 2023-08-17 17:05   ` Theodore Ts'o
  2024-04-01 14:23     ` Luis Henriques
  1 sibling, 1 reply; 6+ messages in thread
From: Theodore Ts'o @ 2023-08-17 17:05 UTC (permalink / raw)
  To: Wang Jianjian; +Cc: Ext4 Developers List

On Thu, Aug 03, 2023 at 12:28:40AM +0800, Wang Jianjian wrote:
> When setup_system_zone, flex_bg is not initialzied so it is always 1.
> ext4_num_base_meta_blocks() returns the meta blocks in this group
> including reserved GDT blocks, so let's use this helper.
> 
> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>

Thanks for the patch.  I ended up collapsing the two patches into a
single one, and then fixed up some checkpatch errors.

       	    	     	      	   - Ted

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

* Re: [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
  2023-08-17 17:05   ` Theodore Ts'o
@ 2024-04-01 14:23     ` Luis Henriques
  2024-04-07 10:13       ` wangjianjian (C)
  0 siblings, 1 reply; 6+ messages in thread
From: Luis Henriques @ 2024-04-01 14:23 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Wang Jianjian, Ext4 Developers List

"Theodore Ts'o" <tytso@mit.edu> writes:

> On Thu, Aug 03, 2023 at 12:28:40AM +0800, Wang Jianjian wrote:
>> When setup_system_zone, flex_bg is not initialzied so it is always 1.
>> ext4_num_base_meta_blocks() returns the meta blocks in this group
>> including reserved GDT blocks, so let's use this helper.
>> 
>> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
>
> Thanks for the patch.  I ended up collapsing the two patches into a
> single one, and then fixed up some checkpatch errors.

Sorry for revisiting this old thread, but it looks like these patches
(commit 68228da51c9a "ext4: add correct group descriptors and reserved GDT
blocks to system zone") broke fstest ext4/059.

A (very!) quick look seems to show that it's related with the very fact
that sbi->s_es->s_reserved_gdt_blocks are now taken into account to
compute the number of blocks (which is the point of the patch, of course).
Maybe the test needs to be fixed, as it messes up with the GDT reserved
blocks...?

Cheers,
-- 
Luis

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

* Re: [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
  2024-04-01 14:23     ` Luis Henriques
@ 2024-04-07 10:13       ` wangjianjian (C)
  2024-04-10  8:36         ` Luis Henriques
  0 siblings, 1 reply; 6+ messages in thread
From: wangjianjian (C) @ 2024-04-07 10:13 UTC (permalink / raw)
  To: Luis Henriques, Theodore Ts'o; +Cc: Wang Jianjian, Ext4 Developers List

Hi,
Let me test it and fix it if it fails.

Regards,

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

* Re: [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone
  2024-04-07 10:13       ` wangjianjian (C)
@ 2024-04-10  8:36         ` Luis Henriques
  0 siblings, 0 replies; 6+ messages in thread
From: Luis Henriques @ 2024-04-10  8:36 UTC (permalink / raw)
  To: wangjianjian (C); +Cc: Theodore Ts'o, Wang Jianjian, Ext4 Developers List

On Sun 07 Apr 2024 06:13:20 PM +08, wangjianjian (C) wrote;

> Hi,
> Let me test it and fix it if it fails.

Thank you for looking into this.  I'll also see if I can find out more
details on this.

Cheers,
-- 
Luis

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

end of thread, other threads:[~2024-04-10  8:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230802162840.331385-1-wangjianjian0@foxmail.com>
2023-08-02 16:28 ` [PATCH 2/2] ext4: Add correct group descriptors and reserved GDT blocks to system zone Wang Jianjian
2023-08-16 15:27   ` Wang Jianjian
2023-08-17 17:05   ` Theodore Ts'o
2024-04-01 14:23     ` Luis Henriques
2024-04-07 10:13       ` wangjianjian (C)
2024-04-10  8:36         ` Luis Henriques

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