<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 19, 2019 at 4:13 PM Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
----- Original Message -----<br>
> Another patch I was thinking is to enhance the tst_fill_fs routine, which<br>
> as Eric suggested, makes more reliably to get to a full filesystem.<br>
> Something like what xfstest does to cut the trial write size in half and<br>
> try again until the size is less than the filesystem block size.<br>
> <br>
> Comments?<br>
<br>
fallocate05 seems to be the only test using it, but in general I think we<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Thanks, I will format a patch.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
can do that too. Assuming this alone would be reliable, is there any<br>
advantage of running test with small FALLOCATE_SIZE?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Hmm, maybe no, my purpose to shrink the FALLOCATE_SIZE is just to reproduce the problem. I thought that if the filesystem is not 'really' full, then the fallocate() should succeed with a smaller size, only for degging.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> <br>
> --- a/lib/tst_fill_fs.c<br>
> +++ b/lib/tst_fill_fs.c<br>
> @@ -6,6 +6,7 @@<br>
> #include <errno.h><br>
> #include <stdio.h><br>
> #include <stdlib.h><br>
> +#include <sys/statvfs.h><br>
> <br>
> #define TST_NO_DEFAULT_MAIN<br>
> #include "tst_test.h"<br>
> @@ -19,6 +20,8 @@ void tst_fill_fs(const char *path, int verbose)<br>
> size_t len;<br>
> ssize_t ret;<br>
> int fd;<br>
> + struct statvfs fi;<br>
> + statvfs(path, &fi);<br>
> <br>
> for (;;) {<br>
> len = random() % (1024 * 102400);<br>
> @@ -41,6 +44,12 @@ void tst_fill_fs(const char *path, int verbose)<br>
> ret = write(fd, buf, MIN(len, sizeof(buf)));<br>
> <br>
> if (ret < 0) {<br>
> + if (errno == ENOSPC) {<br>
> + len /= 2;<br>
> + if (len >= fi.f_bsize)<br>
> + continue;<br>
> + }<br>
> +<br>
> SAFE_CLOSE(fd);<br>
> <br>
> if (errno != ENOSPC)<br>
> <br>
> <br>
> <br>
> ><br>
> > Increase FALLOCATE_SIZE to minimize chance of hitting sporadic<br>
> > failures when that happens.<br>
> ><br>
> > Thanks to Carlos Maiolino and Eric Sandeen for their comments<br>
> > and suggestions.<br>
> ><br>
> > Fixes #610<br>
> > Signed-off-by: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br>
> ><br>
> Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
<br>
Thanks, I pushed this patch for now. <br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>