From: Christoph Hellwig <hch@lst.de>
To: cem@kernel.org
Cc: djwong@kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH] xfs: cleanup buftarg handling in XFS_IOC_VERIFY_MEDIA
Date: Mon, 16 Mar 2026 16:35:29 +0100 [thread overview]
Message-ID: <20260316153533.1580167-1-hch@lst.de> (raw)
The newly added XFS_IOC_VERIFY_MEDIA is a bit unusual in how it handles
buftarg fields. Update it to be more in line with other XFS code:
- use btp->bt_dev instead of btp->bt_bdev->bd_dev to retrieve the device
number for tracing
- use btp->bt_logical_sectorsize instead of
bdev_logical_block_size(btp->bt_bdev) to retrieve the logical sector
size
- compare the buftarg and not the bdev to see if there is a separate
log buftarg
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_verify_media.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/fs/xfs/xfs_verify_media.c b/fs/xfs/xfs_verify_media.c
index 8bbd4ec567f8..5ead3976d511 100644
--- a/fs/xfs/xfs_verify_media.c
+++ b/fs/xfs/xfs_verify_media.c
@@ -183,10 +183,9 @@ xfs_verify_iosize(
min_not_zero(SZ_1M, me->me_max_io_size);
BUILD_BUG_ON(BBSHIFT != SECTOR_SHIFT);
- ASSERT(BBTOB(bbcount) >= bdev_logical_block_size(btp->bt_bdev));
+ ASSERT(BBTOB(bbcount) >= btp->bt_logical_sectorsize);
- return clamp(iosize, bdev_logical_block_size(btp->bt_bdev),
- BBTOB(bbcount));
+ return clamp(iosize, btp->bt_logical_sectorsize, BBTOB(bbcount));
}
/* Allocate as much memory as we can get for verification buffer. */
@@ -218,8 +217,8 @@ xfs_verify_media_error(
unsigned int bio_bbcount,
blk_status_t bio_status)
{
- trace_xfs_verify_media_error(mp, me, btp->bt_bdev->bd_dev, daddr,
- bio_bbcount, bio_status);
+ trace_xfs_verify_media_error(mp, me, btp->bt_dev, daddr, bio_bbcount,
+ bio_status);
/*
* Pass any error, I/O or otherwise, up to the caller if we didn't
@@ -280,7 +279,7 @@ xfs_verify_media(
btp = mp->m_ddev_targp;
break;
case XFS_DEV_LOG:
- if (mp->m_logdev_targp->bt_bdev != mp->m_ddev_targp->bt_bdev)
+ if (mp->m_logdev_targp != mp->m_ddev_targp)
btp = mp->m_logdev_targp;
break;
case XFS_DEV_RT:
@@ -299,7 +298,7 @@ xfs_verify_media(
/* start and end have to be aligned to the lba size */
if (!IS_ALIGNED(BBTOB(me->me_start_daddr | me->me_end_daddr),
- bdev_logical_block_size(btp->bt_bdev)))
+ btp->bt_logical_sectorsize))
return -EINVAL;
/*
@@ -331,8 +330,7 @@ xfs_verify_media(
if (!folio)
return -ENOMEM;
- trace_xfs_verify_media(mp, me, btp->bt_bdev->bd_dev, daddr, bbcount,
- folio);
+ trace_xfs_verify_media(mp, me, btp->bt_dev, daddr, bbcount, folio);
bio = bio_alloc(btp->bt_bdev, 1, REQ_OP_READ, GFP_KERNEL);
if (!bio) {
@@ -400,7 +398,7 @@ xfs_verify_media(
* an operational error.
*/
me->me_start_daddr = daddr;
- trace_xfs_verify_media_end(mp, me, btp->bt_bdev->bd_dev);
+ trace_xfs_verify_media_end(mp, me, btp->bt_dev);
return 0;
}
--
2.47.3
next reply other threads:[~2026-03-16 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 15:35 Christoph Hellwig [this message]
2026-03-16 16:16 ` [PATCH] xfs: cleanup buftarg handling in XFS_IOC_VERIFY_MEDIA Darrick J. Wong
2026-03-18 10:12 ` Carlos Maiolino
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=20260316153533.1580167-1-hch@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--cc=djwong@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox