Commit 82dfb6f3 authored by Sven Wegener's avatar Sven Wegener Committed by Simon Horman

ipvs: Only call init_service, update_service and done_service for schedulers if defined

There are schedulers that only schedule based on data available in the service
or destination structures and they don't need any persistent storage or
initialization routine. These schedulers currently provide dummy functions for
the init_service, update_service and/or done_service functions. For the
init_service and done_service cases we already have code that only calls these
functions, if the scheduler provides them. Do the same for the update_service
case and remove the dummy functions from all schedulers.
Signed-off-by: default avatarSven Wegener <sven.wegener@stealer.net>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 9a812198
...@@ -869,6 +869,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) ...@@ -869,6 +869,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
svc->num_dests++; svc->num_dests++;
/* call the update_service function of its scheduler */ /* call the update_service function of its scheduler */
if (svc->scheduler->update_service)
svc->scheduler->update_service(svc); svc->scheduler->update_service(svc);
write_unlock_bh(&__ip_vs_svc_lock); write_unlock_bh(&__ip_vs_svc_lock);
...@@ -899,6 +900,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) ...@@ -899,6 +900,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
svc->num_dests++; svc->num_dests++;
/* call the update_service function of its scheduler */ /* call the update_service function of its scheduler */
if (svc->scheduler->update_service)
svc->scheduler->update_service(svc); svc->scheduler->update_service(svc);
write_unlock_bh(&__ip_vs_svc_lock); write_unlock_bh(&__ip_vs_svc_lock);
...@@ -949,6 +951,7 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) ...@@ -949,6 +951,7 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
IP_VS_WAIT_WHILE(atomic_read(&svc->usecnt) > 1); IP_VS_WAIT_WHILE(atomic_read(&svc->usecnt) > 1);
/* call the update_service, because server weight may be changed */ /* call the update_service, because server weight may be changed */
if (svc->scheduler->update_service)
svc->scheduler->update_service(svc); svc->scheduler->update_service(svc);
write_unlock_bh(&__ip_vs_svc_lock); write_unlock_bh(&__ip_vs_svc_lock);
...@@ -1012,12 +1015,12 @@ static void __ip_vs_unlink_dest(struct ip_vs_service *svc, ...@@ -1012,12 +1015,12 @@ static void __ip_vs_unlink_dest(struct ip_vs_service *svc,
*/ */
list_del(&dest->n_list); list_del(&dest->n_list);
svc->num_dests--; svc->num_dests--;
if (svcupd) {
/* /*
* Call the update_service function of its scheduler * Call the update_service function of its scheduler
*/ */
if (svcupd && svc->scheduler->update_service)
svc->scheduler->update_service(svc); svc->scheduler->update_service(svc);
}
} }
......
...@@ -388,12 +388,6 @@ static int ip_vs_lblc_done_svc(struct ip_vs_service *svc) ...@@ -388,12 +388,6 @@ static int ip_vs_lblc_done_svc(struct ip_vs_service *svc)
} }
static int ip_vs_lblc_update_svc(struct ip_vs_service *svc)
{
return 0;
}
static inline struct ip_vs_dest * static inline struct ip_vs_dest *
__ip_vs_wlc_schedule(struct ip_vs_service *svc, struct iphdr *iph) __ip_vs_wlc_schedule(struct ip_vs_service *svc, struct iphdr *iph)
{ {
...@@ -542,7 +536,6 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler = ...@@ -542,7 +536,6 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =
.n_list = LIST_HEAD_INIT(ip_vs_lblc_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_lblc_scheduler.n_list),
.init_service = ip_vs_lblc_init_svc, .init_service = ip_vs_lblc_init_svc,
.done_service = ip_vs_lblc_done_svc, .done_service = ip_vs_lblc_done_svc,
.update_service = ip_vs_lblc_update_svc,
.schedule = ip_vs_lblc_schedule, .schedule = ip_vs_lblc_schedule,
}; };
......
...@@ -572,12 +572,6 @@ static int ip_vs_lblcr_done_svc(struct ip_vs_service *svc) ...@@ -572,12 +572,6 @@ static int ip_vs_lblcr_done_svc(struct ip_vs_service *svc)
} }
static int ip_vs_lblcr_update_svc(struct ip_vs_service *svc)
{
return 0;
}
static inline struct ip_vs_dest * static inline struct ip_vs_dest *
__ip_vs_wlc_schedule(struct ip_vs_service *svc, struct iphdr *iph) __ip_vs_wlc_schedule(struct ip_vs_service *svc, struct iphdr *iph)
{ {
...@@ -731,7 +725,6 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler = ...@@ -731,7 +725,6 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
.n_list = LIST_HEAD_INIT(ip_vs_lblcr_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_lblcr_scheduler.n_list),
.init_service = ip_vs_lblcr_init_svc, .init_service = ip_vs_lblcr_init_svc,
.done_service = ip_vs_lblcr_done_svc, .done_service = ip_vs_lblcr_done_svc,
.update_service = ip_vs_lblcr_update_svc,
.schedule = ip_vs_lblcr_schedule, .schedule = ip_vs_lblcr_schedule,
}; };
......
...@@ -20,24 +20,6 @@ ...@@ -20,24 +20,6 @@
#include <net/ip_vs.h> #include <net/ip_vs.h>
static int ip_vs_lc_init_svc(struct ip_vs_service *svc)
{
return 0;
}
static int ip_vs_lc_done_svc(struct ip_vs_service *svc)
{
return 0;
}
static int ip_vs_lc_update_svc(struct ip_vs_service *svc)
{
return 0;
}
static inline unsigned int static inline unsigned int
ip_vs_lc_dest_overhead(struct ip_vs_dest *dest) ip_vs_lc_dest_overhead(struct ip_vs_dest *dest)
{ {
...@@ -99,9 +81,6 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = { ...@@ -99,9 +81,6 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = {
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_lc_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_lc_scheduler.n_list),
.init_service = ip_vs_lc_init_svc,
.done_service = ip_vs_lc_done_svc,
.update_service = ip_vs_lc_update_svc,
.schedule = ip_vs_lc_schedule, .schedule = ip_vs_lc_schedule,
}; };
......
...@@ -37,27 +37,6 @@ ...@@ -37,27 +37,6 @@
#include <net/ip_vs.h> #include <net/ip_vs.h>
static int
ip_vs_nq_init_svc(struct ip_vs_service *svc)
{
return 0;
}
static int
ip_vs_nq_done_svc(struct ip_vs_service *svc)
{
return 0;
}
static int
ip_vs_nq_update_svc(struct ip_vs_service *svc)
{
return 0;
}
static inline unsigned int static inline unsigned int
ip_vs_nq_dest_overhead(struct ip_vs_dest *dest) ip_vs_nq_dest_overhead(struct ip_vs_dest *dest)
{ {
...@@ -137,9 +116,6 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler = ...@@ -137,9 +116,6 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler =
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_nq_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_nq_scheduler.n_list),
.init_service = ip_vs_nq_init_svc,
.done_service = ip_vs_nq_done_svc,
.update_service = ip_vs_nq_update_svc,
.schedule = ip_vs_nq_schedule, .schedule = ip_vs_nq_schedule,
}; };
......
...@@ -32,12 +32,6 @@ static int ip_vs_rr_init_svc(struct ip_vs_service *svc) ...@@ -32,12 +32,6 @@ static int ip_vs_rr_init_svc(struct ip_vs_service *svc)
} }
static int ip_vs_rr_done_svc(struct ip_vs_service *svc)
{
return 0;
}
static int ip_vs_rr_update_svc(struct ip_vs_service *svc) static int ip_vs_rr_update_svc(struct ip_vs_service *svc)
{ {
svc->sched_data = &svc->destinations; svc->sched_data = &svc->destinations;
...@@ -96,7 +90,6 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = { ...@@ -96,7 +90,6 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = {
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_rr_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_rr_scheduler.n_list),
.init_service = ip_vs_rr_init_svc, .init_service = ip_vs_rr_init_svc,
.done_service = ip_vs_rr_done_svc,
.update_service = ip_vs_rr_update_svc, .update_service = ip_vs_rr_update_svc,
.schedule = ip_vs_rr_schedule, .schedule = ip_vs_rr_schedule,
}; };
......
...@@ -41,27 +41,6 @@ ...@@ -41,27 +41,6 @@
#include <net/ip_vs.h> #include <net/ip_vs.h>
static int
ip_vs_sed_init_svc(struct ip_vs_service *svc)
{
return 0;
}
static int
ip_vs_sed_done_svc(struct ip_vs_service *svc)
{
return 0;
}
static int
ip_vs_sed_update_svc(struct ip_vs_service *svc)
{
return 0;
}
static inline unsigned int static inline unsigned int
ip_vs_sed_dest_overhead(struct ip_vs_dest *dest) ip_vs_sed_dest_overhead(struct ip_vs_dest *dest)
{ {
...@@ -139,9 +118,6 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler = ...@@ -139,9 +118,6 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler =
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_sed_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_sed_scheduler.n_list),
.init_service = ip_vs_sed_init_svc,
.done_service = ip_vs_sed_done_svc,
.update_service = ip_vs_sed_update_svc,
.schedule = ip_vs_sed_schedule, .schedule = ip_vs_sed_schedule,
}; };
......
...@@ -25,27 +25,6 @@ ...@@ -25,27 +25,6 @@
#include <net/ip_vs.h> #include <net/ip_vs.h>
static int
ip_vs_wlc_init_svc(struct ip_vs_service *svc)
{
return 0;
}
static int
ip_vs_wlc_done_svc(struct ip_vs_service *svc)
{
return 0;
}
static int
ip_vs_wlc_update_svc(struct ip_vs_service *svc)
{
return 0;
}
static inline unsigned int static inline unsigned int
ip_vs_wlc_dest_overhead(struct ip_vs_dest *dest) ip_vs_wlc_dest_overhead(struct ip_vs_dest *dest)
{ {
...@@ -127,9 +106,6 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler = ...@@ -127,9 +106,6 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler =
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_wlc_scheduler.n_list), .n_list = LIST_HEAD_INIT(ip_vs_wlc_scheduler.n_list),
.init_service = ip_vs_wlc_init_svc,
.done_service = ip_vs_wlc_done_svc,
.update_service = ip_vs_wlc_update_svc,
.schedule = ip_vs_wlc_schedule, .schedule = ip_vs_wlc_schedule,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment