[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 080/108] virtiofsd: add helper for lo_data cleanup
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 080/108] virtiofsd: add helper for lo_data cleanup |
Date: |
Thu, 23 Jan 2020 16:46:02 +0000 |
From: Liu Bo <address@hidden>
This offers an helper function for lo_data's cleanup.
Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
tools/virtiofsd/passthrough_ll.c | 37 ++++++++++++++++++--------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index 056ebe8556..e8dc5c7320 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -2407,6 +2407,26 @@ static gboolean lo_key_equal(gconstpointer a,
gconstpointer b)
return la->ino == lb->ino && la->dev == lb->dev;
}
+static void fuse_lo_data_cleanup(struct lo_data *lo)
+{
+ if (lo->inodes) {
+ g_hash_table_destroy(lo->inodes);
+ }
+ lo_map_destroy(&lo->fd_map);
+ lo_map_destroy(&lo->dirp_map);
+ lo_map_destroy(&lo->ino_map);
+
+ if (lo->proc_self_fd >= 0) {
+ close(lo->proc_self_fd);
+ }
+
+ if (lo->root.fd >= 0) {
+ close(lo->root.fd);
+ }
+
+ free(lo->source);
+}
+
int main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -2554,22 +2574,7 @@ err_out2:
err_out1:
fuse_opt_free_args(&args);
- if (lo.inodes) {
- g_hash_table_destroy(lo.inodes);
- }
- lo_map_destroy(&lo.fd_map);
- lo_map_destroy(&lo.dirp_map);
- lo_map_destroy(&lo.ino_map);
-
- if (lo.proc_self_fd >= 0) {
- close(lo.proc_self_fd);
- }
-
- if (lo.root.fd >= 0) {
- close(lo.root.fd);
- }
-
- free(lo.source);
+ fuse_lo_data_cleanup(&lo);
return ret ? 1 : 0;
}
--
2.24.1
- [PULL 068/108] virtiofsd: passthrough_ll: disable readdirplus on cache=never, (continued)
- [PULL 068/108] virtiofsd: passthrough_ll: disable readdirplus on cache=never, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 070/108] virtiofsd: rename unref_inode() to unref_inode_lolocked(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 072/108] virtiofsd: extract root inode init into setup_root(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 073/108] virtiofsd: passthrough_ll: clean up cache related options, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 071/108] virtiofsd: fail when parent inode isn't known in lo_do_lookup(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 069/108] virtiofsd: passthrough_ll: control readdirplus, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 075/108] virtiofsd: Clean up inodes on destroy, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 074/108] virtiofsd: passthrough_ll: use hashtable, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 077/108] virtiofsd: fix error handling in main(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 076/108] virtiofsd: support nanosecond resolution for file timestamp, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 080/108] virtiofsd: add helper for lo_data cleanup,
Dr. David Alan Gilbert (git) <=
- [PULL 078/108] virtiofsd: cleanup allocated resource in se, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 079/108] virtiofsd: fix memory leak on lo.source, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 081/108] virtiofsd: Prevent multiply running with same vhost_user_socket, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 082/108] virtiofsd: enable PARALLEL_DIROPS during INIT, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 083/108] virtiofsd: fix incorrect error handling in lo_do_lookup, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 084/108] Virtiofsd: fix memory leak on fuse queueinfo, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 086/108] virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 085/108] virtiofsd: Support remote posix locks, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 088/108] virtiofsd: make lo_release() atomic, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 087/108] virtiofsd: prevent fv_queue_thread() vs virtio_loop() races, Dr. David Alan Gilbert (git), 2020/01/23