[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 6/8] 9pfs: replace not_same_qid() by same_stat_id()
From: |
Christian Schoenebeck |
Subject: |
[PULL 6/8] 9pfs: replace not_same_qid() by same_stat_id() |
Date: |
Mon, 05 Jul 2021 13:13:51 +0200 |
As we are actually only comparing the filesystem ID (i.e. device number
and inode number pair) let's use the POSIX stat buffer instead of QIDs,
because resolving QIDs requires to be done on 9p server's main thread
only as it might mutate the server state if inode remapping is enabled.
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id:
<26aa465ff9cc9c07e053331554a02fdae3994417.1622821729.git.qemu_oss@crudebyte.com>
---
hw/9pfs/9p.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 0e3857798d..47b000d3a9 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1696,9 +1696,9 @@ static bool name_is_illegal(const char *name)
return !*name || strchr(name, '/') != NULL;
}
-static bool not_same_qid(const V9fsQID *qid1, const V9fsQID *qid2)
+static bool same_stat_id(const struct stat *a, const struct stat *b)
{
- return qid1->path != qid2->path;
+ return a->st_dev == b->st_dev && a->st_ino == b->st_ino;
}
static void coroutine_fn v9fs_walk(void *opaque)
@@ -1771,7 +1771,7 @@ static void coroutine_fn v9fs_walk(void *opaque)
v9fs_path_copy(&dpath, &fidp->path);
v9fs_path_copy(&path, &fidp->path);
for (name_idx = 0; name_idx < nwnames; name_idx++) {
- if (not_same_qid(&pdu->s->root_qid, &qid) ||
+ if (!same_stat_id(&pdu->s->root_st, &stbuf) ||
strcmp("..", wnames[name_idx].data)) {
err = v9fs_co_name_to_path(pdu, &dpath, wnames[name_idx].data,
&path);
--
2.20.1
- [PULL 0/8] 9p queue 2021-07-05, Christian Schoenebeck, 2021/07/05
- [PULL 5/8] 9pfs: drop fid_to_qid(), Christian Schoenebeck, 2021/07/05
- [PULL 3/8] 9pfs: fix not_same_qid(), Christian Schoenebeck, 2021/07/05
- [PULL 8/8] 9pfs: reduce latency of Twalk, Christian Schoenebeck, 2021/07/05
- [PULL 6/8] 9pfs: replace not_same_qid() by same_stat_id(),
Christian Schoenebeck <=
- [PULL 2/8] 9pfs: simplify v9fs_walk(), Christian Schoenebeck, 2021/07/05
- [PULL 7/8] 9pfs: drop root_qid, Christian Schoenebeck, 2021/07/05
- [PULL 4/8] 9pfs: capture root stat, Christian Schoenebeck, 2021/07/05
- [PULL 1/8] 9pfs: add link to 9p developer docs, Christian Schoenebeck, 2021/07/05
- Re: [PULL 0/8] 9p queue 2021-07-05, Peter Maydell, 2021/07/05
- Re: [PULL 0/8] 9p queue 2021-07-05, Peter Maydell, 2021/07/05