All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems
@ 2022-08-01  3:24 Josh Triplett
  2022-08-03  7:00 ` Lukas Czerner
  2022-09-27 21:53 ` Theodore Ts'o
  0 siblings, 2 replies; 4+ messages in thread
From: Josh Triplett @ 2022-08-01  3:24 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger; +Cc: linux-ext4, linux-kernel

On a read-only filesystem, we won't invoke the block allocator, so we
don't need to prefetch the block bitmaps.

This avoids starting and running the ext4lazyinit thread at all on a
system with no read-write ext4 filesystems (for instance, a container VM
with read-only filesystems underneath an overlayfs).

Fixes: 21175ca434c5 ("ext4: make prefetch_block_bitmaps default")
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---

Tested in a VM, with a read-only ext4 root filesystem. Confirmed that
ext4lazyinit starts without this patch, and does not start with this
patch.

(For a future merge window, not the current one. Please let me know if I
need to re-send this at a later, more convenient time.)

 fs/ext4/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 845f2f8aee5f..20437acc8865 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3973,9 +3973,9 @@ int ext4_register_li_request(struct super_block *sb,
 		goto out;
 	}
 
-	if (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) &&
-	    (first_not_zeroed == ngroups || sb_rdonly(sb) ||
-	     !test_opt(sb, INIT_INODE_TABLE)))
+	if (sb_rdonly(sb) ||
+	    (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) &&
+	     (first_not_zeroed == ngroups || !test_opt(sb, INIT_INODE_TABLE))))
 		goto out;
 
 	elr = ext4_li_request_new(sb, first_not_zeroed);
-- 
2.36.1


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

* Re: [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems
  2022-08-01  3:24 [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems Josh Triplett
@ 2022-08-03  7:00 ` Lukas Czerner
  2022-08-31 22:09   ` Josh Triplett
  2022-09-27 21:53 ` Theodore Ts'o
  1 sibling, 1 reply; 4+ messages in thread
From: Lukas Czerner @ 2022-08-03  7:00 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Theodore Ts'o, Andreas Dilger, linux-ext4, linux-kernel

On Sun, Jul 31, 2022 at 08:24:53PM -0700, Josh Triplett wrote:
> On a read-only filesystem, we won't invoke the block allocator, so we
> don't need to prefetch the block bitmaps.
> 
> This avoids starting and running the ext4lazyinit thread at all on a
> system with no read-write ext4 filesystems (for instance, a container VM
> with read-only filesystems underneath an overlayfs).
> 
> Fixes: 21175ca434c5 ("ext4: make prefetch_block_bitmaps default")
> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
> ---

Looks good to me.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Tested in a VM, with a read-only ext4 root filesystem. Confirmed that
> ext4lazyinit starts without this patch, and does not start with this
> patch.
> 
> (For a future merge window, not the current one. Please let me know if I
> need to re-send this at a later, more convenient time.)
> 
>  fs/ext4/super.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 845f2f8aee5f..20437acc8865 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3973,9 +3973,9 @@ int ext4_register_li_request(struct super_block *sb,
>  		goto out;
>  	}
>  
> -	if (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) &&
> -	    (first_not_zeroed == ngroups || sb_rdonly(sb) ||
> -	     !test_opt(sb, INIT_INODE_TABLE)))
> +	if (sb_rdonly(sb) ||
> +	    (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) &&
> +	     (first_not_zeroed == ngroups || !test_opt(sb, INIT_INODE_TABLE))))
>  		goto out;
>  
>  	elr = ext4_li_request_new(sb, first_not_zeroed);
> -- 
> 2.36.1
> 


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

* Re: [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems
  2022-08-03  7:00 ` Lukas Czerner
@ 2022-08-31 22:09   ` Josh Triplett
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Triplett @ 2022-08-31 22:09 UTC (permalink / raw)
  To: Lukas Czerner; +Cc: Theodore Ts'o, Andreas Dilger, linux-ext4, linux-kernel

On Wed, Aug 03, 2022 at 09:00:01AM +0200, Lukas Czerner wrote:
> On Sun, Jul 31, 2022 at 08:24:53PM -0700, Josh Triplett wrote:
> > On a read-only filesystem, we won't invoke the block allocator, so we
> > don't need to prefetch the block bitmaps.
> > 
> > This avoids starting and running the ext4lazyinit thread at all on a
> > system with no read-write ext4 filesystems (for instance, a container VM
> > with read-only filesystems underneath an overlayfs).
> > 
> > Fixes: 21175ca434c5 ("ext4: make prefetch_block_bitmaps default")
> > Signed-off-by: Josh Triplett <josh@joshtriplett.org>
> > ---
> 
> Looks good to me.
> 
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>
> 
> > Tested in a VM, with a read-only ext4 root filesystem. Confirmed that
> > ext4lazyinit starts without this patch, and does not start with this
> > patch.
> > 
> > (For a future merge window, not the current one. Please let me know if I
> > need to re-send this at a later, more convenient time.)

Now that the merge window has been closed for a while, I wanted to
follow up on this to see if it could get into next.

> >  fs/ext4/super.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index 845f2f8aee5f..20437acc8865 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -3973,9 +3973,9 @@ int ext4_register_li_request(struct super_block *sb,
> >  		goto out;
> >  	}
> >  
> > -	if (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) &&
> > -	    (first_not_zeroed == ngroups || sb_rdonly(sb) ||
> > -	     !test_opt(sb, INIT_INODE_TABLE)))
> > +	if (sb_rdonly(sb) ||
> > +	    (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) &&
> > +	     (first_not_zeroed == ngroups || !test_opt(sb, INIT_INODE_TABLE))))
> >  		goto out;
> >  
> >  	elr = ext4_li_request_new(sb, first_not_zeroed);
> > -- 
> > 2.36.1
> > 
> 

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

* Re: [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems
  2022-08-01  3:24 [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems Josh Triplett
  2022-08-03  7:00 ` Lukas Czerner
@ 2022-09-27 21:53 ` Theodore Ts'o
  1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2022-09-27 21:53 UTC (permalink / raw)
  To: adilger.kernel, josh; +Cc: Theodore Ts'o, linux-ext4, linux-kernel

On Sun, 31 Jul 2022 20:24:53 -0700, Josh Triplett wrote:
> On a read-only filesystem, we won't invoke the block allocator, so we
> don't need to prefetch the block bitmaps.
> 
> This avoids starting and running the ext4lazyinit thread at all on a
> system with no read-write ext4 filesystems (for instance, a container VM
> with read-only filesystems underneath an overlayfs).
> 
> [...]

Applied, thanks!

[1/1] ext4: Don't run ext4lazyinit for read-only filesystems
      commit: 3490a40364962a2599bc5a8126003a47150b84d3

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

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

end of thread, other threads:[~2022-09-27 21:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01  3:24 [PATCH] ext4: Don't run ext4lazyinit for read-only filesystems Josh Triplett
2022-08-03  7:00 ` Lukas Czerner
2022-08-31 22:09   ` Josh Triplett
2022-09-27 21:53 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.