Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-vslp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-vslp
Commits
b351e28f
Commit
b351e28f
authored
Mar 03, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the vbm facility for the picklist
parent
21cecbee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
configure.ac
configure.ac
+1
-1
vslp_dir.c
src/vslp_dir.c
+16
-7
No files found.
configure.ac
View file @
b351e28f
...
...
@@ -88,7 +88,7 @@ AS_CASE([${VMOD_ABI_VERSION}],
)
# This corresponds to FreeBSD's WARNS level 6
DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat"
DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat
-Wno-free-nonheap-object
"
# Additional flags for GCC 4
EXTRA_DEVELOPER_CFLAGS="-Wextra -Wno-missing-field-initializers -Wno-sign-compare"
...
...
src/vslp_dir.c
View file @
b351e28f
...
...
@@ -40,6 +40,7 @@
#include "cache/cache_director.h"
#include "vrt.h"
#include "vbm.h"
#include "vslp_hash.h"
#include "vslp_dir.h"
...
...
@@ -48,7 +49,7 @@ typedef int (*compar)( const void*, const void* );
struct
vslp_state
{
struct
vslpdir
*
vslpd
;
uint64_t
picklist
;
struct
vbitmap
*
picklist
;
int
idx
;
const
struct
vrt_ctx
*
ctx
;
};
...
...
@@ -156,8 +157,8 @@ vslp_choose_next(struct vslp_state *state, uint32_t n_retry)
state
->
vslpd
->
n_backend
*
state
->
vslpd
->
replicas
+
state
->
vslpd
->
n_backend
)
return
-
1
;
}
while
(
state
->
picklist
&
(
1
<<
chosen
));
state
->
picklist
|=
1
<<
chosen
;
}
while
(
vbit_test
(
state
->
picklist
,
chosen
));
vbit_set
(
state
->
picklist
,
chosen
)
;
return
chosen
;
}
...
...
@@ -398,7 +399,11 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
VCL_BACKEND
be
;
int
chosen
,
be_choice
=
0
,
restarts_o
=
0
,
restarts
=
0
;
struct
vslp_state
state
;
unsigned
picklist_sz
=
VBITMAP_SZ
(
vslpd
->
n_backend
);
char
picklist_spc
[
picklist_sz
];
state
.
picklist
=
vbit_init
(
picklist_spc
,
picklist_sz
);
AN
(
state
.
picklist
);
CHECK_OBJ_NOTNULL
(
vslpd
,
VSLPDIR_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
ctx
->
vsl
);
...
...
@@ -418,7 +423,6 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
n_retry
--
;
}
state
.
picklist
=
0
;
state
.
vslpd
=
vslpd
;
state
.
ctx
=
ctx
;
...
...
@@ -462,17 +466,17 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
}
if
(
--
restarts
<=
0
)
return
be
;
goto
ok
;
}
if
(
!
be
)
{
VSLb
(
ctx
->
vsl
,
SLT_Debug
,
"VSLP no backend found"
);
return
NULL
;
goto
err
;
}
if
(
!
healthy
)
{
AN
(
be
);
return
(
be
)
;
goto
ok
;
}
if
(
be
->
healthy
(
be
,
ctx
->
bo
,
NULL
))
...
...
@@ -512,6 +516,11 @@ VCL_BACKEND vslpdir_pick_be(struct vslpdir *vslpd,
}
}
ok
:
vbit_destroy
(
state
.
picklist
);
AN
(
be
);
return
(
be
);
err
:
vbit_destroy
(
state
.
picklist
);
return
NULL
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment