|
|
b7337d |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
b7337d |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
b7337d |
Date: Thu, 14 Jan 2021 20:20:26 -0600
|
|
|
b7337d |
Subject: [PATCH] multipathd: combine free_io_err_stat_path and
|
|
|
b7337d |
destroy_directio_ctx
|
|
|
b7337d |
|
|
|
b7337d |
destroy_directio_ctx() is only called from free_io_err_stat_path(), and
|
|
|
b7337d |
free_io_err_stat_path() is very short, so combine them.
|
|
|
b7337d |
|
|
|
b7337d |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
b7337d |
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
|
b7337d |
---
|
|
|
b7337d |
libmultipath/io_err_stat.c | 24 ++++++++++--------------
|
|
|
b7337d |
1 file changed, 10 insertions(+), 14 deletions(-)
|
|
|
b7337d |
|
|
|
b7337d |
diff --git a/libmultipath/io_err_stat.c b/libmultipath/io_err_stat.c
|
|
|
b7337d |
index 3389d693..bf1d3910 100644
|
|
|
b7337d |
--- a/libmultipath/io_err_stat.c
|
|
|
b7337d |
+++ b/libmultipath/io_err_stat.c
|
|
|
b7337d |
@@ -163,12 +163,15 @@ fail_close:
|
|
|
b7337d |
return 1;
|
|
|
b7337d |
}
|
|
|
b7337d |
|
|
|
b7337d |
-static void destroy_directio_ctx(struct io_err_stat_path *p)
|
|
|
b7337d |
+static void free_io_err_stat_path(struct io_err_stat_path *p)
|
|
|
b7337d |
{
|
|
|
b7337d |
int i;
|
|
|
b7337d |
|
|
|
b7337d |
- if (!p || !p->dio_ctx_array)
|
|
|
b7337d |
+ if (!p)
|
|
|
b7337d |
return;
|
|
|
b7337d |
+ if (!p->dio_ctx_array)
|
|
|
b7337d |
+ goto free_path;
|
|
|
b7337d |
+
|
|
|
b7337d |
cancel_inflight_io(p);
|
|
|
b7337d |
|
|
|
b7337d |
for (i = 0; i < CONCUR_NR_EVENT; i++)
|
|
|
b7337d |
@@ -177,6 +180,8 @@ static void destroy_directio_ctx(struct io_err_stat_path *p)
|
|
|
b7337d |
|
|
|
b7337d |
if (p->fd > 0)
|
|
|
b7337d |
close(p->fd);
|
|
|
b7337d |
+free_path:
|
|
|
b7337d |
+ FREE(p);
|
|
|
b7337d |
}
|
|
|
b7337d |
|
|
|
b7337d |
static struct io_err_stat_path *alloc_io_err_stat_path(void)
|
|
|
b7337d |
@@ -199,11 +204,6 @@ static struct io_err_stat_path *alloc_io_err_stat_path(void)
|
|
|
b7337d |
return p;
|
|
|
b7337d |
}
|
|
|
b7337d |
|
|
|
b7337d |
-static void free_io_err_stat_path(struct io_err_stat_path *p)
|
|
|
b7337d |
-{
|
|
|
b7337d |
- FREE(p);
|
|
|
b7337d |
-}
|
|
|
b7337d |
-
|
|
|
b7337d |
static void free_io_err_pathvec(void)
|
|
|
b7337d |
{
|
|
|
b7337d |
struct io_err_stat_path *path;
|
|
|
b7337d |
@@ -213,10 +213,8 @@ static void free_io_err_pathvec(void)
|
|
|
b7337d |
pthread_cleanup_push(cleanup_mutex, &io_err_pathvec_lock);
|
|
|
b7337d |
if (!io_err_pathvec)
|
|
|
b7337d |
goto out;
|
|
|
b7337d |
- vector_foreach_slot(io_err_pathvec, path, i) {
|
|
|
b7337d |
- destroy_directio_ctx(path);
|
|
|
b7337d |
+ vector_foreach_slot(io_err_pathvec, path, i)
|
|
|
b7337d |
free_io_err_stat_path(path);
|
|
|
b7337d |
- }
|
|
|
b7337d |
vector_free(io_err_pathvec);
|
|
|
b7337d |
io_err_pathvec = NULL;
|
|
|
b7337d |
out:
|
|
|
b7337d |
@@ -252,7 +250,7 @@ static int enqueue_io_err_stat_by_path(struct path *path)
|
|
|
b7337d |
goto free_ioerr_path;
|
|
|
b7337d |
pthread_mutex_lock(&io_err_pathvec_lock);
|
|
|
b7337d |
if (!vector_alloc_slot(io_err_pathvec))
|
|
|
b7337d |
- goto unlock_destroy;
|
|
|
b7337d |
+ goto unlock_pathvec;
|
|
|
b7337d |
vector_set_slot(io_err_pathvec, p);
|
|
|
b7337d |
pthread_mutex_unlock(&io_err_pathvec_lock);
|
|
|
b7337d |
|
|
|
b7337d |
@@ -260,9 +258,8 @@ static int enqueue_io_err_stat_by_path(struct path *path)
|
|
|
b7337d |
path->mpp->alias, path->dev);
|
|
|
b7337d |
return 0;
|
|
|
b7337d |
|
|
|
b7337d |
-unlock_destroy:
|
|
|
b7337d |
+unlock_pathvec:
|
|
|
b7337d |
pthread_mutex_unlock(&io_err_pathvec_lock);
|
|
|
b7337d |
- destroy_directio_ctx(p);
|
|
|
b7337d |
free_ioerr_path:
|
|
|
b7337d |
free_io_err_stat_path(p);
|
|
|
b7337d |
|
|
|
b7337d |
@@ -647,7 +644,6 @@ static void service_paths(void)
|
|
|
b7337d |
vector_foreach_slot_backwards(tmp_pathvec, pp, i) {
|
|
|
b7337d |
end_io_err_stat(pp);
|
|
|
b7337d |
vector_del_slot(tmp_pathvec, i);
|
|
|
b7337d |
- destroy_directio_ctx(pp);
|
|
|
b7337d |
free_io_err_stat_path(pp);
|
|
|
b7337d |
}
|
|
|
b7337d |
vector_reset(tmp_pathvec);
|
|
|
b7337d |
--
|
|
|
b7337d |
2.17.2
|
|
|
b7337d |
|