From: Dave Chinner <david@fromorbit.com>
To: Tony Battersby <tonyb@cybernetics.com>
Cc: Song Liu <song@kernel.org>, Yu Kuai <yukuai3@huawei.com>,
Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-raid@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iomap: align writeback to RAID stripe boundaries
Date: Wed, 30 Jul 2025 10:52:04 +1000 [thread overview]
Message-ID: <aIlstOWckYGw34rM@dread.disaster.area> (raw)
In-Reply-To: <55deda1d-967d-4d68-a9ba-4d5139374a37@cybernetics.com>
On Tue, Jul 29, 2025 at 12:13:42PM -0400, Tony Battersby wrote:
> Improve writeback performance to RAID-4/5/6 by aligning writes to stripe
> boundaries. This relies on io_opt being set to the stripe size (or
> a multiple) when BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE is set.
This is the wrong layer to be pulling filesystem write alignments
from.
Filesystems already have alignment information in their on-disk
formats. XFS has stripe unit and stripe width information in the
filesysetm superblock that is set by mkfs.xfs.
This information comes from the block device io-opt/io-min values
exposed to userspace at mkfs time, so the filesystem already knows
what the optimal IO alignment parameters are for the storage stack
underneath it.
Indeed, we already align extent allocations to these parameters, so
aligning filesystem writeback to the same configured alignment makes
a lot more sense than pulling random stuff from block devices during
IO submission...
> @@ -1685,81 +1685,118 @@ static int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc,
> struct inode *inode, loff_t pos, loff_t end_pos,
> unsigned len)
> {
> - struct iomap_folio_state *ifs = folio->private;
> - size_t poff = offset_in_folio(folio, pos);
> - unsigned int ioend_flags = 0;
> - int error;
> -
> - if (wpc->iomap.type == IOMAP_UNWRITTEN)
> - ioend_flags |= IOMAP_IOEND_UNWRITTEN;
> - if (wpc->iomap.flags & IOMAP_F_SHARED)
> - ioend_flags |= IOMAP_IOEND_SHARED;
> - if (folio_test_dropbehind(folio))
> - ioend_flags |= IOMAP_IOEND_DONTCACHE;
> - if (pos == wpc->iomap.offset && (wpc->iomap.flags & IOMAP_F_BOUNDARY))
> - ioend_flags |= IOMAP_IOEND_BOUNDARY;
> + struct queue_limits *lim = bdev_limits(wpc->iomap.bdev);
> + unsigned int io_align =
> + (lim->features & BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE) ?
> + lim->io_opt >> SECTOR_SHIFT : 0;
i.e. this alignment should come from the filesystem, not the block
device.
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2025-07-30 0:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 16:13 Tony Battersby
2025-07-29 18:38 ` Matthew Wilcox
2025-07-29 19:01 ` Tony Battersby
2025-07-29 19:17 ` Matthew Wilcox
2025-07-29 20:12 ` Tony Battersby
2025-07-30 0:52 ` Dave Chinner [this message]
2025-07-30 14:14 ` Christoph Hellwig
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=aIlstOWckYGw34rM@dread.disaster.area \
--to=david@fromorbit.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=song@kernel.org \
--cc=tonyb@cybernetics.com \
--cc=willy@infradead.org \
--cc=yukuai3@huawei.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
Powered by JetHome