From: Richard Palethorpe <rpalethorpe@suse.de>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] fill_fs: Ensure written data is not easily compressed
Date: Tue, 06 Dec 2022 16:30:02 +0000 [thread overview]
Message-ID: <87a640trg1.fsf@suse.de> (raw)
In-Reply-To: <Y49qssvWl2g+rvOu@yuki>
Hello,
Cyril Hrubis <chrubis@suse.cz> writes:
> Hi!
>> I suppose that instead of writing random lengths we could just copy
>> /dev/urandom to <path> in static chunks of a reasonable size.
>
> Actually it would make sense to do random length writes as well, at
> least for a subset of files. I guess that in real life scenario we would
> encounter both, block writes and randomly sized writes for files.
>
> I would do something as:
>
> #define BLOCK_SIZE 4096
>
> ..
> char buf[2*BLOCK_SIZE];
>
> fd = SAFE_OPEN("/dev/urandom", O_RDONLY);
> SAFE_READ(1, fd, buf, sizeof(buf));
> SAFE_CLOSE(fd);
>
> ...
>
> random_size = random() % 2;
>
> while (len) {
> if (random_size)
> len = random() % BOCK_SIZE;
> else
> len = BLOCK_SIZE;
>
> off = random() % BLOCK_SIZE;
>
> ret = write(fd, buf + off, len);
>
> ...
>
>
> But feel free to implement anything that you find sensible.
What are we trying to do though, simply fill the device to test the
ENOSPC condition or some kind of poor man's fuzzing?
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-12-06 16:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 11:53 [LTP] [PATCH 1/2] fs_fill: Add max_runtime = 60 Richard Palethorpe via ltp
2022-12-06 11:53 ` [LTP] [PATCH 2/2] fill_fs: Ensure written data is not easily compressed Richard Palethorpe via ltp
2022-12-06 13:33 ` Cyril Hrubis
2022-12-06 15:22 ` Richard Palethorpe
2022-12-06 16:15 ` Cyril Hrubis
2022-12-06 16:30 ` Richard Palethorpe [this message]
2022-12-06 18:02 ` Cyril Hrubis
2022-12-08 8:57 ` Richard Palethorpe
2022-12-09 15:28 ` Cyril Hrubis
2022-12-06 15:33 ` [LTP] [PATCH 1/2] fs_fill: Add max_runtime = 60 Petr Vorel
2022-12-08 2:39 ` Li Wang
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=87a640trg1.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=chrubis@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox