Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH] ext4: Enable meta_bg only when new desc blocks are needed
@ 2024-02-27 13:13 Srivathsa Dara
  2024-03-06  4:02 ` Ritesh Harjani
  2024-03-14  3:54 ` Theodore Ts'o
  0 siblings, 2 replies; 4+ messages in thread
From: Srivathsa Dara @ 2024-02-27 13:13 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, adilger.kernel, rajesh.sivaramasubramaniom, junxiao.bi

This patch addresses an issue observed when resize_inode is disabled
and an online extension of a filesysyem is performed. When a filesystem
is expanded to a size that does not require a addition of a new
descriptor block, the meta_bg feature is being enabled even though no
part of the filesystem uses this layout.

This patch ensures that the meta_bg feature is only enabled if
any of the added block groups utilize meta_bg layout.

Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
---
 fs/ext4/resize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 928700d57eb6..99b52f26e818 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1996,7 +1996,7 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
 		}
 	}
 
-	if ((!resize_inode && !meta_bg) || n_blocks_count == o_blocks_count) {
+	if ((!resize_inode && !meta_bg && n_desc_blocks > o_desc_blocks) || n_blocks_count == o_blocks_count) {
 		err = ext4_convert_meta_bg(sb, resize_inode);
 		if (err)
 			goto out;
-- 
2.39.3


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

* Re: [PATCH] ext4: Enable meta_bg only when new desc blocks are needed
  2024-02-27 13:13 [PATCH] ext4: Enable meta_bg only when new desc blocks are needed Srivathsa Dara
@ 2024-03-06  4:02 ` Ritesh Harjani
  2024-03-06  6:55   ` Srivathsa Dara
  2024-03-14  3:54 ` Theodore Ts'o
  1 sibling, 1 reply; 4+ messages in thread
From: Ritesh Harjani @ 2024-03-06  4:02 UTC (permalink / raw)
  To: Srivathsa Dara, linux-ext4
  Cc: tytso, adilger.kernel, rajesh.sivaramasubramaniom, junxiao.bi

Srivathsa Dara <srivathsa.d.dara@oracle.com> writes:

> This patch addresses an issue observed when resize_inode is disabled

Other than "meta_bg unwatedly getting enabled when not required", is
there any other issue you observed?

> and an online extension of a filesysyem is performed. When a filesystem
> is expanded to a size that does not require a addition of a new
> descriptor block, the meta_bg feature is being enabled even though no
> part of the filesystem uses this layout.
>
> This patch ensures that the meta_bg feature is only enabled if
> any of the added block groups utilize meta_bg layout.

Make sense to me. 

>
> Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
> ---
>  fs/ext4/resize.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index 928700d57eb6..99b52f26e818 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -1996,7 +1996,7 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
>  		}
>  	}
>  
> -	if ((!resize_inode && !meta_bg) || n_blocks_count == o_blocks_count) {
> +	if ((!resize_inode && !meta_bg && n_desc_blocks > o_desc_blocks) || n_blocks_count == o_blocks_count) {

Beyond 80 chars line. You might want to fix that.

-ritesh

>  		err = ext4_convert_meta_bg(sb, resize_inode);
>  		if (err)
>  			goto out;
> -- 
> 2.39.3

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

* RE: [PATCH] ext4: Enable meta_bg only when new desc blocks are needed
  2024-03-06  4:02 ` Ritesh Harjani
@ 2024-03-06  6:55   ` Srivathsa Dara
  0 siblings, 0 replies; 4+ messages in thread
From: Srivathsa Dara @ 2024-03-06  6:55 UTC (permalink / raw)
  To: Ritesh Harjani, linux-ext4@vger.kernel.org
  Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	Rajesh Sivaramasubramaniom, Junxiao Bi

Hi Ritesh,

> -----Original Message-----
> From: Ritesh Harjani <ritesh.list@gmail.com> 
> Sent: Wednesday, March 6, 2024 9:32 AM
> To: Srivathsa Dara <srivathsa.d.dara@oracle.com>; linux-ext4@vger.kernel.org
> Cc: tytso@mit.edu; adilger.kernel@dilger.ca; Rajesh Sivaramasubramaniom <rajesh.sivaramasubramaniom@oracle.com>; Junxiao Bi <junxiao.bi@oracle.com>
> Subject: Re: [PATCH] ext4: Enable meta_bg only when new desc blocks are needed
> 
> Srivathsa Dara <srivathsa.d.dara@oracle.com> writes:
> 
> > This patch addresses an issue observed when resize_inode is disabled
> 
> Other than "meta_bg unwatedly getting enabled when not required", is there any other issue you observed?

Yes, we have seen an issue where a data block is being corrupted by group 
descriptor block because of this. The following patch fixes that issue.

	ext4: fix corruption during on-line resize
	commit: 3a944549dd26ccaf1f898a4be952e75a42bf37dd
	
> 
> > and an online extension of a filesysyem is performed. When a 
> > filesystem is expanded to a size that does not require a addition of a 
> > new descriptor block, the meta_bg feature is being enabled even though 
> > no part of the filesystem uses this layout.
> >
> > This patch ensures that the meta_bg feature is only enabled if any of 
> > the added block groups utilize meta_bg layout.
> 
> Make sense to me. 
> 
> >
> > Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
> > ---
> >  fs/ext4/resize.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 
> > 928700d57eb6..99b52f26e818 100644
> > --- a/fs/ext4/resize.c
> > +++ b/fs/ext4/resize.c
> > @@ -1996,7 +1996,7 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
> >  		}
> >  	}
> >  
> > -	if ((!resize_inode && !meta_bg) || n_blocks_count == o_blocks_count) {
> > +	if ((!resize_inode && !meta_bg && n_desc_blocks > o_desc_blocks) || 
> > +n_blocks_count == o_blocks_count) {
> 
> Beyond 80 chars line. You might want to fix that.

Sorry, I missed that, will send a V2.

> 
> -ritesh
> 
> >  		err = ext4_convert_meta_bg(sb, resize_inode);
> >  		if (err)
> >  			goto out;
> > --
> > 2.39.3

Thanks,
Srivathsa Dara

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

* Re: [PATCH] ext4: Enable meta_bg only when new desc blocks are needed
  2024-02-27 13:13 [PATCH] ext4: Enable meta_bg only when new desc blocks are needed Srivathsa Dara
  2024-03-06  4:02 ` Ritesh Harjani
@ 2024-03-14  3:54 ` Theodore Ts'o
  1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2024-03-14  3:54 UTC (permalink / raw)
  To: linux-ext4, Srivathsa Dara
  Cc: Theodore Ts'o, adilger.kernel, rajesh.sivaramasubramaniom,
	junxiao.bi


On Tue, 27 Feb 2024 13:13:29 +0000, Srivathsa Dara wrote:
> This patch addresses an issue observed when resize_inode is disabled
> and an online extension of a filesysyem is performed. When a filesystem
> is expanded to a size that does not require a addition of a new
> descriptor block, the meta_bg feature is being enabled even though no
> part of the filesystem uses this layout.
> 
> This patch ensures that the meta_bg feature is only enabled if
> any of the added block groups utilize meta_bg layout.
> 
> [...]

Applied, thanks!

[1/1] ext4: Enable meta_bg only when new desc blocks are needed
      commit: 07be778c70149321f785611a9c50125b904b0508

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

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

end of thread, other threads:[~2024-03-14  3:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 13:13 [PATCH] ext4: Enable meta_bg only when new desc blocks are needed Srivathsa Dara
2024-03-06  4:02 ` Ritesh Harjani
2024-03-06  6:55   ` Srivathsa Dara
2024-03-14  3:54 ` Theodore Ts'o

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