diff mbox series

generic/694: sync before sampling i_blocks

Message ID 20241008071209.160188-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series generic/694: sync before sampling i_blocks | expand

Commit Message

Christoph Hellwig Oct. 8, 2024, 7:12 a.m. UTC
Without a sync there might still be temporary blocks in i_blocks like
indirect block reservations or additional blocks reserved for out of
place writes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/generic/694 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Darrick J. Wong Oct. 9, 2024, 2:48 p.m. UTC | #1
On Tue, Oct 08, 2024 at 09:12:09AM +0200, Christoph Hellwig wrote:
> Without a sync there might still be temporary blocks in i_blocks like
> indirect block reservations or additional blocks reserved for out of
> place writes.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  tests/generic/694 | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tests/generic/694 b/tests/generic/694
> index 02253ef75..b6bc8a75f 100755
> --- a/tests/generic/694
> +++ b/tests/generic/694
> @@ -37,6 +37,10 @@ if [ $? -ne 0 ]; then
>  	echo "Could not create 4G test file"
>  fi
>  
> +# make sure indirect block reservations and other temporary block reservations
> +# are release before sampling i_blocks

Nit: '...are released before...'

> +sync

Should this be more targeted since we only care about junk_file's
i_blocks, not flushing everything in the system. e.g.

sync $junk_file

--D

> +
>  iblocks=`stat -c '%b' $junk_file`
>  
>  _test_cycle_mount
> -- 
> 2.45.2
> 
>
Zorro Lang Oct. 10, 2024, 6:37 a.m. UTC | #2
On Wed, Oct 09, 2024 at 07:48:17AM -0700, Darrick J. Wong wrote:
> On Tue, Oct 08, 2024 at 09:12:09AM +0200, Christoph Hellwig wrote:
> > Without a sync there might still be temporary blocks in i_blocks like
> > indirect block reservations or additional blocks reserved for out of
> > place writes.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  tests/generic/694 | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/tests/generic/694 b/tests/generic/694
> > index 02253ef75..b6bc8a75f 100755
> > --- a/tests/generic/694
> > +++ b/tests/generic/694
> > @@ -37,6 +37,10 @@ if [ $? -ne 0 ]; then
> >  	echo "Could not create 4G test file"
> >  fi
> >  
> > +# make sure indirect block reservations and other temporary block reservations
> > +# are release before sampling i_blocks
> 
> Nit: '...are released before...'
> 
> > +sync
> 
> Should this be more targeted since we only care about junk_file's
> i_blocks, not flushing everything in the system. e.g.
> 
> sync $junk_file

I can help to do this change, if you don't have more review points besides that.

Thanks,
Zorro

> 
> --D
> 
> > +
> >  iblocks=`stat -c '%b' $junk_file`
> >  
> >  _test_cycle_mount
> > -- 
> > 2.45.2
> > 
> > 
>
Christoph Hellwig Oct. 10, 2024, 6:59 a.m. UTC | #3
On Wed, Oct 09, 2024 at 07:48:17AM -0700, Darrick J. Wong wrote:
> > +# make sure indirect block reservations and other temporary block reservations
> > +# are release before sampling i_blocks
> 
> Nit: '...are released before...'
> 
> > +sync
> 
> Should this be more targeted since we only care about junk_file's
> i_blocks, not flushing everything in the system. e.g.
> 
> sync $junk_file

I didn't even know sync took an optional file argument.  But yes,
that should be fine.
diff mbox series

Patch

diff --git a/tests/generic/694 b/tests/generic/694
index 02253ef75..b6bc8a75f 100755
--- a/tests/generic/694
+++ b/tests/generic/694
@@ -37,6 +37,10 @@  if [ $? -ne 0 ]; then
 	echo "Could not create 4G test file"
 fi
 
+# make sure indirect block reservations and other temporary block reservations
+# are release before sampling i_blocks
+sync
+
 iblocks=`stat -c '%b' $junk_file`
 
 _test_cycle_mount