aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/arc.c
diff options
context:
space:
mode:
authorChristian Schwarz <[email protected]>2022-08-09 01:55:13 +0200
committerGitHub <[email protected]>2022-08-08 16:55:13 -0700
commit91983265b62cf060f9d68544edc901ba4297e67a (patch)
tree96572871296813d7763f293c20073ba449574ce3 /module/zfs/arc.c
parentad0967638b834390fd8a9d0a12c10270353d771b (diff)
Add comment on acb_zio_dummy
Thanks to George Wilson for clarifying this on Slack. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Christian Schwarz <[email protected]> Closes #13698
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r--module/zfs/arc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 8f6ca1a28..579e78bef 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -6032,6 +6032,23 @@ top:
ARC_FLAG_PREDICTIVE_PREFETCH);
}
+ /*
+ * If there are multiple threads reading the same block
+ * and that block is not yet in the ARC, then only one
+ * thread will do the physical I/O and all other
+ * threads will wait until that I/O completes.
+ * Synchronous reads use the b_cv whereas nowait reads
+ * register a callback. Both are signalled/called in
+ * arc_read_done.
+ *
+ * Errors of the physical I/O may need to be propagated
+ * to the pio. For synchronous reads, we simply restart
+ * this function and it will reassess. Nowait reads
+ * attach the acb_zio_dummy zio to pio and
+ * arc_read_done propagates the physical I/O's io_error
+ * to acb_zio_dummy, and thereby to pio.
+ */
+
if (*arc_flags & ARC_FLAG_WAIT) {
cv_wait(&hdr->b_l1hdr.b_cv, hash_lock);
mutex_exit(hash_lock);