Don't bottleneck on acquiring the stream locks - this avoids a massive

drop off in throughput with large numbers of simultaneous reads

MFC after:	7 days
This commit is contained in:
Kip Macy 2010-03-13 21:41:52 +00:00
parent cab8420673
commit 181c6ae3f0

View File

@ -49,11 +49,11 @@ uint32_t zfetch_block_cap = 256;
uint64_t zfetch_array_rd_sz = 1024 * 1024;
SYSCTL_DECL(_vfs_zfs);
SYSCTL_INT(_vfs_zfs, OID_AUTO, prefetch_disable, CTLFLAG_RDTUN,
SYSCTL_INT(_vfs_zfs, OID_AUTO, prefetch_disable, CTLFLAG_RW,
&zfs_prefetch_disable, 0, "Disable prefetch");
SYSCTL_NODE(_vfs_zfs, OID_AUTO, zfetch, CTLFLAG_RW, 0, "ZFS ZFETCH");
TUNABLE_INT("vfs.zfs.zfetch.max_streams", &zfetch_max_streams);
SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RDTUN,
SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RW,
&zfetch_max_streams, 0, "Max # of streams per zfetch");
TUNABLE_INT("vfs.zfs.zfetch.min_sec_reap", &zfetch_min_sec_reap);
SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RDTUN,
@ -338,8 +338,10 @@ dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched)
reset = !prefetched && zs->zst_len > 1;
mutex_enter(&zs->zst_lock);
if (mutex_tryenter(&zs->zst_lock) == 0) {
rc = 1;
goto out;
}
if (zh->zst_offset != zs->zst_offset + zs->zst_len) {
mutex_exit(&zs->zst_lock);
goto top;
@ -363,8 +365,10 @@ dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched)
reset = !prefetched && zs->zst_len > 1;
mutex_enter(&zs->zst_lock);
if (mutex_tryenter(&zs->zst_lock) == 0) {
rc = 1;
goto out;
}
if (zh->zst_offset != zs->zst_offset - zh->zst_len) {
mutex_exit(&zs->zst_lock);
goto top;
@ -391,8 +395,10 @@ dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched)
zs->zst_len) && (zs->zst_len != zs->zst_stride)) {
/* strided forward access */
mutex_enter(&zs->zst_lock);
if (mutex_tryenter(&zs->zst_lock) == 0) {
rc = 1;
goto out;
}
if ((zh->zst_offset - zs->zst_offset - zs->zst_stride >=
zs->zst_len) || (zs->zst_len == zs->zst_stride)) {
mutex_exit(&zs->zst_lock);
@ -408,8 +414,10 @@ dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched)
zs->zst_len) && (zs->zst_len != zs->zst_stride)) {
/* strided reverse access */
mutex_enter(&zs->zst_lock);
if (mutex_tryenter(&zs->zst_lock) == 0) {
rc = 1;
goto out;
}
if ((zh->zst_offset - zs->zst_offset + zs->zst_stride >=
zs->zst_len) || (zs->zst_len == zs->zst_stride)) {
mutex_exit(&zs->zst_lock);