]> git.proxmox.com Git - mirror_qemu.git/commit
9pfs: use GHashTable for fid table
authorLinus Heckemann <git@sphalerite.org>
Tue, 4 Oct 2022 10:41:21 +0000 (12:41 +0200)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Mon, 24 Oct 2022 10:24:32 +0000 (12:24 +0200)
commitf5265c8f917ea8c71a30e549b7e3017c1038db63
tree1fdd2198bf0db6fa66cc0b2671abb2335852f2ab
parent684f912034395a4958600a3ccca972db5d31be94
9pfs: use GHashTable for fid table

The previous implementation would iterate over the fid table for
lookup operations, resulting in an operation with O(n) complexity on
the number of open files and poor cache locality -- for every open,
stat, read, write, etc operation.

This change uses a hashtable for this instead, significantly improving
the performance of the 9p filesystem. The runtime of NixOS's simple
installer test, which copies ~122k files totalling ~1.8GiB from 9p,
decreased by a factor of about 10.

Signed-off-by: Linus Heckemann <git@sphalerite.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
[CS: - Retain BUG_ON(f->clunked) in get_fid().
     - Add TODO comment in clunk_fid(). ]
Message-Id: <20221004104121.713689-1-git@sphalerite.org>
[CS: - Drop unnecessary goto and out: label. ]
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
hw/9pfs/9p.c
hw/9pfs/9p.h