Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
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
slash
Commits
d47bb73a
Unverified
Commit
d47bb73a
authored
Jan 15, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fellow_log: Rename lbuf_mempool -> logblk_mempool
parent
6f575650
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
46 deletions
+28
-46
fellow_log.c
src/fellow_log.c
+28
-46
No files found.
src/fellow_log.c
View file @
d47bb73a
...
@@ -413,8 +413,7 @@ assert_seq_macros(void)
...
@@ -413,8 +413,7 @@ assert_seq_macros(void)
#define LBUF_DSKPOOL_SIZE \
#define LBUF_DSKPOOL_SIZE \
((((1<<13) - 16) - 2 * sizeof(struct buddy_reqs)) / \
((((1<<13) - 16) - 2 * sizeof(struct buddy_reqs)) / \
(2 * sizeof(struct i_reqalloc)))
(2 * sizeof(struct i_reqalloc)))
// XXX is 4 a good number?
#define LOGBLK_MEMPOOL_SIZE 4
#define LBUF_MEMPOOL_SIZE 4
//lint -e{506, 527}
//lint -e{506, 527}
static
void
__attribute__
((
constructor
))
static
void
__attribute__
((
constructor
))
assert_lbuf_dsk_resv
(
void
)
assert_lbuf_dsk_resv
(
void
)
...
@@ -427,14 +426,25 @@ BUDDY_POOL(lbuf_dskpool, LBUF_DSKPOOL_SIZE);
...
@@ -427,14 +426,25 @@ BUDDY_POOL(lbuf_dskpool, LBUF_DSKPOOL_SIZE);
// this is the memory request for dskpool
// this is the memory request for dskpool
BUDDY_REQS
(
lbuf_dskpool_mem_s
,
1
);
BUDDY_REQS
(
lbuf_dskpool_mem_s
,
1
);
// mem block pool
// mem block pool
BUDDY_POOL
(
l
buf_mempool
,
LBUF
_MEMPOOL_SIZE
);
BUDDY_POOL
(
l
ogblk_mempool
,
LOGBLK
_MEMPOOL_SIZE
);
BUDDY_POOL_GET_FUNC
(
l
buf
_mempool
,
static
)
BUDDY_POOL_GET_FUNC
(
l
ogblk
_mempool
,
static
)
BUDDY_POOL_AVAIL_FUNC
(
l
buf
_mempool
,
static
)
BUDDY_POOL_AVAIL_FUNC
(
l
ogblk
_mempool
,
static
)
// memory for flush_finish
// memory for flush_finish
BUDDY_POOL
(
lbuf_ffpool
,
4
);
BUDDY_POOL
(
lbuf_ffpool
,
4
);
BUDDY_POOL_GET_FUNC
(
lbuf_ffpool
,
static
)
BUDDY_POOL_GET_FUNC
(
lbuf_ffpool
,
static
)
BUDDY_POOL_AVAIL_FUNC
(
lbuf_ffpool
,
static
)
BUDDY_POOL_AVAIL_FUNC
(
lbuf_ffpool
,
static
)
static
void
logblk_mempool_fill
(
struct
buddy_reqs
*
reqs
,
const
void
*
priv
)
{
unsigned
u
;
(
void
)
priv
;
for
(
u
=
0
;
u
<
reqs
->
space
;
u
++
)
AN
(
buddy_req_page
(
reqs
,
MIN_FELLOW_BITS
,
0
));
}
struct
fellow_logbuffer
{
struct
fellow_logbuffer
{
unsigned
magic
;
unsigned
magic
;
#define FELLOW_LOGBUFFER_MAGIC 0xe8454b5a
#define FELLOW_LOGBUFFER_MAGIC 0xe8454b5a
...
@@ -474,7 +484,7 @@ struct fellow_logbuffer {
...
@@ -474,7 +484,7 @@ struct fellow_logbuffer {
off_t
tail_off
;
off_t
tail_off
;
struct
fellow_logbuffer_ff
*
ff
;
struct
fellow_logbuffer_ff
*
ff
;
struct
lbuf_ffpool
ffpool
[
1
];
struct
lbuf_ffpool
ffpool
[
1
];
struct
l
buf
_mempool
mempool
[
1
];
struct
l
ogblk
_mempool
mempool
[
1
];
struct
lbuf_dskpool_mem_s
dskpool_mem
;
struct
lbuf_dskpool_mem_s
dskpool_mem
;
struct
lbuf_dskpool
*
dskpool
;
struct
lbuf_dskpool
*
dskpool
;
};
};
...
@@ -1077,11 +1087,6 @@ struct fellow_logcache_entry {
...
@@ -1077,11 +1087,6 @@ struct fellow_logcache_entry {
off_t
off
;
off_t
off
;
};
};
#define FLC_MEMPOOL_SIZE 2
BUDDY_POOL
(
flc_mempool
,
FLC_MEMPOOL_SIZE
);
BUDDY_POOL_GET_FUNC
(
flc_mempool
,
static
)
BUDDY_POOL_AVAIL_FUNC
(
flc_mempool
,
static
)
VTAILQ_HEAD
(
flehead
,
fellow_logcache_entry
);
VTAILQ_HEAD
(
flehead
,
fellow_logcache_entry
);
struct
fellow_logcache
{
struct
fellow_logcache
{
...
@@ -1096,7 +1101,7 @@ struct fellow_logcache {
...
@@ -1096,7 +1101,7 @@ struct fellow_logcache {
struct
fellow_fd_ioctx_lease
fdil
;
struct
fellow_fd_ioctx_lease
fdil
;
const
struct
buddy_off_extent
*
region
;
const
struct
buddy_off_extent
*
region
;
struct
buddy_ptr_page
alloc_entry
;
struct
buddy_ptr_page
alloc_entry
;
struct
flc
_mempool
mempool
[
1
];
struct
logblk
_mempool
mempool
[
1
];
struct
fellow_logcache_entry
*
current
;
struct
fellow_logcache_entry
*
current
;
struct
flehead
free
;
struct
flehead
free
;
struct
flehead
used
;
struct
flehead
used
;
...
@@ -1178,18 +1183,6 @@ fellow_logcache_fini(struct fellow_logcache *flc)
...
@@ -1178,18 +1183,6 @@ fellow_logcache_fini(struct fellow_logcache *flc)
buddy_return
(
rets
);
buddy_return
(
rets
);
}
}
// dup logbuffer_fill_mempool
static
void
flc_mempool_fill
(
struct
buddy_reqs
*
reqs
,
const
void
*
priv
)
{
unsigned
u
;
(
void
)
priv
;
for
(
u
=
0
;
u
<
reqs
->
space
;
u
++
)
AN
(
buddy_req_page
(
reqs
,
MIN_FELLOW_BITS
,
0
));
}
static
void
static
void
fellow_logcache_init
(
struct
fellow_logcache
*
flc
,
struct
fellow_fd
*
ffd
,
fellow_logcache_init
(
struct
fellow_logcache
*
flc
,
struct
fellow_fd
*
ffd
,
uint8_t
id
,
const
struct
buddy_off_extent
*
region
)
uint8_t
id
,
const
struct
buddy_off_extent
*
region
)
...
@@ -1233,7 +1226,7 @@ fellow_logcache_init(struct fellow_logcache *flc, struct fellow_fd *ffd,
...
@@ -1233,7 +1226,7 @@ fellow_logcache_init(struct fellow_logcache *flc, struct fellow_fd *ffd,
sz
/=
sizeof
*
fle
;
sz
/=
sizeof
*
fle
;
BUDDY_POOL_INIT
(
flc
->
mempool
,
ffd
->
membuddy
,
FEP_MEM_FLC
,
BUDDY_POOL_INIT
(
flc
->
mempool
,
ffd
->
membuddy
,
FEP_MEM_FLC
,
flc
_mempool_fill
,
NULL
);
logblk
_mempool_fill
,
NULL
);
assert
(
sz
<
UINT_MAX
);
assert
(
sz
<
UINT_MAX
);
flc
->
n
=
(
unsigned
)
sz
;
flc
->
n
=
(
unsigned
)
sz
;
...
@@ -1331,14 +1324,14 @@ fellow_logcache_take(struct fellow_logcache *flc, int direction, int need)
...
@@ -1331,14 +1324,14 @@ fellow_logcache_take(struct fellow_logcache *flc, int direction, int need)
if
(
fle
==
NULL
)
if
(
fle
==
NULL
)
return
(
fellow_logcache_steal
(
flc
,
direction
));
return
(
fellow_logcache_steal
(
flc
,
direction
));
if
(
need
==
0
&&
!
flc
_mempool_avail
(
flc
->
mempool
))
if
(
need
==
0
&&
!
logblk
_mempool_avail
(
flc
->
mempool
))
return
(
NULL
);
return
(
NULL
);
VTAILQ_REMOVE
(
&
flc
->
free
,
fle
,
list
);
VTAILQ_REMOVE
(
&
flc
->
free
,
fle
,
list
);
AZ
(
fle
->
alloc
.
ptr
);
AZ
(
fle
->
alloc
.
ptr
);
fle
->
alloc
=
buddy_get_next_ptr_page
(
fle
->
alloc
=
buddy_get_next_ptr_page
(
flc
_mempool_get
(
flc
->
mempool
,
NULL
));
logblk
_mempool_get
(
flc
->
mempool
,
NULL
));
return
(
fle
);
return
(
fle
);
}
}
...
@@ -2200,17 +2193,6 @@ logbuffer_recycle(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
...
@@ -2200,17 +2193,6 @@ logbuffer_recycle(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
lbuf
->
head_seq
[
1
]
=
0
;
lbuf
->
head_seq
[
1
]
=
0
;
}
}
static
void
logbuffer_fill_mempool
(
struct
buddy_reqs
*
reqs
,
const
void
*
priv
)
{
unsigned
u
;
(
void
)
priv
;
for
(
u
=
0
;
u
<
reqs
->
space
;
u
++
)
AN
(
buddy_req_page
(
reqs
,
MIN_FELLOW_BITS
,
0
));
}
static
void
static
void
logbuffer_init
(
struct
fellow_fd
*
ffd
,
struct
fellow_logbuffer
*
lbuf
,
logbuffer_init
(
struct
fellow_fd
*
ffd
,
struct
fellow_logbuffer
*
lbuf
,
struct
fellow_log_region
*
logreg
)
struct
fellow_log_region
*
logreg
)
...
@@ -2234,7 +2216,7 @@ logbuffer_init(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
...
@@ -2234,7 +2216,7 @@ logbuffer_init(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
logbuffer_grow
(
lbuf
,
(
uint8_t
)
b
);
logbuffer_grow
(
lbuf
,
(
uint8_t
)
b
);
BUDDY_POOL_INIT
(
lbuf
->
mempool
,
lbuf
->
membuddy
,
FEP_MEM_LOG
,
BUDDY_POOL_INIT
(
lbuf
->
mempool
,
lbuf
->
membuddy
,
FEP_MEM_LOG
,
logb
uffer_fill_mempoo
l
,
lbuf
);
logb
lk_mempool_fil
l
,
lbuf
);
BUDDY_POOL_INIT
(
lbuf
->
ffpool
,
lbuf
->
membuddy
,
FEP_MEM_LOG
,
BUDDY_POOL_INIT
(
lbuf
->
ffpool
,
lbuf
->
membuddy
,
FEP_MEM_LOG
,
logbuffer_fill_ffpool
,
lbuf
);
logbuffer_fill_ffpool
,
lbuf
);
...
@@ -2251,7 +2233,7 @@ logbuffer_take(struct fellow_logbuffer *to, struct fellow_logbuffer *from)
...
@@ -2251,7 +2233,7 @@ logbuffer_take(struct fellow_logbuffer *to, struct fellow_logbuffer *from)
logbuffer_wait_flush_fini
(
from
);
logbuffer_wait_flush_fini
(
from
);
*
to
=
*
from
;
*
to
=
*
from
;
BUDDY_POOL_INIT
(
to
->
mempool
,
from
->
membuddy
,
FEP_MEM_LOG
,
BUDDY_POOL_INIT
(
to
->
mempool
,
from
->
membuddy
,
FEP_MEM_LOG
,
logb
uffer_fill_mempoo
l
,
to
);
logb
lk_mempool_fil
l
,
to
);
BUDDY_POOL_INIT
(
to
->
ffpool
,
from
->
membuddy
,
FEP_MEM_LOG
,
BUDDY_POOL_INIT
(
to
->
ffpool
,
from
->
membuddy
,
FEP_MEM_LOG
,
logbuffer_fill_ffpool
,
to
);
logbuffer_fill_ffpool
,
to
);
...
@@ -2270,10 +2252,10 @@ fellow_logblk_new(
...
@@ -2270,10 +2252,10 @@ fellow_logblk_new(
struct
fellow_disk_log_block
*
logblk
;
struct
fellow_disk_log_block
*
logblk
;
struct
buddy_ptr_page
e
;
struct
buddy_ptr_page
e
;
if
(
wait
==
0
&&
l
buf
_mempool_avail
(
lbuf
->
mempool
)
==
0
)
if
(
wait
==
0
&&
l
ogblk
_mempool_avail
(
lbuf
->
mempool
)
==
0
)
return
(
NULL
);
return
(
NULL
);
e
=
buddy_get_next_ptr_page
(
l
buf
_mempool_get
(
lbuf
->
mempool
,
lbuf
));
e
=
buddy_get_next_ptr_page
(
l
ogblk
_mempool_get
(
lbuf
->
mempool
,
lbuf
));
AN
(
e
.
ptr
);
AN
(
e
.
ptr
);
//lint -e{587} false positive, definitely -- assertion is true
//lint -e{587} false positive, definitely -- assertion is true
...
@@ -2646,10 +2628,10 @@ logbuffer_need_regions_to_free(struct fellow_logbuffer *lbuf)
...
@@ -2646,10 +2628,10 @@ logbuffer_need_regions_to_free(struct fellow_logbuffer *lbuf)
if
(
lbuf
->
regions_to_free
!=
NULL
)
if
(
lbuf
->
regions_to_free
!=
NULL
)
return
;
return
;
if
(
l
buf
_mempool_avail
(
lbuf
->
mempool
))
{
if
(
l
ogblk
_mempool_avail
(
lbuf
->
mempool
))
{
lbuf
->
regions_to_free
=
regionlist_init
(
lbuf
->
regions_to_free
=
regionlist_init
(
buddy_get_next_ptr_page
(
buddy_get_next_ptr_page
(
l
buf
_mempool_get
(
lbuf
->
mempool
,
lbuf
)),
l
ogblk
_mempool_get
(
lbuf
->
mempool
,
lbuf
)),
lbuf
->
membuddy
);
lbuf
->
membuddy
);
}
}
else
else
...
@@ -3311,7 +3293,7 @@ logbuffer_addblks(struct fellow_fd *ffd,
...
@@ -3311,7 +3293,7 @@ logbuffer_addblks(struct fellow_fd *ffd,
/* low water in mempool?
/* low water in mempool?
*/
*/
if
(
canflush
&&
if
(
canflush
&&
l
buf_mempool_avail
(
lbuf
->
mempool
)
<
LBUF
_MEMPOOL_SIZE
)
l
ogblk_mempool_avail
(
lbuf
->
mempool
)
<
LOGBLK
_MEMPOOL_SIZE
)
kick
=
1
;
kick
=
1
;
/* if we run short of disk blocks (25%), we want to
/* if we run short of disk blocks (25%), we want to
...
@@ -6021,7 +6003,7 @@ fellow_logwatcher_need(struct fellow_fd *ffd, struct flw_need_why *why)
...
@@ -6021,7 +6003,7 @@ fellow_logwatcher_need(struct fellow_fd *ffd, struct flw_need_why *why)
if
(
lbuf
->
space
==
0
||
lbuf
->
n
==
0
)
if
(
lbuf
->
space
==
0
||
lbuf
->
n
==
0
)
return
(
FLW_NEED_NONE
);
return
(
FLW_NEED_NONE
);
if
(
l
buf_mempool_avail
(
lbuf
->
mempool
)
<
LBUF
_MEMPOOL_SIZE
)
if
(
l
ogblk_mempool_avail
(
lbuf
->
mempool
)
<
LOGBLK
_MEMPOOL_SIZE
)
return
(
FLW_NEED_FLUSH
);
return
(
FLW_NEED_FLUSH
);
if
(
lbuf
->
space
-
lbuf
->
n
<=
thr_logbuffer_minfree
)
if
(
lbuf
->
space
-
lbuf
->
n
<=
thr_logbuffer_minfree
)
...
...
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