From: Christophe Varoqui Date: Tue, 29 Nov 2005 10:05:08 +0000 (+0100) Subject: [libmultipath] drop the path cache X-Git-Tag: 0.4.7~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b7f64eb46b7ea030f0b11bfa6177249f1ce7a1b7;p=platform%2Fupstream%2Fmultipath-tools.git [libmultipath] drop the path cache - remove the cache library files - remove the cache loading in multipath - remove the "dump pathvec" facility in multipathd - remove a small cache assertion in the discovery --- diff --git a/libmultipath/Makefile b/libmultipath/Makefile index 41f7ee1..b9b04ba 100644 --- a/libmultipath/Makefile +++ b/libmultipath/Makefile @@ -8,7 +8,7 @@ include ../Makefile.inc OBJS = memory.o parser.o vector.o devmapper.o callout.o \ hwtable.o blacklist.o util.o dmparser.o config.o \ - structs.o cache.o discovery.o propsel.o dict.o \ + structs.o discovery.o propsel.o dict.o \ pgpolicies.o debug.o regex.o defaults.o uevent.o \ switchgroup.o uxsock.o print.o alias.o log_pthread.o \ log.o configure.o structs_vec.o diff --git a/libmultipath/cache.c b/libmultipath/cache.c deleted file mode 100644 index a90b617..0000000 --- a/libmultipath/cache.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2005 Christophe Varoqui - * Copyright (c) 2005 Stephan Bader, IBM - */ -#include - -#include "memory.h" -#include "vector.h" -#include "structs.h" -#include "debug.h" -#include "cache.h" -#include "uxsock.h" -#include "defaults.h" - -static void -revoke_cache_info(struct path * pp) -{ - pp->checker_context = NULL; - pp->fd = -1; - pp->mpp = NULL; - pp->getuid = NULL; - pp->getprio = NULL; - pp->checkfn = NULL; - pp->getprio_selected = 0; -} - -int -cache_load (vector pathvec) -{ - char *reply; - size_t len; - int fd; - struct path * pp; - int r = 1; - char * p; - - fd = ux_socket_connect(DEFAULT_SOCKET); - - if (fd == -1) { - condlog(3, "ux_socket_connect error"); - return 1; - } - - send_packet(fd, "dump pathvec", 13); - recv_packet(fd, &reply, &len); - - for (p = reply; p < (reply + len); p += sizeof(struct path)) { - pp = alloc_path(); - - if (!pp) - goto out; - - if (!vector_alloc_slot(pathvec)) { - free_path(pp); - goto out; - } - vector_set_slot(pathvec, pp); - memcpy(pp, (void *)p, sizeof(struct path)); - revoke_cache_info(pp); - } - - r = 0; -out: - FREE(reply); - close(fd); - return r; -} diff --git a/libmultipath/cache.h b/libmultipath/cache.h deleted file mode 100644 index 737a50a..0000000 --- a/libmultipath/cache.h +++ /dev/null @@ -1 +0,0 @@ -int cache_load (vector pathvec); diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 2d8d304..0223910 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -681,15 +681,11 @@ pathinfo (struct path *pp, vector hwtable, int mask) } condlog(3, "uid = %s (callout)", pp->wwid); } - else if (strlen(pp->wwid)) - condlog(3, "uid = %s (cache)", pp->wwid); - return 0; out: /* * Recoverable error, for example faulty or offline path - * Set up safe defaults, don't trust the cache */ memset(pp->wwid, 0, WWID_SIZE); pp->state = PATH_DOWN; diff --git a/multipath/main.c b/multipath/main.c index e5a0a4a..77883ac 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -236,12 +235,6 @@ configure (void) if (dev && blacklist(conf->blist, dev)) goto out; - condlog(3, "load path identifiers cache"); - cache_load(pathvec); - - if (conf->verbosity > 2) - print_all_paths(pathvec, 1); - /* * scope limiting must be translated into a wwid * failing the translation is fatal (by policy) diff --git a/multipathd/cli.c b/multipathd/cli.c index 76e4dbb..d680349 100644 --- a/multipathd/cli.c +++ b/multipathd/cli.c @@ -133,8 +133,6 @@ load_keys (void) r += add_key(keys, "path", PATH, 1); r += add_key(keys, "map", MAP, 1); r += add_key(keys, "group", GROUP, 1); - r += add_key(keys, "dump", DUMP, 0); - r += add_key(keys, "pathvec", PATHVEC, 0); r += add_key(keys, "reconfigure", RECONFIGURE, 0); r += add_key(keys, "stats", STATS, 0); diff --git a/multipathd/cli.h b/multipathd/cli.h index 3ae53aa..659d1ea 100644 --- a/multipathd/cli.h +++ b/multipathd/cli.h @@ -12,8 +12,6 @@ enum { __PATH, __MAP, __GROUP, - __DUMP, - __PATHVEC, __RECONFIGURE, __STATS, }; @@ -31,8 +29,6 @@ enum { #define PATH (1 << __PATH) #define MAP (1 << __MAP) #define GROUP (1 << __GROUP) -#define DUMP (1 << __DUMP) -#define PATHVEC (1 << __PATHVEC) #define RECONFIGURE (1 << __RECONFIGURE) #define STATS (1 << __STATS) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 39e7207..0fb1cfb 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -108,16 +108,6 @@ cli_switch_group(void * v, char ** reply, int * len, void * data) } int -cli_dump_pathvec(void * v, char ** reply, int * len, void * data) -{ - struct vectors * vecs = (struct vectors *)data; - - condlog(2, "dump pathvec (operator)"); - - return dump_pathvec(reply, len, vecs); -} - -int cli_reconfigure(void * v, char ** reply, int * len, void * data) { struct vectors * vecs = (struct vectors *)data; diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h index e76e68e..fbfbeda 100644 --- a/multipathd/cli_handlers.h +++ b/multipathd/cli_handlers.h @@ -6,7 +6,6 @@ int cli_del_path (void * v, char ** reply, int * len, void * data); int cli_add_map (void * v, char ** reply, int * len, void * data); int cli_del_map (void * v, char ** reply, int * len, void * data); int cli_switch_group(void * v, char ** reply, int * len, void * data); -int cli_dump_pathvec(void * v, char ** reply, int * len, void * data); int cli_reconfigure(void * v, char ** reply, int * len, void * data); int cli_suspend(void * v, char ** reply, int * len, void * data); int cli_resume(void * v, char ** reply, int * len, void * data); diff --git a/multipathd/main.c b/multipathd/main.c index e3af6d1..48fae6a 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -934,32 +934,6 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style) return 0; } -int -dump_pathvec (char ** r, int * len, struct vectors * vecs) -{ - int i; - struct path * pp; - char * reply; - char * p; - - *len = VECTOR_SIZE(vecs->pathvec) * sizeof(struct path); - reply = (char *)MALLOC(*len); - *r = reply; - - if (!reply) - return 1; - - p = reply; - - vector_foreach_slot (vecs->pathvec, pp, i) { - memcpy((void *)p, pp, sizeof(struct path)); - p += sizeof(struct path); - } - - /* return negative to hint caller not to add "ok" to the dump */ - return -1; -} - static int map_discovery (struct vectors * vecs) { @@ -1103,7 +1077,6 @@ uxlsnrloop (void * ap) add_handler(ADD+MAP, cli_add_map); add_handler(DEL+MAP, cli_del_map); add_handler(SWITCH+MAP+GROUP, cli_switch_group); - add_handler(DUMP+PATHVEC, cli_dump_pathvec); add_handler(RECONFIGURE, cli_reconfigure); add_handler(SUSPEND+MAP, cli_suspend); add_handler(RESUME+MAP, cli_resume); diff --git a/multipathd/main.h b/multipathd/main.h index aa82bdc..c9a4886 100644 --- a/multipathd/main.h +++ b/multipathd/main.h @@ -9,7 +9,6 @@ int reconfigure (struct vectors *); int show_paths (char **, int *, struct vectors *, char *); int show_maps (char **, int *, struct vectors *, char *); -int dump_pathvec (char **, int *, struct vectors *); int ev_add_path (char *, struct vectors *); int ev_remove_path (char *, struct vectors *); int ev_add_map (char *, struct vectors *);