Skip to content

Commit 037b09f

Browse files
committed
zio: rework ZIO_FLAG_DIO_CHKSUM_ERR as a post-IO flag
Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
1 parent 8d3db7d commit 037b09f

File tree

7 files changed

+18
-25
lines changed

7 files changed

+18
-25
lines changed

include/sys/zio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ typedef uint64_t zio_flag_t;
226226
#define ZIO_FLAG_NOPWRITE (1ULL << 29)
227227
#define ZIO_FLAG_REEXECUTED (1ULL << 30)
228228
#define ZIO_FLAG_DELEGATED (1ULL << 31)
229-
#define ZIO_FLAG_DIO_CHKSUM_ERR (1ULL << 32)
230-
#define ZIO_FLAG_PREALLOCATED (1ULL << 33)
229+
#define ZIO_FLAG_PREALLOCATED (1ULL << 32)
231230

232231
#define ZIO_ALLOCATOR_NONE (-1)
233232
#define ZIO_HAS_ALLOCATOR(zio) ((zio)->io_allocator != ZIO_ALLOCATOR_NONE)
@@ -427,6 +426,7 @@ typedef zio_t *zio_pipe_stage_t(zio_t *zio);
427426
*/
428427
#define ZIO_POST_REEXECUTE (1 << 0)
429428
#define ZIO_POST_SUSPEND (1 << 1)
429+
#define ZIO_POST_DIO_CHKSUM_ERR (1 << 2)
430430

431431
/*
432432
* The io_trim flags are used to specify the type of TRIM to perform. They

module/zcommon/zfs_valstr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ _VALSTR_BITFIELD_IMPL(zio_flag,
221221
{ '.', "NP", "NOPWRITE" },
222222
{ '.', "EX", "REEXECUTED" },
223223
{ '.', "DG", "DELEGATED" },
224-
{ '.', "DC", "DIO_CHKSUM_ERR" },
225224
{ '.', "PA", "PREALLOCATED" },
226225
)
227226

module/zfs/dmu_direct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ dmu_write_direct_done(zio_t *zio)
104104
dmu_sync_done(zio, NULL, zio->io_private);
105105

106106
if (zio->io_error != 0) {
107-
if (zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)
107+
if (zio->io_post & ZIO_POST_DIO_CHKSUM_ERR)
108108
ASSERT3U(zio->io_error, ==, EIO);
109109

110110
/*

module/zfs/vdev_indirect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ vdev_indirect_io_done(zio_t *zio)
18421842
*/
18431843
if (zio->io_flags & ZIO_FLAG_DIO_READ && ret == ECKSUM) {
18441844
zio->io_error = ret;
1845-
zio->io_flags |= ZIO_FLAG_DIO_CHKSUM_ERR;
1845+
zio->io_post |= ZIO_POST_DIO_CHKSUM_ERR;
18461846
zio_dio_chksum_verify_error_report(zio);
18471847
ret = 0;
18481848
}

module/zfs/vdev_mirror.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ vdev_mirror_io_done(zio_t *zio)
779779
* being written out during self healing.
780780
*/
781781
if ((zio->io_flags & ZIO_FLAG_DIO_READ) &&
782-
(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)) {
782+
(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR)) {
783783
zio_dio_chksum_verify_error_report(zio);
784784
zio->io_error = vdev_mirror_worst_error(mm);
785785
ASSERT3U(zio->io_error, ==, ECKSUM);

module/zfs/vdev_raidz.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,7 @@ raidz_checksum_verify(zio_t *zio)
26912691
*/
26922692
if (zio->io_flags & ZIO_FLAG_DIO_READ && ret == ECKSUM) {
26932693
zio->io_error = ret;
2694-
zio->io_flags |= ZIO_FLAG_DIO_CHKSUM_ERR;
2694+
zio->io_post |= ZIO_POST_DIO_CHKSUM_ERR;
26952695
zio_dio_chksum_verify_error_report(zio);
26962696
zio_checksum_verified(zio);
26972697
return (0);
@@ -3048,7 +3048,7 @@ raidz_reconstruct(zio_t *zio, int *ltgts, int ntgts, int nparity)
30483048

30493049
/* Check for success */
30503050
if (raidz_checksum_verify(zio) == 0) {
3051-
if (zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)
3051+
if (zio->io_post & ZIO_POST_DIO_CHKSUM_ERR)
30523052
return (0);
30533053

30543054
/* Reconstruction succeeded - report errors */
@@ -3514,7 +3514,7 @@ vdev_raidz_io_done(zio_t *zio)
35143514
}
35153515

35163516
if (raidz_checksum_verify(zio) == 0) {
3517-
if (zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)
3517+
if (zio->io_post & ZIO_POST_DIO_CHKSUM_ERR)
35183518
goto done;
35193519

35203520
for (int i = 0; i < rm->rm_nrows; i++) {

module/zfs/zio.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -853,12 +853,6 @@ zio_notify_parent(zio_t *pio, zio_t *zio, enum zio_wait_type wait,
853853
pio->io_post |= zio->io_post;
854854
ASSERT3U(*countp, >, 0);
855855

856-
/*
857-
* Propogate the Direct I/O checksum verify failure to the parent.
858-
*/
859-
if (zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)
860-
pio->io_flags |= ZIO_FLAG_DIO_CHKSUM_ERR;
861-
862856
(*countp)--;
863857

864858
if (*countp == 0 && pio->io_stall == countp) {
@@ -1649,7 +1643,7 @@ zio_vdev_child_io(zio_t *pio, blkptr_t *bp, vdev_t *vd, uint64_t offset,
16491643
* through the mirror during self healing. See comment in
16501644
* vdev_mirror_io_done() for more details.
16511645
*/
1652-
ASSERT0(pio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR);
1646+
ASSERT0(pio->io_post & ZIO_POST_DIO_CHKSUM_ERR);
16531647
} else if (type == ZIO_TYPE_WRITE &&
16541648
pio->io_prop.zp_direct_write == B_TRUE) {
16551649
/*
@@ -4722,7 +4716,7 @@ zio_vdev_io_assess(zio_t *zio)
47224716
* If a Direct I/O operation has a checksum verify error then this I/O
47234717
* should not attempt to be issued again.
47244718
*/
4725-
if (zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR) {
4719+
if (zio->io_post & ZIO_POST_DIO_CHKSUM_ERR) {
47264720
if (zio->io_type == ZIO_TYPE_WRITE) {
47274721
ASSERT3U(zio->io_child_type, ==, ZIO_CHILD_LOGICAL);
47284722
ASSERT3U(zio->io_error, ==, EIO);
@@ -5031,7 +5025,7 @@ zio_checksum_verify(zio_t *zio)
50315025
ASSERT3U(zio->io_prop.zp_checksum, ==, ZIO_CHECKSUM_LABEL);
50325026
}
50335027

5034-
ASSERT0(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR);
5028+
ASSERT0(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR);
50355029
IMPLY(zio->io_flags & ZIO_FLAG_DIO_READ,
50365030
!(zio->io_flags & ZIO_FLAG_SPECULATIVE));
50375031

@@ -5040,7 +5034,7 @@ zio_checksum_verify(zio_t *zio)
50405034
if (error == ECKSUM &&
50415035
!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) {
50425036
if (zio->io_flags & ZIO_FLAG_DIO_READ) {
5043-
zio->io_flags |= ZIO_FLAG_DIO_CHKSUM_ERR;
5037+
zio->io_post |= ZIO_POST_DIO_CHKSUM_ERR;
50445038
zio_t *pio = zio_unique_parent(zio);
50455039
/*
50465040
* Any Direct I/O read that has a checksum
@@ -5090,7 +5084,7 @@ zio_dio_checksum_verify(zio_t *zio)
50905084
if ((error = zio_checksum_error(zio, NULL)) != 0) {
50915085
zio->io_error = error;
50925086
if (error == ECKSUM) {
5093-
zio->io_flags |= ZIO_FLAG_DIO_CHKSUM_ERR;
5087+
zio->io_post |= ZIO_POST_DIO_CHKSUM_ERR;
50945088
zio_dio_chksum_verify_error_report(zio);
50955089
}
50965090
}
@@ -5115,7 +5109,7 @@ zio_checksum_verified(zio_t *zio)
51155109
void
51165110
zio_dio_chksum_verify_error_report(zio_t *zio)
51175111
{
5118-
ASSERT(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR);
5112+
ASSERT(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR);
51195113

51205114
if (zio->io_child_type == ZIO_CHILD_LOGICAL)
51215115
return;
@@ -5431,7 +5425,7 @@ zio_done(zio_t *zio)
54315425
*/
54325426
if (zio->io_error != ECKSUM && zio->io_vd != NULL &&
54335427
!vdev_is_dead(zio->io_vd) &&
5434-
!(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)) {
5428+
!(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR)) {
54355429
int ret = zfs_ereport_post(FM_EREPORT_ZFS_IO,
54365430
zio->io_spa, zio->io_vd, &zio->io_bookmark, zio, 0);
54375431
if (ret != EALREADY) {
@@ -5446,7 +5440,7 @@ zio_done(zio_t *zio)
54465440

54475441
if ((zio->io_error == EIO || !(zio->io_flags &
54485442
(ZIO_FLAG_SPECULATIVE | ZIO_FLAG_DONT_PROPAGATE))) &&
5449-
!(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR) &&
5443+
!(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR) &&
54505444
zio == zio->io_logical) {
54515445
/*
54525446
* For logical I/O requests, tell the SPA to log the
@@ -5479,7 +5473,7 @@ zio_done(zio_t *zio)
54795473

54805474
if (IO_IS_ALLOCATING(zio) &&
54815475
!(zio->io_flags & ZIO_FLAG_CANFAIL) &&
5482-
!(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR)) {
5476+
!(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR)) {
54835477
if (zio->io_error != ENOSPC)
54845478
zio->io_post |= ZIO_POST_REEXECUTE;
54855479
else
@@ -5536,7 +5530,7 @@ zio_done(zio_t *zio)
55365530
* should not attempt to reexecute. Instead, the error should
55375531
* just be propagated back.
55385532
*/
5539-
ASSERT(!(zio->io_flags & ZIO_FLAG_DIO_CHKSUM_ERR));
5533+
ASSERT0(zio->io_post & ZIO_POST_DIO_CHKSUM_ERR);
55405534

55415535
/*
55425536
* This is a logical I/O that wants to reexecute.

0 commit comments

Comments
 (0)