diff options
author | Antonios Motakis <antonios.motakis@huawei.com> | 2019-10-07 17:02:45 +0200 |
---|---|---|
committer | Greg Kurz <groug@kaod.org> | 2019-10-10 11:36:14 +0200 |
commit | f3fe4a2d92bb4ee5b599b8b1eb781b2ae68af36c (patch) | |
tree | 18644ef2c8f83406ba6208976a76feb9af906166 /hw/9pfs/9p.h | |
parent | 1a6ed33cc56997479bbe5b48337ff8da44585bd4 (diff) |
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>
Diffstat (limited to 'hw/9pfs/9p.h')
-rw-r--r-- | hw/9pfs/9p.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 7262fe80aa..35a362c0d7 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -245,6 +245,13 @@ typedef struct { uint16_t qp_prefix; } QppEntry; +/* QID path full entry, as above */ +typedef struct { + dev_t dev; + ino_t ino; + uint64_t path; +} QpfEntry; + struct V9fsState { QLIST_HEAD(, V9fsPDU) free_list; @@ -268,7 +275,9 @@ struct V9fsState V9fsQID root_qid; dev_t dev_id; struct qht qpp_table; + struct qht qpf_table; uint16_t qp_prefix_next; + uint64_t qp_fullpath_next; }; /* 9p2000.L open flags */ |