mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 03:11:11 -04:00
xfs: cleanup buftarg handling in XFS_IOC_VERIFY_MEDIA
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> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
committed by
Carlos Maiolino
parent
268378b6ad
commit
0c98524ab2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user