[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/7] 9pfs: drop fid_to_qid()
From: |
Christian Schoenebeck |
Subject: |
[PATCH v2 4/7] 9pfs: drop fid_to_qid() |
Date: |
Fri, 4 Jun 2021 17:13:17 +0200 |
There is only one user of fid_to_qid() which is v9fs_walk(). Let's
open-code fid_to_qid() directly within v9fs_walk(), because
fid_to_qid() hides the POSIX stat buffer which we are going to need
in the subsequent patch.
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
hw/9pfs/9p.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index eb15ec2082..0e3857798d 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -971,23 +971,6 @@ static int stat_to_qid(V9fsPDU *pdu, const struct stat
*stbuf, V9fsQID *qidp)
return 0;
}
-static int coroutine_fn fid_to_qid(V9fsPDU *pdu, V9fsFidState *fidp,
- V9fsQID *qidp)
-{
- struct stat stbuf;
- int err;
-
- err = v9fs_co_lstat(pdu, &fidp->path, &stbuf);
- if (err < 0) {
- return err;
- }
- err = stat_to_qid(pdu, &stbuf, qidp);
- if (err < 0) {
- return err;
- }
- return 0;
-}
-
V9fsPDU *pdu_alloc(V9fsState *s)
{
V9fsPDU *pdu = NULL;
@@ -1772,7 +1755,11 @@ static void coroutine_fn v9fs_walk(void *opaque)
v9fs_path_init(&dpath);
v9fs_path_init(&path);
- err = fid_to_qid(pdu, fidp, &qid);
+ err = v9fs_co_lstat(pdu, &fidp->path, &stbuf);
+ if (err < 0) {
+ goto out;
+ }
+ err = stat_to_qid(pdu, &stbuf, &qid);
if (err < 0) {
goto out;
}
--
2.20.1
- [PATCH v2 0/7] 9pfs: Twalk optimization, Christian Schoenebeck, 2021/06/04
- Re: [PATCH v2 0/7] 9pfs: Twalk optimization, Greg Kurz, 2021/06/04
- [PATCH v2 2/7] 9pfs: Twalk benchmark, Christian Schoenebeck, 2021/06/04
- [PATCH v2 6/7] 9pfs: drop root_qid, Christian Schoenebeck, 2021/06/04
- [PATCH v2 4/7] 9pfs: drop fid_to_qid(),
Christian Schoenebeck <=
- [PATCH v2 3/7] 9pfs: capture root stat, Christian Schoenebeck, 2021/06/04
- [PATCH v2 7/7] 9pfs: reduce latency of Twalk, Christian Schoenebeck, 2021/06/04
- [PATCH v2 1/7] 9pfs: fix not_same_qid(), Christian Schoenebeck, 2021/06/04
- [PATCH v2 5/7] 9pfs: replace not_same_qid() by same_stat_id(), Christian Schoenebeck, 2021/06/04