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
39a1ea12
Commit
39a1ea12
authored
Feb 25, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Single open_bucket_partial list
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
0d763863
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
27 deletions
+29
-27
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+16
-12
fs/bcachefs/alloc_foreground.c
fs/bcachefs/alloc_foreground.c
+10
-12
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+3
-3
No files found.
fs/bcachefs/alloc_background.c
View file @
39a1ea12
...
@@ -2175,21 +2175,25 @@ void bch2_dev_allocator_remove(struct bch_fs *c, struct bch_dev *ca)
...
@@ -2175,21 +2175,25 @@ void bch2_dev_allocator_remove(struct bch_fs *c, struct bch_dev *ca)
}
}
mutex_unlock
(
&
c
->
btree_reserve_cache_lock
);
mutex_unlock
(
&
c
->
btree_reserve_cache_lock
);
while
(
1
)
{
spin_lock
(
&
c
->
freelist_lock
);
struct
open_bucket
*
ob
;
i
=
0
;
while
(
i
<
c
->
open_buckets_partial_nr
)
{
spin_lock
(
&
c
->
freelist_lock
);
struct
open_bucket
*
ob
=
if
(
!
ca
->
open_buckets_partial_nr
)
{
c
->
open_buckets
+
c
->
open_buckets_partial
[
i
];
if
(
ob
->
dev
==
ca
->
dev_idx
)
{
--
c
->
open_buckets_partial_nr
;
swap
(
c
->
open_buckets_partial
[
i
],
c
->
open_buckets_partial
[
c
->
open_buckets_partial_nr
]);
ob
->
on_partial_list
=
false
;
spin_unlock
(
&
c
->
freelist_lock
);
spin_unlock
(
&
c
->
freelist_lock
);
break
;
bch2_open_bucket_put
(
c
,
ob
);
spin_lock
(
&
c
->
freelist_lock
);
}
else
{
i
++
;
}
}
ob
=
c
->
open_buckets
+
ca
->
open_buckets_partial
[
--
ca
->
open_buckets_partial_nr
];
ob
->
on_partial_list
=
false
;
spin_unlock
(
&
c
->
freelist_lock
);
bch2_open_bucket_put
(
c
,
ob
);
}
}
spin_unlock
(
&
c
->
freelist_lock
);
bch2_ec_stop_dev
(
c
,
ca
);
bch2_ec_stop_dev
(
c
,
ca
);
...
...
fs/bcachefs/alloc_foreground.c
View file @
39a1ea12
...
@@ -154,18 +154,15 @@ static void open_bucket_free_unused(struct bch_fs *c,
...
@@ -154,18 +154,15 @@ static void open_bucket_free_unused(struct bch_fs *c,
struct
write_point
*
wp
,
struct
write_point
*
wp
,
struct
open_bucket
*
ob
)
struct
open_bucket
*
ob
)
{
{
struct
bch_dev
*
ca
=
bch_dev_bkey_exists
(
c
,
ob
->
dev
);
bool
may_realloc
=
wp
->
data_type
==
BCH_DATA_user
;
bool
may_realloc
=
wp
->
data_type
==
BCH_DATA_user
;
BUG_ON
(
c
a
->
open_buckets_partial_nr
>
BUG_ON
(
c
->
open_buckets_partial_nr
>=
ARRAY_SIZE
(
c
a
->
open_buckets_partial
));
ARRAY_SIZE
(
c
->
open_buckets_partial
));
if
(
ca
->
open_buckets_partial_nr
<
if
(
may_realloc
)
{
ARRAY_SIZE
(
ca
->
open_buckets_partial
)
&&
may_realloc
)
{
spin_lock
(
&
c
->
freelist_lock
);
spin_lock
(
&
c
->
freelist_lock
);
ob
->
on_partial_list
=
true
;
ob
->
on_partial_list
=
true
;
c
a
->
open_buckets_partial
[
ca
->
open_buckets_partial_nr
++
]
=
c
->
open_buckets_partial
[
c
->
open_buckets_partial_nr
++
]
=
ob
-
c
->
open_buckets
;
ob
-
c
->
open_buckets
;
spin_unlock
(
&
c
->
freelist_lock
);
spin_unlock
(
&
c
->
freelist_lock
);
...
@@ -394,12 +391,13 @@ static struct open_bucket *try_alloc_partial_bucket(struct bch_fs *c, struct bch
...
@@ -394,12 +391,13 @@ static struct open_bucket *try_alloc_partial_bucket(struct bch_fs *c, struct bch
spin_lock
(
&
c
->
freelist_lock
);
spin_lock
(
&
c
->
freelist_lock
);
for
(
i
=
c
a
->
open_buckets_partial_nr
-
1
;
i
>=
0
;
--
i
)
{
for
(
i
=
c
->
open_buckets_partial_nr
-
1
;
i
>=
0
;
--
i
)
{
ob
=
c
->
open_buckets
+
c
a
->
open_buckets_partial
[
i
];
ob
=
c
->
open_buckets
+
c
->
open_buckets_partial
[
i
];
if
(
reserve
<=
ob
->
alloc_reserve
)
{
if
(
ob
->
dev
==
ca
->
dev_idx
&&
array_remove_item
(
ca
->
open_buckets_partial
,
reserve
<=
ob
->
alloc_reserve
)
{
ca
->
open_buckets_partial_nr
,
array_remove_item
(
c
->
open_buckets_partial
,
c
->
open_buckets_partial_nr
,
i
);
i
);
ob
->
on_partial_list
=
false
;
ob
->
on_partial_list
=
false
;
ob
->
alloc_reserve
=
reserve
;
ob
->
alloc_reserve
=
reserve
;
...
...
fs/bcachefs/bcachefs.h
View file @
39a1ea12
...
@@ -516,9 +516,6 @@ struct bch_dev {
...
@@ -516,9 +516,6 @@ struct bch_dev {
unsigned
nr_open_buckets
;
unsigned
nr_open_buckets
;
unsigned
nr_btree_reserve
;
unsigned
nr_btree_reserve
;
open_bucket_idx_t
open_buckets_partial
[
OPEN_BUCKETS_COUNT
];
open_bucket_idx_t
open_buckets_partial_nr
;
size_t
inc_gen_needs_gc
;
size_t
inc_gen_needs_gc
;
size_t
inc_gen_really_needs_gc
;
size_t
inc_gen_really_needs_gc
;
size_t
buckets_waiting_on_journal
;
size_t
buckets_waiting_on_journal
;
...
@@ -859,6 +856,9 @@ struct bch_fs {
...
@@ -859,6 +856,9 @@ struct bch_fs {
struct
open_bucket
open_buckets
[
OPEN_BUCKETS_COUNT
];
struct
open_bucket
open_buckets
[
OPEN_BUCKETS_COUNT
];
open_bucket_idx_t
open_buckets_hash
[
OPEN_BUCKETS_COUNT
];
open_bucket_idx_t
open_buckets_hash
[
OPEN_BUCKETS_COUNT
];
open_bucket_idx_t
open_buckets_partial
[
OPEN_BUCKETS_COUNT
];
open_bucket_idx_t
open_buckets_partial_nr
;
struct
write_point
btree_write_point
;
struct
write_point
btree_write_point
;
struct
write_point
rebalance_write_point
;
struct
write_point
rebalance_write_point
;
...
...
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