From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: cem@kernel.org, hch@lst.de, linux-fsdevel@vger.kernel.org,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 11/11] xfs: add media verification ioctl
Date: Tue, 13 Jan 2026 16:57:01 +0100 [thread overview]
Message-ID: <20260113155701.GA3489@lst.de> (raw)
In-Reply-To: <176826412941.3493441.8359506127711497025.stgit@frogsfrogsfrogs>
On Mon, Jan 12, 2026 at 04:35:25PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Add a new privileged ioctl so that xfs_scrub can ask the kernel to
> verify the media of the devices backing an xfs filesystem, and have any
> resulting media errors reported to fsnotify and xfs_healer.
Hmm, the description is a bit sparse?
> +/* Verify the media of the underlying devices */
> +struct xfs_verify_media {
> + __u32 dev; /* I: XFS_VERIFY_*DEV */
This should probably use the enum xfs_device values?
> +#define XFS_VERIFY_TO_EOD (~0ULL) /* end of disk */
Is there much of a point in this flag? scrub/healer really should
know the device size, shouldn't they?
> diff --git a/fs/xfs/xfs_notify_failure.c b/fs/xfs/xfs_notify_failure.c
> index 1edc4ddd10cdb2..5ef4109cc062d2 100644
> --- a/fs/xfs/xfs_notify_failure.c
> +++ b/fs/xfs/xfs_notify_failure.c
There's basically no overlap with the existing code in this file,
why not add a new one?
> + const unsigned int iosize = BIO_MAX_VECS << PAGE_SHIFT;
> + unsigned int bufsize = iosize;
That's a pretty gigantic buffer size. In general a low number of
MB should max out most current devices, and for a background scrub
you generally do not want to actually max out the device..
The in the background is also a good point here - we probably want
a way to tune the size as it might put too much of a load onto the
system pretty easily, and we need a way to dial it back.
> + folio = folio_alloc(GFP_KERNEL, get_order(bufsize));
> + if (!folio)
That first folio_alloc will cause nasty stack traces when it fails.
> + folio = folio_alloc(GFP_KERNEL, 0);
.. and then we fall back to just a single page. This is what I ended
up writing for an about to submitted series elsewhere:
static struct folio *folio_alloc_greedy(gfp_t gfp, size_t *size)
{
struct folio *folio;
while (*size > PAGE_SIZE) {
folio = folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
if (folio)
return folio;
*size = rounddown_pow_of_two(*size - 1);
}
return folio_alloc(gfp, get_order(*size));
}
although that is a bit more complicated as we never want to round
up the actual size.
> + for (i = 0; i < nr_vecs; i++) {
> + unsigned int vec_sects =
> + min(nr_sects, bufsize >> SECTOR_SHIFT);
> +
> + bio_add_folio_nofail(bio, folio,
> + vec_sects << SECTOR_SHIFT, 0);
> +
> + bio_daddr += vec_sects;
> + bio_bbcount -= vec_sects;
> + bio_submitted += vec_sects;
> + }
A single folio is always just a single vetor in the bio. No need
for any of the looping here.
> + /* Don't let too many IOs accumulate */
> + if (bio_submitted > SZ_256M >> SECTOR_SHIFT) {
> + blk_finish_plug(&plug);
> + error = submit_bio_wait(bio);
Also the building up and chaining here seems harmful. If you're
on SSDs you want to fire things off ASAP if you have large I/O.
On a HDD we'll take care of it below, but the bios will usually
actually be split, not merged anyway as they are beyond the
supported I/O size of the HBAs.
next prev parent reply other threads:[~2026-01-13 15:57 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 0:32 [PATCHSET v5] xfs: autonomous self healing of filesystems Darrick J. Wong
2026-01-13 0:32 ` [PATCH 01/11] docs: discuss autonomous self healing in the xfs online repair design doc Darrick J. Wong
2026-01-13 16:00 ` Christoph Hellwig
2026-01-13 0:33 ` [PATCH 02/11] xfs: start creating infrastructure for health monitoring Darrick J. Wong
2026-01-13 16:03 ` Christoph Hellwig
2026-01-13 0:33 ` [PATCH 03/11] xfs: create event queuing, formatting, and discovery infrastructure Darrick J. Wong
2026-01-13 16:05 ` Christoph Hellwig
2026-01-13 0:33 ` [PATCH 04/11] xfs: convey filesystem unmount events to the health monitor Darrick J. Wong
2026-01-13 16:11 ` Christoph Hellwig
2026-01-13 18:48 ` Darrick J. Wong
2026-01-13 0:33 ` [PATCH 05/11] xfs: convey metadata health " Darrick J. Wong
2026-01-13 16:11 ` Christoph Hellwig
2026-01-13 0:34 ` [PATCH 06/11] xfs: convey filesystem shutdown " Darrick J. Wong
2026-01-13 16:14 ` Christoph Hellwig
2026-01-13 19:01 ` Darrick J. Wong
2026-01-13 0:34 ` [PATCH 07/11] xfs: convey externally discovered fsdax media errors " Darrick J. Wong
2026-01-13 16:15 ` Christoph Hellwig
2026-01-13 0:34 ` [PATCH 08/11] xfs: convey file I/O " Darrick J. Wong
2026-01-13 16:15 ` Christoph Hellwig
2026-01-13 0:34 ` [PATCH 09/11] xfs: allow reconfiguration of the health monitoring device Darrick J. Wong
2026-01-13 16:17 ` Christoph Hellwig
2026-01-13 18:28 ` Darrick J. Wong
2026-01-13 0:35 ` [PATCH 10/11] xfs: check if an open file is on the health monitored fs Darrick J. Wong
2026-01-13 16:17 ` Christoph Hellwig
2026-01-13 0:35 ` [PATCH 11/11] xfs: add media verification ioctl Darrick J. Wong
2026-01-13 15:57 ` Christoph Hellwig [this message]
2026-01-13 23:21 ` Darrick J. Wong
2026-01-14 5:40 ` Darrick J. Wong
2026-01-14 6:02 ` Christoph Hellwig
2026-01-14 6:07 ` Darrick J. Wong
2026-01-14 6:15 ` Christoph Hellwig
2026-01-14 6:19 ` Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2026-01-16 5:42 [PATCHSET v6] xfs: autonomous self healing of filesystems Darrick J. Wong
2026-01-16 5:44 ` [PATCH 11/11] xfs: add media verification ioctl Darrick J. Wong
2026-01-19 15:56 ` Christoph Hellwig
2026-01-19 17:35 ` Darrick J. Wong
2026-01-21 6:34 [PATCHSET v7 1/3] xfs: autonomous self healing of filesystems Darrick J. Wong
2026-01-21 6:37 ` [PATCH 11/11] xfs: add media verification ioctl Darrick J. Wong
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=20260113155701.GA3489@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.