ZFS traverse_visitbp optimization to limit prefetch

Traversal code, traverse_visitbp() does visit blocks recursively.
Indirect (Non L0) Block of size 128k could contain, 1024 block pointers
of 128 bytes. In case of full traverse OR incremental traverse, where
all blocks were modified, it could traverse large number of blocks
pointed by indirect. Traversal code does issue prefetch of blocks
traversed below indirect. This could result into large number of
async reads queued on vdev queue. So, account for prefetch issued for
blocks pointed by indirect and limit max prefetch in one go.

Module Param:
zfs_traverse_indirect_prefetch_limit: Limit of prefetch while traversing
an indirect block.

Local counters:
prefetched: Local counter to account for number prefetch done.
pidx: Index for which next prefetch to be issued.
ptidx: Index at which next prefetch to be triggered.

Keep "ptidx" somewhere in the middle of blocks prefetched, so that
blocks prefetch read gets the enough time window before their demand
read is issued.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Jitendra Patidar <jitendra.patidar@nutanix.com>
Closes #11802 
Closes #11803
This commit is contained in:
Jitendra Patidar
2021-04-16 02:19:27 +05:30
committed by Brian Behlendorf
parent 15d3470c2e
commit 4c925936e3
2 changed files with 66 additions and 14 deletions
+13
View File
@@ -2909,6 +2909,19 @@ The number of bytes which should be prefetched during a pool traversal
Default value: \fB52,428,800\fR.
.RE
.sp
.ne 2
.na
\fBzfs_traverse_indirect_prefetch_limit\fR (int)
.ad
.RS 12n
The number of blocks pointed by indirect (non-L0) block, which should be
prefetched during a pool traversal (eg: \fBzfs send\fR or other data
crawling operations)
.sp
Default value: \fB32\fR.
.RE
.sp
.ne 2
.na