All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fallocate05: increase FALLOCATE_SIZE
Date: Tue, 19 Nov 2019 03:13:32 -0500 (EST)	[thread overview]
Message-ID: <1824199572.12930798.1574151212869.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2eu8HcQ90+BxUL0Hu+No6P5je4xC3oqVSU_ZnwMXEG=7Q@mail.gmail.com>



----- Original Message -----
> Another patch I was thinking is to enhance the tst_fill_fs routine, which
> as Eric suggested, makes more reliably to get to a full filesystem.
> Something like what xfstest does to cut the trial write size in half and
> try again until the size is less than the filesystem block size.
> 
> Comments?

fallocate05 seems to be the only test using it, but in general I think we
can do that too. Assuming this alone would be reliable, is there any
advantage of running test with small FALLOCATE_SIZE?

> 
> --- a/lib/tst_fill_fs.c
> +++ b/lib/tst_fill_fs.c
> @@ -6,6 +6,7 @@
>  #include <errno.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> +#include <sys/statvfs.h>
> 
>  #define TST_NO_DEFAULT_MAIN
>  #include "tst_test.h"
> @@ -19,6 +20,8 @@ void tst_fill_fs(const char *path, int verbose)
>         size_t len;
>         ssize_t ret;
>         int fd;
> +       struct statvfs fi;
> +       statvfs(path, &fi);
> 
>         for (;;) {
>                 len = random() % (1024 * 102400);
> @@ -41,6 +44,12 @@ void tst_fill_fs(const char *path, int verbose)
>                         ret = write(fd, buf, MIN(len, sizeof(buf)));
> 
>                         if (ret < 0) {
> +                               if (errno == ENOSPC) {
> +                                       len /= 2;
> +                                       if (len >= fi.f_bsize)
> +                                               continue;
> +                               }
> +
>                                 SAFE_CLOSE(fd);
> 
>                                 if (errno != ENOSPC)
> 
> 
> 
> >
> > Increase FALLOCATE_SIZE to minimize chance of hitting sporadic
> > failures when that happens.
> >
> > Thanks to Carlos Maiolino and Eric Sandeen for their comments
> > and suggestions.
> >
> > Fixes #610
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> >
> Reviewed-by: Li Wang <liwang@redhat.com>

Thanks, I pushed this patch for now. 


  reply	other threads:[~2019-11-19  8:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 16:08 [LTP] [PATCH] fallocate05: increase FALLOCATE_SIZE Jan Stancek
2019-11-18 16:18 ` Martin Doucha
2019-11-19  5:45   ` Li Wang
2019-11-18 16:19 ` Cyril Hrubis
2019-11-19  5:34 ` Li Wang
2019-11-19  8:13   ` Jan Stancek [this message]
2019-11-19  8:59     ` Li Wang
2019-11-19  9:47     ` Martin Doucha
2019-11-19 10:02       ` Jan Stancek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1824199572.12930798.1574151212869.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.