From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@meta.com>
Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
dm-devel@lists.linux.dev, hch@lst.de, axboe@kernel.dk,
brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv2 4/6] loop: set dma_alignment from the backing file for direct I/O
Date: Tue, 23 Jun 2026 17:04:57 +0200 [thread overview]
Message-ID: <20260623150457.GD13628@lst.de> (raw)
In-Reply-To: <20260622174241.2299563-5-kbusch@meta.com>
On Mon, Jun 22, 2026 at 10:42:39AM -0700, Keith Busch wrote:
> /*
> - * Use the minimal dio alignment of the file system if provided.
> + * Use the dio alignment of the file system if provided. dio_offset_align
> + * is the minimum dio size and offset; dio_mem_align is the buffer memory
> + * alignment, kept as a mask to become the loop device's dma_alignment in
> + * direct I/O mode where the buffer is handed to the backing file unchanged.
A bunch of overly long lines here.
> + * In direct I/O the user pages are handed to the backing file as-is, so
> + * the backing's DMA alignment requirement applies to them. Advertise it
> + * so misaligned I/O is rejected at this device's entry instead of being
> + * dispatched to the backend. Buffered I/O copies through the page cache
> + * and imposes no such requirement.
> + */
More line spillover here.
> + if (lo->lo_flags & LO_FLAGS_DIRECT_IO)
> + lim->dma_alignment = lo->lo_dio_mem_align;
> + else
> + lim->dma_alignment = SECTOR_SIZE - 1;
Despite the comment above this does enforce a SECTOR_SIZE dma
alignment for buffered I/O. Shouldn't this be our lowest supported
value (or dword alignment to match real devices)?
> + lim = queue_limits_start_update(lo->lo_queue);
> + if (lo->lo_flags & LO_FLAGS_DIRECT_IO)
> + lim.dma_alignment = lo->lo_dio_mem_align;
> + else
> + lim.dma_alignment = SECTOR_SIZE - 1;
Should this and the above copy of this assignment be factored into a
helper?
next prev parent reply other threads:[~2026-06-23 15:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 17:42 [PATCHv2 0/6] direct-io: validate user space vectors during extraction Keith Busch
2026-06-22 17:42 ` [PATCHv2 1/6] block: introduce bio_endio_errno helper Keith Busch
2026-06-23 14:54 ` Christoph Hellwig
2026-06-23 15:05 ` Keith Busch
2026-06-23 15:07 ` Christoph Hellwig
2026-06-22 17:42 ` [PATCHv2 2/6] block: report the actual status Keith Busch
2026-06-23 14:55 ` Christoph Hellwig
2026-06-23 14:59 ` Keith Busch
2026-06-22 17:42 ` [PATCHv2 3/6] block: fix dio leak on metadata mapping error Keith Busch
2026-06-23 15:01 ` Christoph Hellwig
2026-06-22 17:42 ` [PATCHv2 4/6] loop: set dma_alignment from the backing file for direct I/O Keith Busch
2026-06-23 15:04 ` Christoph Hellwig [this message]
2026-06-22 17:42 ` [PATCHv2 5/6] zloop: set dma_alignment from the backing files " Keith Busch
2026-06-23 15:06 ` Christoph Hellwig
2026-06-22 17:42 ` [PATCHv2 6/6] block: validate user space vectors during extraction Keith Busch
2026-06-23 15:10 ` Christoph Hellwig
2026-06-23 16:17 ` Keith Busch
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=20260623150457.GD13628@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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