Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
18
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
cellframe-sdk
Commits
7173e55c
Commit
7173e55c
authored
8 months ago
by
Roman Khlopkov
🔜
Browse files
Options
Downloads
Plain Diff
Merge branch 'bugfix-12148' into 'release-5.3'
Bugfix 12148 See merge request
!1702
parents
2e6a08c4
a568a0ba
No related branches found
Branches containing commit
No related tags found
1 merge request
!1702
Bugfix 12148
Pipeline
#41536
passed with stage
in 9 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/chain/dap_chain_cell.c
+15
-2
15 additions, 2 deletions
modules/chain/dap_chain_cell.c
modules/chain/include/dap_chain_cell.h
+3
-0
3 additions, 0 deletions
modules/chain/include/dap_chain_cell.h
with
18 additions
and
2 deletions
modules/chain/dap_chain_cell.c
+
15
−
2
View file @
7173e55c
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#define DAP_CHAIN_CELL_FILE_SIGNATURE 0xfa340bef153eba48
#define DAP_CHAIN_CELL_FILE_SIGNATURE 0xfa340bef153eba48
#define DAP_CHAIN_CELL_FILE_TYPE_RAW 0
#define DAP_CHAIN_CELL_FILE_TYPE_RAW 0
#define DAP_CHAIN_CELL_FILE_TYPE_COMPRESSED 1
#define DAP_CHAIN_CELL_FILE_TYPE_COMPRESSED 1
#define DAP_MAPPED_VOLUME_LIMIT ( 1 << 2
8
) // 256 MB for now, may be should be configurable?
#define DAP_MAPPED_VOLUME_LIMIT ( 1 << 2
0
) // 256 MB for now, may be should be configurable?
/**
/**
* @struct dap_chain_cell_file_header
* @struct dap_chain_cell_file_header
*/
*/
...
@@ -172,6 +172,9 @@ DAP_STATIC_INLINE int s_cell_map_new_volume(dap_chain_cell_t *a_cell, size_t a_f
...
@@ -172,6 +172,9 @@ DAP_STATIC_INLINE int s_cell_map_new_volume(dap_chain_cell_t *a_cell, size_t a_f
a_cell
->
file_storage_path
,
a_cell
->
id
.
uint64
,
errno
);
a_cell
->
file_storage_path
,
a_cell
->
id
.
uint64
,
errno
);
return
-
1
;
return
-
1
;
}
}
#ifdef DAP_OS_DARWIN
a_cell
->
cur_vol_start
=
l_volume_start
;
#endif
#endif
#endif
a_cell
->
map_pos
=
a_cell
->
map
+
l_offset
;
a_cell
->
map_pos
=
a_cell
->
map
+
l_offset
;
a_cell
->
map_range_bounds
=
dap_list_append
(
a_cell
->
map_range_bounds
,
a_cell
->
map
);
a_cell
->
map_range_bounds
=
dap_list_append
(
a_cell
->
map_range_bounds
,
a_cell
->
map
);
...
@@ -523,6 +526,16 @@ static int s_cell_file_atom_add(dap_chain_cell_t *a_cell, dap_chain_atom_ptr_t a
...
@@ -523,6 +526,16 @@ static int s_cell_file_atom_add(dap_chain_cell_t *a_cell, dap_chain_atom_ptr_t a
debug_if
(
s_debug_more
&&
a_cell
->
chain
->
is_mapped
,
L_DEBUG
,
"After writing an atom of size %lu, stream pos of %s is %lu and map shift is %lu"
,
debug_if
(
s_debug_more
&&
a_cell
->
chain
->
is_mapped
,
L_DEBUG
,
"After writing an atom of size %lu, stream pos of %s is %lu and map shift is %lu"
,
a_atom_size
,
a_cell
->
file_storage_path
,
ftell
(
a_cell
->
file_storage
),
a_atom_size
,
a_cell
->
file_storage_path
,
ftell
(
a_cell
->
file_storage
),
(
size_t
)(
a_cell
->
map_pos
-
a_cell
->
map
));
(
size_t
)(
a_cell
->
map_pos
-
a_cell
->
map
));
#ifdef DAP_OS_DARWIN
if
(
a_cell
->
chain
->
is_mapped
)
{
if
(
MAP_FAILED
==
(
a_cell
->
map
=
mmap
(
a_cell
->
map
,
dap_page_roundup
(
DAP_MAPPED_VOLUME_LIMIT
),
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
|
MAP_FIXED
,
fileno
(
a_cell
->
file_storage
),
a_cell
->
cur_vol_start
))
)
{
log_it
(
L_ERROR
,
"Chain cell
\"
%s
\"
0x%016"
DAP_UINT64_FORMAT_X
" cannot be remapped, errno %d"
,
a_cell
->
file_storage_path
,
a_cell
->
id
.
uint64
,
errno
);
return
-
1
;
}
}
#endif
return
0
;
return
0
;
}
}
...
@@ -602,7 +615,7 @@ ssize_t dap_chain_cell_file_append(dap_chain_cell_t *a_cell, const void *a_atom,
...
@@ -602,7 +615,7 @@ ssize_t dap_chain_cell_file_append(dap_chain_cell_t *a_cell, const void *a_atom,
++
l_count
;
++
l_count
;
l_total_res
=
a_atom_size
+
sizeof
(
uint64_t
);
l_total_res
=
a_atom_size
+
sizeof
(
uint64_t
);
}
}
if
(
l_total_res
)
{
if
(
l_total_res
)
{
fflush
(
a_cell
->
file_storage
);
fflush
(
a_cell
->
file_storage
);
#ifdef DAP_OS_WINDOWS
#ifdef DAP_OS_WINDOWS
...
...
This diff is collapsed.
Click to expand it.
modules/chain/include/dap_chain_cell.h
+
3
−
0
View file @
7173e55c
...
@@ -38,6 +38,9 @@ typedef struct dap_chain_cell {
...
@@ -38,6 +38,9 @@ typedef struct dap_chain_cell {
FILE
*
file_storage
;
FILE
*
file_storage
;
uint8_t
file_storage_type
;
uint8_t
file_storage_type
;
dap_list_t
*
map_range_bounds
;
dap_list_t
*
map_range_bounds
;
#ifdef DAP_OS_DARWIN
size_t
cur_vol_start
;
#endif
pthread_rwlock_t
storage_rwlock
;
pthread_rwlock_t
storage_rwlock
;
UT_hash_handle
hh
;
UT_hash_handle
hh
;
}
dap_chain_cell_t
;
}
dap_chain_cell_t
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment