Re: [LTP] [PATCH 2/2] fill_fs: Ensure written data is not easily compressed

Richard Palethorpe
2022-12-06T15:32:06Z

Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Hi!
>> --- a/lib/tst_fill_fs.c
>> +++ b/lib/tst_fill_fs.c
>> @@ -16,13 +16,20 @@ void tst_fill_fs(const char *path, int verbose)
>> {
>> int i = 0;
>> char file[PATH_MAX];
>> - char buf[4096];
>> + static char buf[4096];
>
> I'm not sure if caching the random data is worth here, I bet that
> reading the random data would be neglectible to the rest of the write
> operations we do.

I suppose that instead of writing random lengths we could just copy
/dev/urandom to <path> in static chunks of a reasonable size.

Furthermore we can use copy_file_range on newer kernels.

--
Thank you,
Richard.