public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Keith Busch <kbusch@meta.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"chaitanyak@nvidia.com" <chaitanyak@nvidia.com>
Subject: Re: [PATCHv2 1/2] blktests: test direct io offsets
Date: Tue, 25 Nov 2025 09:42:51 -0700	[thread overview]
Message-ID: <aSXci0u7c9Ppnjbd@kbusch-mbp> (raw)
In-Reply-To: <y744um3exsnhtf5u4iabfipzwkexcz5t3xqe4vvspa7z7hfuws@y5mbl2oszpuy>

On Tue, Nov 25, 2025 at 11:26:31AM +0000, Shinichiro Kawasaki wrote:
> On Nov 19, 2025 / 11:54, Keith Busch wrote:
> > From: Keith Busch <kbusch@kernel.org>
> > 
> > Tests various direct IO memory and length alignments against the
> > device's queue limits reported from sysfs.
> > 
> > Signed-off-by: Keith Busch <kbusch@kernel.org>
> > ---
> [...]
> > diff --git a/src/dio-offsets.c b/src/dio-offsets.c
> > new file mode 100644
> > index 0000000..8e46091
> > --- /dev/null
> > +++ b/src/dio-offsets.c
> [...]
> > +static void init_buffers()
> > +{
> > +	unsigned long lb_mask = logical_block_size - 1;
> > +	int fd, ret;
> > +
> > +	buf_size = max_bytes * max_segments / 2;
> > +	if (buf_size < logical_block_size * max_segments)
> > +		err(EINVAL, "%s: logical block size is too big", __func__);
> > +
> > +	if (buf_size < logical_block_size * 1024 * 4)
> > +		buf_size = logical_block_size * 1024 * 4;
> > +
> > +	if (buf_size & lb_mask)
> > +		buf_size = (buf_size + lb_mask) & ~(lb_mask);
> 
> I investigated why this new test case fails with my QEMU SATA device and noticed
> that the device has 128MiB size. The calculation above sets buf_size = 192MiB.
> Then pwrite() in test_full_size_aligned() is called with 192MiB size and it was
> truncated to 128MiB. Then the following compare() check failed.
> 
> Is it okay to cap the buf_size with the device size? If so, I suggest the change
> below. With this change, the test case passes with the device. If you are okay
> with the change, I can fold it in when I apply the patch.

Yeah, totally fine. Much of the sizes were just made up as I went along,
but it should probably be programatically calculated based on the device
under test.

> > +#!/bin/bash
> 
> Is it okay to add any GPL SPDX license and your copyright here? It is not ideal
> that I add your copyright and license, but if you specify them in this thread, I
> will add the Link to this thread in the commit message and fold-in the specifed
> SPDX license and your copyright.

Yes, sorry, it should have been there. I added those to some files, but
missed this one.

  reply	other threads:[~2025-11-25 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 19:54 [PATCHv2 0/2] blktests: add tests with offsets Keith Busch
2025-11-19 19:54 ` [PATCHv2 1/2] blktests: test direct io offsets Keith Busch
2025-11-19 23:39   ` Chaitanya Kulkarni
2025-11-19 23:48   ` Chaitanya Kulkarni
2025-11-19 23:59     ` Keith Busch
2025-11-20  0:56       ` Chaitanya Kulkarni
2025-11-20 14:32         ` Keith Busch
2025-11-25 11:26   ` Shinichiro Kawasaki
2025-11-25 16:42     ` Keith Busch [this message]
2025-12-02 10:22       ` Shinichiro Kawasaki
2025-11-19 19:54 ` [PATCHv2 2/2] blktests: test io_uring user metadata offsets Keith Busch
2025-11-19 23:39   ` Chaitanya Kulkarni

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=aSXci0u7c9Ppnjbd@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=chaitanyak@nvidia.com \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.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