Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christoph Hellwig and committed by
Carlos Maiolino
0c98524a 268378b6

+8 -10
+8 -10
fs/xfs/xfs_verify_media.c
··· 183 183 min_not_zero(SZ_1M, me->me_max_io_size); 184 184 185 185 BUILD_BUG_ON(BBSHIFT != SECTOR_SHIFT); 186 - ASSERT(BBTOB(bbcount) >= bdev_logical_block_size(btp->bt_bdev)); 186 + ASSERT(BBTOB(bbcount) >= btp->bt_logical_sectorsize); 187 187 188 - return clamp(iosize, bdev_logical_block_size(btp->bt_bdev), 189 - BBTOB(bbcount)); 188 + return clamp(iosize, btp->bt_logical_sectorsize, BBTOB(bbcount)); 190 189 } 191 190 192 191 /* Allocate as much memory as we can get for verification buffer. */ ··· 217 218 unsigned int bio_bbcount, 218 219 blk_status_t bio_status) 219 220 { 220 - trace_xfs_verify_media_error(mp, me, btp->bt_bdev->bd_dev, daddr, 221 - bio_bbcount, bio_status); 221 + trace_xfs_verify_media_error(mp, me, btp->bt_dev, daddr, bio_bbcount, 222 + bio_status); 222 223 223 224 /* 224 225 * Pass any error, I/O or otherwise, up to the caller if we didn't ··· 279 280 btp = mp->m_ddev_targp; 280 281 break; 281 282 case XFS_DEV_LOG: 282 - if (mp->m_logdev_targp->bt_bdev != mp->m_ddev_targp->bt_bdev) 283 + if (mp->m_logdev_targp != mp->m_ddev_targp) 283 284 btp = mp->m_logdev_targp; 284 285 break; 285 286 case XFS_DEV_RT: ··· 298 299 299 300 /* start and end have to be aligned to the lba size */ 300 301 if (!IS_ALIGNED(BBTOB(me->me_start_daddr | me->me_end_daddr), 301 - bdev_logical_block_size(btp->bt_bdev))) 302 + btp->bt_logical_sectorsize)) 302 303 return -EINVAL; 303 304 304 305 /* ··· 330 331 if (!folio) 331 332 return -ENOMEM; 332 333 333 - trace_xfs_verify_media(mp, me, btp->bt_bdev->bd_dev, daddr, bbcount, 334 - folio); 334 + trace_xfs_verify_media(mp, me, btp->bt_dev, daddr, bbcount, folio); 335 335 336 336 bio = bio_alloc(btp->bt_bdev, 1, REQ_OP_READ, GFP_KERNEL); 337 337 if (!bio) { ··· 398 400 * an operational error. 399 401 */ 400 402 me->me_start_daddr = daddr; 401 - trace_xfs_verify_media_end(mp, me, btp->bt_bdev->bd_dev); 403 + trace_xfs_verify_media_end(mp, me, btp->bt_dev); 402 404 return 0; 403 405 } 404 406