All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/273: Limit number of files by available inodes
@ 2022-11-30 16:22 Jan Kara
  2022-11-30 16:45 ` Filipe Manana
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2022-11-30 16:22 UTC (permalink / raw)
  To: fstests; +Cc: Jan Kara

Test generic/273 is failing for ext4 with 1k blocksize because it is
creating more files than we have available inodes. Just limit the number
of files created to the number of inodes.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 tests/generic/273 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/generic/273 b/tests/generic/273
index f86dae9b8095..80c02d43c7ac 100755
--- a/tests/generic/273
+++ b/tests/generic/273
@@ -50,9 +50,16 @@ _file_create()
 
 	cd $SCRATCH_MNT/origin
 
-	_disksize=`$DF_PROG -B 1 $SCRATCH_MNT | tail -1 | $AWK_PROG '{ print $5 }'`
+	_disksize=$(_get_available_space $SCRATCH_MNT)
+	_free_inodes=$(_get_free_inode $SCRATCH_MNT)
+	# Leave some slack for directories etc.
+	_free_inodes=$(($_free_inodes - $_free_inodes/8))
 	_disksize=$(($_disksize / 3))
-	_num=$(($_disksize / $count / $threads / $block_size))
+	_num=$(($_disksize / $count / $block_size))
+	if [ $_num -gt $_free_inodes ]; then
+		_num=$_free_inodes
+	fi
+	_num=$(($_num/$threads))
 	_count=$count
 	while [ $_i -lt $_num ]
 	do
-- 
2.35.3


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

* Re: [PATCH] generic/273: Limit number of files by available inodes
  2022-11-30 16:22 [PATCH] generic/273: Limit number of files by available inodes Jan Kara
@ 2022-11-30 16:45 ` Filipe Manana
  2022-11-30 16:54   ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Filipe Manana @ 2022-11-30 16:45 UTC (permalink / raw)
  To: Jan Kara; +Cc: fstests

On Wed, Nov 30, 2022 at 4:30 PM Jan Kara <jack@suse.cz> wrote:
>
> Test generic/273 is failing for ext4 with 1k blocksize because it is
> creating more files than we have available inodes. Just limit the number
> of files created to the number of inodes.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  tests/generic/273 | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tests/generic/273 b/tests/generic/273
> index f86dae9b8095..80c02d43c7ac 100755
> --- a/tests/generic/273
> +++ b/tests/generic/273
> @@ -50,9 +50,16 @@ _file_create()
>
>         cd $SCRATCH_MNT/origin
>
> -       _disksize=`$DF_PROG -B 1 $SCRATCH_MNT | tail -1 | $AWK_PROG '{ print $5 }'`
> +       _disksize=$(_get_available_space $SCRATCH_MNT)
> +       _free_inodes=$(_get_free_inode $SCRATCH_MNT)

Jan, this will always return 0 on btrfs, since it has no limits on the
number of inodes, so it ends up not creating any files in the loop below.

We could call _require_inode_limits, but that would skip the test on btrfs.
Can we leave the old calculation if get_free_inode returns 0? (and
maybe leave a comment that a fs without inode limits returns 0)

Thanks.



> +       # Leave some slack for directories etc.
> +       _free_inodes=$(($_free_inodes - $_free_inodes/8))
>         _disksize=$(($_disksize / 3))
> -       _num=$(($_disksize / $count / $threads / $block_size))
> +       _num=$(($_disksize / $count / $block_size))
> +       if [ $_num -gt $_free_inodes ]; then
> +               _num=$_free_inodes
> +       fi
> +       _num=$(($_num/$threads))
>         _count=$count
>         while [ $_i -lt $_num ]
>         do
> --
> 2.35.3
>

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

* Re: [PATCH] generic/273: Limit number of files by available inodes
  2022-11-30 16:45 ` Filipe Manana
@ 2022-11-30 16:54   ` Jan Kara
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2022-11-30 16:54 UTC (permalink / raw)
  To: Filipe Manana; +Cc: Jan Kara, fstests

On Wed 30-11-22 16:45:23, Filipe Manana wrote:
> On Wed, Nov 30, 2022 at 4:30 PM Jan Kara <jack@suse.cz> wrote:
> >
> > Test generic/273 is failing for ext4 with 1k blocksize because it is
> > creating more files than we have available inodes. Just limit the number
> > of files created to the number of inodes.
> >
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> >  tests/generic/273 | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/generic/273 b/tests/generic/273
> > index f86dae9b8095..80c02d43c7ac 100755
> > --- a/tests/generic/273
> > +++ b/tests/generic/273
> > @@ -50,9 +50,16 @@ _file_create()
> >
> >         cd $SCRATCH_MNT/origin
> >
> > -       _disksize=`$DF_PROG -B 1 $SCRATCH_MNT | tail -1 | $AWK_PROG '{ print $5 }'`
> > +       _disksize=$(_get_available_space $SCRATCH_MNT)
> > +       _free_inodes=$(_get_free_inode $SCRATCH_MNT)
> 
> Jan, this will always return 0 on btrfs, since it has no limits on the
> number of inodes, so it ends up not creating any files in the loop below.
> 
> We could call _require_inode_limits, but that would skip the test on btrfs.
> Can we leave the old calculation if get_free_inode returns 0? (and
> maybe leave a comment that a fs without inode limits returns 0)

OK, makes sense. I'll do that. I was wondering for a while whether
_get_free_inode shouldn't return something more sensible for btrfs but I
guess it's difficult to come up with some universally OK value.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2022-11-30 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 16:22 [PATCH] generic/273: Limit number of files by available inodes Jan Kara
2022-11-30 16:45 ` Filipe Manana
2022-11-30 16:54   ` Jan Kara

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.