Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
ec88af5d
Commit
ec88af5d
authored
Dec 01, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: make summary command handle recovery "dead zone"
We can run summary with a recovery area, or a dead zone.
parent
d95645d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
ccan/tdb2/check.c
ccan/tdb2/check.c
+1
-1
ccan/tdb2/private.h
ccan/tdb2/private.h
+3
-0
ccan/tdb2/summary.c
ccan/tdb2/summary.c
+10
-4
No files found.
ccan/tdb2/check.c
View file @
ec88af5d
...
...
@@ -381,7 +381,7 @@ static bool check_free_list(struct tdb_context *tdb,
}
/* Slow, but should be very rare. */
s
tatic
s
ize_t
dead_space
(
struct
tdb_context
*
tdb
,
tdb_off_t
off
)
size_t
dead_space
(
struct
tdb_context
*
tdb
,
tdb_off_t
off
)
{
size_t
len
;
...
...
ccan/tdb2/private.h
View file @
ec88af5d
...
...
@@ -391,6 +391,9 @@ int set_header(struct tdb_context *tdb,
unsigned
int
size_to_bucket
(
tdb_len_t
data_len
);
tdb_off_t
bucket_off
(
tdb_off_t
flist_off
,
unsigned
bucket
);
/* Used by tdb_summary */
size_t
dead_space
(
struct
tdb_context
*
tdb
,
tdb_off_t
off
);
/* io.c: */
/* Initialize tdb->methods. */
void
tdb_io_init
(
struct
tdb_context
*
tdb
);
...
...
ccan/tdb2/summary.c
View file @
ec88af5d
...
...
@@ -53,17 +53,22 @@ static bool summarize(struct tdb_context *tdb,
union
{
struct
tdb_used_record
u
;
struct
tdb_free_record
f
;
struct
tdb_recovery_record
r
;
}
pad
,
*
p
;
p
=
tdb_get
(
tdb
,
off
,
&
pad
,
sizeof
(
pad
));
/* We might not be able to get the whole thing. */
p
=
tdb_get
(
tdb
,
off
,
&
pad
,
sizeof
(
p
->
f
));
if
(
!
p
)
return
false
;
if
(
rec_magic
(
&
p
->
u
)
!=
TDB_MAGIC
)
{
if
(
p
->
r
.
magic
==
TDB_RECOVERY_INVALID_MAGIC
||
p
->
r
.
magic
==
TDB_RECOVERY_MAGIC
)
{
len
=
sizeof
(
p
->
r
)
+
p
->
r
.
max_len
;
}
else
if
(
rec_magic
(
&
p
->
u
)
!=
TDB_MAGIC
)
{
len
=
p
->
f
.
data_len
;
tally_add
(
free
,
len
);
tally_add
(
buckets
,
size_to_bucket
(
len
));
len
+=
sizeof
(
p
->
u
);
unc
++
;
}
else
{
}
else
if
(
frec_magic
(
&
p
->
f
)
==
TDB_FREE_MAGIC
)
{
if
(
unc
)
{
tally_add
(
uncoal
,
unc
);
unc
=
0
;
...
...
@@ -91,7 +96,8 @@ static bool summarize(struct tdb_context *tdb,
tally_add
(
data
,
rec_data_length
(
&
p
->
u
));
}
tally_add
(
extra
,
rec_extra_padding
(
&
p
->
u
));
}
}
else
len
=
dead_space
(
tdb
,
off
);
}
if
(
unc
)
tally_add
(
uncoal
,
unc
);
...
...
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