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