ahrens commented on this pull request.


> @@ -226,17 +226,26 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t 
> nblks, boolean_t fetch_data)
 
        for (zs = list_head(&zf->zf_stream); zs != NULL;
            zs = list_next(&zf->zf_stream, zs)) {
-               if (blkid == zs->zs_blkid) {
+               if (blkid == zs->zs_blkid || blkid + 1 == zs->zs_blkid) {

Please add a comment explaining that this is handling misaligned streams, where 
each access overlaps the previous access by exactly one block.  You might say 
something like, "If the first or second block of this access matches the 
expected next block in this stream, count it as part of this stream.  We count 
the second block as a match to handle the case of misaligned accesses, where 
each subsequent access is byte-wise adjacent, but block-wise overlaps by 
exactly one block."

It might be easier to understand (and simpler code) if we made this check:
`blkid == zs_blkd || (nblks > 1 && blkid + 1 == zs_blkid)`
And then below. i.e. starting at line 235 it could be:
```
if (blkid == zs_blkd)
  break;
if (nblks > 1 && blkid + 1 == zs_blkid) {
  blkid++;
  nblks--;
  break;
}
mutex_exit(zs_lock);
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/497#pullrequestreview-80264709
------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T7851c2386c192095-Mfac30bf61e2b90767520167b
Powered by Topicbox: https://topicbox.com

Reply via email to