mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 02:34:14 +03:00
Code cleanups
- Allocate ve_search on the stack, so we avoid allocating memory for every I/O even if the VDEV cache is disabled. - Reduce lock scope. - Avoid locking in vdev_cache_read() when the VDEV cache is disabled. - Sort file names properly. - Correct comment. Reviewed-by: Allan Jude <allan@klarasystems.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net> Closes #12749
This commit is contained in:
committed by
GitHub
parent
cfc62062ae
commit
547df81641
@@ -251,13 +251,16 @@ boolean_t
|
||||
vdev_cache_read(zio_t *zio)
|
||||
{
|
||||
vdev_cache_t *vc = &zio->io_vd->vdev_cache;
|
||||
vdev_cache_entry_t *ve, *ve_search;
|
||||
vdev_cache_entry_t *ve, ve_search;
|
||||
uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS);
|
||||
zio_t *fio;
|
||||
uint64_t cache_phase __maybe_unused = P2PHASE(zio->io_offset, VCBS);
|
||||
|
||||
ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ);
|
||||
|
||||
if (zfs_vdev_cache_size == 0)
|
||||
return (B_FALSE);
|
||||
|
||||
if (zio->io_flags & ZIO_FLAG_DONT_CACHE)
|
||||
return (B_FALSE);
|
||||
|
||||
@@ -274,10 +277,8 @@ vdev_cache_read(zio_t *zio)
|
||||
|
||||
mutex_enter(&vc->vc_lock);
|
||||
|
||||
ve_search = kmem_alloc(sizeof (vdev_cache_entry_t), KM_SLEEP);
|
||||
ve_search->ve_offset = cache_offset;
|
||||
ve = avl_find(&vc->vc_offset_tree, ve_search, NULL);
|
||||
kmem_free(ve_search, sizeof (vdev_cache_entry_t));
|
||||
ve_search.ve_offset = cache_offset;
|
||||
ve = avl_find(&vc->vc_offset_tree, &ve_search, NULL);
|
||||
|
||||
if (ve != NULL) {
|
||||
if (ve->ve_missed_update) {
|
||||
|
||||
Reference in New Issue
Block a user