Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Richard Palethorpe <rpalethorpe@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 3/3] cgroups: Add first IO controller test
Date: Fri, 1 Apr 2022 10:26:10 +0200	[thread overview]
Message-ID: <Yka3Iu1NLRzLnIlk@pevik> (raw)
In-Reply-To: <20220329074440.26214-3-rpalethorpe@suse.com>

Hi Richie,

> +++ b/testcases/kernel/controllers/io/io_control01.c
> @@ -0,0 +1,155 @@
> +// SPDX-License-Identifier: GPL-2.0
nit: not sure if it was deliberate not adding it, but you may want to add your/SUSE copyright.

> +/*\
> + *
> + * [Description]
> + *
> + * Perform some I/O on a file and check if at least some of it is
> + * recorded by the I/O controller.
> + *
> + * The exact amount of I/O performed is dependent on the file system,
> + * page cache, scheduler and block driver. We call sync and drop the
> + * file's page cache to force reading and writing. We also write
> + * random data to try to prevent compression.
> + *
> + * The pagecache is a particular issue for reading. If the call to
> + * fadvise is ignored then the data may only be read from the
> + * cache. So that no I/O requests are made.
> + */
> +
...
> +static int read_io_stats(const char *const line, struct io_stats *const stat)
> +{
> +	return sscanf(line,
> +		      "%u:%u rbytes=%lu wbytes=%lu rios=%lu wios=%lu dbytes=%lu dios=%lu",
> +		      &stat->mjr, &stat->mnr,
> +		      &stat->rbytes, &stat->wbytes, &stat->rios, &stat->wios,
> +		      &stat->dbytes, &stat->dios);
> +}
checkpatch.pl false positive:
io_control01.c:40: WARNING: unchecked sscanf return value
Obviously perl parsing has some limitations as we check read_io_stats() return
value.

...
> +static void setup(void)
> +{
> +	char buf[PATH_MAX] = { 0 };
> +	char *path = SAFE_GETCWD(buf, PATH_MAX - sizeof("mnt") - 1);
> +	struct stat st;
> +
> +	strcpy(path + strlen(path), "/mnt");
> +
> +	tst_stat_mount_dev(path, &st);
> +	dev_major = major(st.st_rdev);
> +	dev_minor = minor(st.st_rdev);
> +}
> +
> +static struct tst_test test = {
> +	.test_all = run,
> +	.setup = setup,
> +	.needs_device = 1,
nit: testcases/kernel/controllers/io/io_control01.c: useless tag: needs_device

Kind regards,
Petr

> +	.mntpoint = "mnt",
> +	.mount_device = 1,
> +	.all_filesystems = 1,
> +	.skip_filesystems = (const char *const[]){ "ntfs", "tmpfs", NULL },
> +	.needs_cgroup_ver = TST_CG_V2,
> +	.needs_cgroup_ctrls = (const char *const[]){ "io", NULL },
> +};

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-04-01  8:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29  7:44 [LTP] [PATCH v2 1/3] API/cgroup: Add io controller Richard Palethorpe via ltp
2022-03-29  7:44 ` [LTP] [PATCH v2 2/3] API/device: Add func to stat the actual dev mounted to a path Richard Palethorpe via ltp
2022-04-12  8:46   ` Petr Vorel
2022-03-29  7:44 ` [LTP] [PATCH v2 3/3] cgroups: Add first IO controller test Richard Palethorpe via ltp
2022-04-01  8:26   ` Petr Vorel [this message]
2022-04-12 11:28     ` Richard Palethorpe
2022-04-12  8:58   ` Petr Vorel
2022-04-12  8:26 ` [LTP] [PATCH v2 1/3] API/cgroup: Add io controller Petr Vorel

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=Yka3Iu1NLRzLnIlk@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    /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