{"action":"created","issue":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4388","repository_url":"https://api.github.com/repos/zfsonlinux/zfs","labels_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4388/labels{/name}","comments_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4388/comments","events_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4388/events","html_url":"https://github.com/zfsonlinux/zfs/issues/4388","id":138068776,"number":4388,"title":"Prefetching data doesn't appear to be working.","user":{"login":"evolarium","id":5010373,"avatar_url":"https://avatars.githubusercontent.com/u/5010373?v=3","gravatar_id":"","url":"https://api.github.com/users/evolarium","html_url":"https://github.com/evolarium","followers_url":"https://api.github.com/users/evolarium/followers","following_url":"https://api.github.com/users/evolarium/following{/other_user}","gists_url":"https://api.github.com/users/evolarium/gists{/gist_id}","starred_url":"https://api.github.com/users/evolarium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evolarium/subscriptions","organizations_url":"https://api.github.com/users/evolarium/orgs","repos_url":"https://api.github.com/users/evolarium/repos","events_url":"https://api.github.com/users/evolarium/events{/privacy}","received_events_url":"https://api.github.com/users/evolarium/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-03-03T03:57:39Z","updated_at":"2016-03-03T22:11:22Z","closed_at":null,"body":"I have two systems that are running on the current master.  On both I am getting slow read speeds.  One has a mirrored pool, the other has a raidz1.  The counters for prefetch are at zero:\r\n\r\narcstats: demand_hit_predictive_prefetch\r\nzfetchstats: hits\r\n\r\nI have a third system that was last updated in December, which is working fine.  I assume the issue is related to the prefetch changes committed in January.\r\n\r\n7f60329a261bd48558a498fb10e9b29638eab33b"},"comment":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/comments/191989527","html_url":"https://github.com/zfsonlinux/zfs/issues/4388#issuecomment-191989527","issue_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/4388","id":191989527,"user":{"login":"rottegift","id":6392971,"avatar_url":"https://avatars.githubusercontent.com/u/6392971?v=3","gravatar_id":"","url":"https://api.github.com/users/rottegift","html_url":"https://github.com/rottegift","followers_url":"https://api.github.com/users/rottegift/followers","following_url":"https://api.github.com/users/rottegift/following{/other_user}","gists_url":"https://api.github.com/users/rottegift/gists{/gist_id}","starred_url":"https://api.github.com/users/rottegift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rottegift/subscriptions","organizations_url":"https://api.github.com/users/rottegift/orgs","repos_url":"https://api.github.com/users/rottegift/repos","events_url":"https://api.github.com/users/rottegift/events{/privacy}","received_events_url":"https://api.github.com/users/rottegift/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T22:11:22Z","updated_at":"2016-03-03T22:11:22Z","body":"You could do something like this, which @lundman and I arrived at in \nmid-October.   If tryupgrade fails (with O3X's spl it always does), drop \nthe rwlock and reacquire it.\n\n```\n         if (zs == NULL) {\n                 /*\n                  * This access is not part of any existing stream.  Create\n                  * a new stream for it.\n                  */\n                 ZFETCHSTAT_BUMP(zfetchstat_misses);\n                 if (rw_tryupgrade(&zf->zf_rwlock)) {\n                         dmu_zfetch_stream_create(zf, blkid + nblks);\n                 } else {\n                   rw_exit(&zf->zf_rwlock);\n                   rw_enter(&zf->zf_rwlock, RW_WRITER);\n                   dmu_zfetch_stream_create(zf, blkid + nblks);\n                 }\n                 rw_exit(&zf->zf_rwlock);\n                 return;\n         }\n```\n"}}