[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/8] hw/9pfs: Avoid unnecessary get_fid in v9fs_clun
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH 6/8] hw/9pfs: Avoid unnecessary get_fid in v9fs_clunk |
Date: |
Fri, 9 Sep 2011 16:24:11 +0530 |
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/9pfs/virtio-9p.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 2a68953..e51df2a 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -417,7 +417,7 @@ static void put_fid(V9fsState *s, V9fsFidState *fidp)
}
}
-static int clunk_fid(V9fsState *s, int32_t fid)
+static V9fsFidState *clunk_fid(V9fsState *s, int32_t fid)
{
V9fsFidState **fidpp, *fidp;
@@ -426,14 +426,13 @@ static int clunk_fid(V9fsState *s, int32_t fid)
break;
}
}
-
if (*fidpp == NULL) {
- return -ENOENT;
+ return NULL;
}
fidp = *fidpp;
*fidpp = fidp->next;
fidp->clunked = 1;
- return 0;
+ return fidp;
}
void v9fs_reclaim_fd(V9fsState *s)
@@ -1700,17 +1699,18 @@ static void v9fs_clunk(void *opaque)
pdu_unmarshal(pdu, offset, "d", &fid);
- fidp = get_fid(s, fid);
+ fidp = clunk_fid(s, fid);
if (fidp == NULL) {
err = -ENOENT;
goto out_nofid;
}
- err = clunk_fid(s, fidp->fid);
- if (err < 0) {
- goto out;
- }
+ /*
+ * Bump the ref so that put_fid will
+ * free the fid.
+ */
+ fidp->ref++;
err = offset;
-out:
+
put_fid(s, fidp);
out_nofid:
complete_pdu(s, pdu, err);
--
1.7.4.1
- [Qemu-devel] [PATCH] Implement file handle based fs driver, Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 1/8] hw/9pfs: Make v9fs_string* functions non-static, Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 4/8] hw/9pfs: Add init callback to fs driver, Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 2/8] hw/9pfs: Use read-write lock for protecting fid path., Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 5/8] hw/9pfs: Add fs driver specific details to fscontext, Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 6/8] hw/9pfs: Avoid unnecessary get_fid in v9fs_clunk,
Aneesh Kumar K.V <=
- [Qemu-devel] [PATCH 8/8] hw/9pfs: Add handle based fs driver, Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 7/8] hw/9pfs: Implement TFLUSH operation, Aneesh Kumar K.V, 2011/09/09
- [Qemu-devel] [PATCH 3/8] hw/9pfs: Move fid pathname tracking to seperate data type., Aneesh Kumar K.V, 2011/09/09