OSDN Git Service

9p: stat_to_qid: implement slow path
authorAntonios Motakis <antonios.motakis@huawei.com>
Mon, 7 Oct 2019 15:02:45 +0000 (17:02 +0200)
committerGreg Kurz <groug@kaod.org>
Thu, 10 Oct 2019 09:36:14 +0000 (11:36 +0200)
commitf3fe4a2d92bb4ee5b599b8b1eb781b2ae68af36c
tree18644ef2c8f83406ba6208976a76feb9af906166
parent1a6ed33cc56997479bbe5b48337ff8da44585bd4
9p: stat_to_qid: implement slow path

stat_to_qid attempts via qid_path_prefixmap to map unique files (which are
identified by 64 bit inode nr and 32 bit device id) to a 64 QID path value.
However this implementation makes some assumptions about inode number
generation on the host.

If qid_path_prefixmap fails, we still have 48 bits available in the QID
path to fall back to a less memory efficient full mapping.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[CS: - Rebased to https://github.com/gkurz/qemu/commits/9p-next
       (SHA1 7fc4c49e91).
     - Updated hash calls to new xxhash API.
     - Removed unnecessary parantheses in qpf_lookup_func().
     - Removed unnecessary g_malloc0() result checks.
     - Log error message when running out of prefixes in
       qid_path_fullmap().
     - Log warning message about potential degraded performance in
       qid_path_prefixmap().
     - Wrapped qpf_table initialization to dedicated qpf_table_init()
       function.
     - Fixed typo in comment. ]
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
hw/9pfs/9p.c
hw/9pfs/9p.h