linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ext4: Enable meta_bg only when new desc blocks are needed
@ 2024-03-06  7:39 Srivathsa Dara
  2024-03-07  9:23 ` Ritesh Harjani
  0 siblings, 1 reply; 2+ messages in thread
From: Srivathsa Dara @ 2024-03-06  7:39 UTC (permalink / raw)
  To: linux-ext4
  Cc: tytso, adilger.kernel, rajesh.sivaramasubramaniom, junxiao.bi,
	ritesh.list

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 928700d57eb6..b46a1c492c3f 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1996,7 +1996,8 @@ 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] 2+ messages in thread

* Re: [PATCH v2] ext4: Enable meta_bg only when new desc blocks are needed
  2024-03-06  7:39 [PATCH v2] ext4: Enable meta_bg only when new desc blocks are needed Srivathsa Dara
@ 2024-03-07  9:23 ` Ritesh Harjani
  0 siblings, 0 replies; 2+ messages in thread
From: Ritesh Harjani @ 2024-03-07  9:23 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
> 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.
>

Makes sense to me. Please feel free to add - 

Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

> Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
> ---
>  fs/ext4/resize.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index 928700d57eb6..b46a1c492c3f 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -1996,7 +1996,8 @@ 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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-07  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-06  7:39 [PATCH v2] ext4: Enable meta_bg only when new desc blocks are needed Srivathsa Dara
2024-03-07  9:23 ` Ritesh Harjani

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