public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 3/4] syscalls/statx11: Add basic test for STATX_DIOALIGN on block device
Date: Tue, 4 Apr 2023 14:59:18 -0700	[thread overview]
Message-ID: <20230404215918.GA1893@sol.localdomain> (raw)
In-Reply-To: <1680593430-14728-3-git-send-email-xuyang2018.jy@fujitsu.com>

Hi Yang,

On Tue, Apr 04, 2023 at 03:30:29PM +0800, Yang Xu wrote:
> +	/*
> +	 * This test is tightly coupled to the kernel's current DIO restrictions
> +	 * on block devices. The general rule of DIO needing to be aligned to the
> +	 * block device's logical block size was recently relaxed to allow user buffers

Please don't use the word "recently" in code comments like this.  It is vague,
and what is "recent" now will no longer be recent in the future.

> +
> +	TST_EXP_PASS(statx(AT_FDCWD, tst_device->dev, 0, 0, &buf),
> +		"statx(AT_FDCWD, %s, 0, STATX_DIOALIGN, &buf)", tst_device->dev);
> +	TST_EXP_EQ_LU(buf.stx_dio_mem_align, 0);
> +	TST_EXP_EQ_LU(buf.stx_dio_offset_align, 0);

Like I mentioned on patch 2, this is not a valid test case because the contract
of statx() allows it to return information that wasn't explicitly requested.

> +static void setup(void)
> +{
> +	char *dev_name;
> +	int dev_fd;
> +
> +	dev_fd = SAFE_OPEN(tst_device->dev, O_RDWR);
> +	SAFE_IOCTL(dev_fd, BLKSSZGET, &logical_sector_size);
> +	SAFE_CLOSE(dev_fd);
> +
> +	if (logical_sector_size <= 0)
> +		tst_brk(TBROK, "BLKSSZGET returned invalid block size %i", logical_sector_size);
> +
> +	dev_name = basename((char *)tst_device->dev);
> +	sprintf(sys_bdev_lgs_path, "/sys/block/%s/queue/logical_block_size", dev_name);
> +	while (access(sys_bdev_lgs_path, F_OK) != 0) {
> +		dev_name[strlen(dev_name)-1] = '\0';
> +		sprintf(sys_bdev_lgs_path, "/sys/block/%s/queue/logical_block_size", dev_name);
> +	}

What does "lgs" stand for?

Why are both BLKSSZGET and /sys/block/%s/queue/logical_block_size being used?
Don't they provide exactly the same information?

> +	if (access(sys_bdev_dma_path, F_OK) != 0)
> +		tst_brk(TCONF, "dma_alignment syfsfile doesn't exist");
> +}

syfsfile => sysfs file

> +static void cleanup(void)
> +{
> +	if (fd > -1)
> +		SAFE_CLOSE(fd);
> +}

What is the purpose of the 'fd' variable?

> +static struct tst_test test = {
> +	.test_all = verify_statx,
> +	.setup = setup,
> +	.cleanup = cleanup,
> +	.needs_root = 1,
> +	.needs_device = 1,
> +};

Why does this test need root?

- Eric

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

  reply	other threads:[~2023-04-04 21:59 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  8:22 [LTP] [PATCH 1/3] lapi/stat.h: Add STATX_DIOALIGN related definition Yang Xu
2023-03-30  8:22 ` [LTP] [PATCH 2/3] syscalls/statx10: Add basic test for STATX_DIOALIGN Yang Xu
2023-03-30 16:46   ` Eric Biggers
2023-03-31 12:56     ` xuyang2018.jy
2023-03-31 19:29       ` Eric Biggers
2023-04-03  1:24         ` xuyang2018.jy
2023-04-03  3:06           ` Eric Biggers
2023-04-03 10:44           ` [LTP] [PATCH v2 1/4] lapi/stat.h: Add STATX_DIOALIGN related definition Yang Xu
2023-04-03 10:44             ` [LTP] [PATCH v2 2/4] syscalls/statx10: Add basic test for STATX_DIOALIGN on regular file Yang Xu
2023-04-03 17:01               ` Eric Biggers
2023-04-04  3:10                 ` xuyang2018.jy
2023-04-04  5:46                   ` xuyang2018.jy
2023-04-03 10:44             ` [LTP] [PATCH v2 3/4] syscalls/statx11: Add basic test for STATX_DIOALIGN on blockdev Yang Xu
2023-04-03 17:04               ` Eric Biggers
2023-04-04  3:14                 ` xuyang2018.jy
2023-04-04  7:30                 ` [LTP] [PATCH v3 1/4] lapi/stat.h: Add STATX_DIOALIGN related definition Yang Xu
2023-04-04  7:30                   ` [LTP] [PATCH v3 2/4] syscalls/statx10: Add basic test for STATX_DIOALIGN on regular file Yang Xu
2023-04-04 21:52                     ` Eric Biggers
2023-04-06  4:52                       ` xuyang2018.jy
2023-04-04  7:30                   ` [LTP] [PATCH v3 3/4] syscalls/statx11: Add basic test for STATX_DIOALIGN on block device Yang Xu
2023-04-04 21:59                     ` Eric Biggers [this message]
2023-04-06  4:57                       ` xuyang2018.jy
2023-04-06  5:36                         ` xuyang2018.jy
2023-04-06  5:40                       ` [LTP] [PATCH v4 1/4] lapi/stat.h: Add STATX_DIOALIGN related definition Yang Xu
2023-04-06  5:40                         ` [LTP] [PATCH v4 2/4] syscalls/statx10: Add basic test for STATX_DIOALIGN on regular file Yang Xu
2023-04-26 22:06                           ` Eric Biggers
2023-04-27  3:03                             ` Yang Xu (Fujitsu)
2023-05-01 17:44                               ` Eric Biggers
2023-05-01 17:47                                 ` Eric Biggers
2023-05-08  8:25                                 ` Yang Xu (Fujitsu)
2023-05-08  8:30                                   ` Yang Xu (Fujitsu)
2023-04-06  5:40                         ` [LTP] [PATCH v4 3/4] syscalls/statx11: Add basic test for STATX_DIOALIGN on block device Yang Xu
2023-04-26 22:12                           ` Eric Biggers
2023-04-27  3:37                             ` Yang Xu (Fujitsu)
2023-04-27  3:50                               ` Yang Xu (Fujitsu)
2023-05-01 17:49                                 ` Eric Biggers
2023-05-08  8:26                                   ` Yang Xu (Fujitsu)
2023-04-06  5:40                         ` [LTP] [PATCH v4 4/4] lapi/stat.h: Remove deprecated STATX_ALL macro Yang Xu
2023-04-26 21:56                           ` Eric Biggers
2023-04-27  1:52                             ` Yang Xu (Fujitsu)
2023-04-26  9:57                         ` [LTP] [PATCH v4 1/4] lapi/stat.h: Add STATX_DIOALIGN related definition Yang Xu (Fujitsu)
2023-04-26 21:56                         ` Eric Biggers
2023-04-27  1:36                           ` Yang Xu (Fujitsu)
2023-04-04  7:30                   ` [LTP] [PATCH v3 4/4] lapi/stat.h: Remove deprecated STATX_ALL macro Yang Xu
2023-04-03 10:44             ` [LTP] [PATCH v2 " Yang Xu
2023-03-30  8:22 ` [LTP] [PATCH 3/3] " Yang Xu

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=20230404215918.GA1893@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=xuyang2018.jy@fujitsu.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