Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5055b509
Commit
5055b509
authored
Sep 07, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Rebalance now adds replicas if needed
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
4430ea70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
27 deletions
+20
-27
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_format.h
+1
-1
fs/bcachefs/rebalance.c
fs/bcachefs/rebalance.c
+19
-26
No files found.
fs/bcachefs/bcachefs_format.h
View file @
5055b509
...
...
@@ -661,7 +661,7 @@ struct bch_reservation {
/* Maximum possible size of an entire extent value: */
#define BKEY_EXTENT_VAL_U64s_MAX \
(BKEY_EXTENT_PTR_U64s_MAX * (BCH_REPLICAS_MAX + 1))
(
1 +
BKEY_EXTENT_PTR_U64s_MAX * (BCH_REPLICAS_MAX + 1))
#define BKEY_PADDED(key) __BKEY_PADDED(key, BKEY_EXTENT_VAL_U64s_MAX)
...
...
fs/bcachefs/rebalance.c
View file @
5055b509
...
...
@@ -42,9 +42,6 @@ void bch2_rebalance_add_key(struct bch_fs *c,
const
union
bch_extent_entry
*
entry
;
struct
extent_ptr_decoded
p
;
if
(
!
bkey_extent_is_data
(
k
.
k
))
return
;
if
(
!
io_opts
->
background_target
&&
!
io_opts
->
background_compression
)
return
;
...
...
@@ -72,30 +69,26 @@ static enum data_cmd rebalance_pred(struct bch_fs *c, void *arg,
struct
bch_io_opts
*
io_opts
,
struct
data_opts
*
data_opts
)
{
switch
(
k
.
k
->
type
)
{
case
KEY_TYPE_extent
:
{
struct
bkey_s_c_extent
e
=
bkey_s_c_to_extent
(
k
);
const
union
bch_extent_entry
*
entry
;
struct
extent_ptr_decoded
p
;
/* Make sure we have room to add a new pointer: */
if
(
bkey_val_u64s
(
e
.
k
)
+
BKEY_EXTENT_PTR_U64s_MAX
>
BKEY_EXTENT_VAL_U64s_MAX
)
return
DATA_SKIP
;
extent_for_each_ptr_decode
(
e
,
p
,
entry
)
if
(
rebalance_ptr_pred
(
c
,
p
,
io_opts
))
goto
found
;
return
DATA_SKIP
;
found:
data_opts
->
target
=
io_opts
->
background_target
;
data_opts
->
btree_insert_flags
=
0
;
return
DATA_ADD_REPLICAS
;
}
default:
return
DATA_SKIP
;
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
union
bch_extent_entry
*
entry
;
struct
extent_ptr_decoded
p
;
unsigned
nr_replicas
=
0
;
bkey_for_each_ptr_decode
(
k
.
k
,
ptrs
,
p
,
entry
)
{
nr_replicas
+=
!
p
.
ptr
.
cached
;
if
(
rebalance_ptr_pred
(
c
,
p
,
io_opts
))
goto
found
;
}
if
(
nr_replicas
<
io_opts
->
data_replicas
)
goto
found
;
return
DATA_SKIP
;
found:
data_opts
->
target
=
io_opts
->
background_target
;
data_opts
->
btree_insert_flags
=
0
;
return
DATA_ADD_REPLICAS
;
}
struct
rebalance_work
{
...
...
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