From 48669030fe42e5bdcab8e129c6521cf8423bd57f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 2 Aug 2010 13:56:27 -0700 Subject: [PATCH] Reduce stack in vdev_cache_read Moving the vdev_cache_entry_t struct ve_search from the stack to the heap saves ~100 bytes. --- .topdeps | 1 + .topmsg | 7 +++++++ module/zfs/vdev_cache.c | 8 +++++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..1f7391f92b --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..b848e77746 --- /dev/null +++ b/.topmsg @@ -0,0 +1,7 @@ +From: Brian Behlendorf +Subject: [PATCH] fix stack vdev_cache_read + +Moving the vdev_cache_entry_t struct ve_search from the stack to +the heap saves ~100 bytes. + +Signed-off-by: Brian Behlendorf diff --git a/module/zfs/vdev_cache.c b/module/zfs/vdev_cache.c index 688d541344..b8d19a146f 100644 --- a/module/zfs/vdev_cache.c +++ b/module/zfs/vdev_cache.c @@ -244,7 +244,7 @@ int 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); uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS); zio_t *fio; @@ -267,8 +267,10 @@ vdev_cache_read(zio_t *zio) mutex_enter(&vc->vc_lock); - ve_search.ve_offset = cache_offset; - ve = avl_find(&vc->vc_offset_tree, &ve_search, NULL); + 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)); if (ve != NULL) { if (ve->ve_missed_update) {