boot/zfs: fix gang block reading code
- use correct size (512) while reading a gang block - skip holes while reading child blocks - advance buffer pointer while reading child blocks PR: 144214 MFC after: 10 days
This commit is contained in:
parent
52d8ba372e
commit
7bdc66dab8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208610
@ -958,12 +958,17 @@ zio_read_gang(spa_t *spa, const blkptr_t *bp, const dva_t *dva, void *buf)
|
|||||||
break;
|
break;
|
||||||
if (!vdev || !vdev->v_read)
|
if (!vdev || !vdev->v_read)
|
||||||
return (EIO);
|
return (EIO);
|
||||||
if (vdev->v_read(vdev, bp, &zio_gb, offset, SPA_GANGBLOCKSIZE))
|
if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE))
|
||||||
return (EIO);
|
return (EIO);
|
||||||
|
|
||||||
for (i = 0; i < SPA_GBH_NBLKPTRS; i++) {
|
for (i = 0; i < SPA_GBH_NBLKPTRS; i++) {
|
||||||
if (zio_read(spa, &zio_gb.zg_blkptr[i], buf))
|
blkptr_t *gbp = &zio_gb.zg_blkptr[i];
|
||||||
|
|
||||||
|
if (BP_IS_HOLE(gbp))
|
||||||
|
continue;
|
||||||
|
if (zio_read(spa, gbp, buf))
|
||||||
return (EIO);
|
return (EIO);
|
||||||
|
buf = (char*)buf + BP_GET_PSIZE(gbp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
@ -994,9 +999,8 @@ zio_read(spa_t *spa, const blkptr_t *bp, void *buf)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (DVA_GET_GANG(dva)) {
|
if (DVA_GET_GANG(dva)) {
|
||||||
printf("ZFS: gang block detected!\n");
|
|
||||||
if (zio_read_gang(spa, bp, dva, buf))
|
if (zio_read_gang(spa, bp, dva, buf))
|
||||||
return (EIO);
|
continue;
|
||||||
} else {
|
} else {
|
||||||
vdevid = DVA_GET_VDEV(dva);
|
vdevid = DVA_GET_VDEV(dva);
|
||||||
offset = DVA_GET_OFFSET(dva);
|
offset = DVA_GET_OFFSET(dva);
|
||||||
|
Loading…
Reference in New Issue
Block a user