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
1633e492
Commit
1633e492
authored
Feb 28, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: improved flush_held_btree_writes()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
6409c6a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
22 deletions
+17
-22
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+13
-20
fs/bcachefs/recovery.c
fs/bcachefs/recovery.c
+4
-2
No files found.
fs/bcachefs/alloc_background.c
View file @
1633e492
...
...
@@ -1467,24 +1467,16 @@ int bch2_dev_allocator_start(struct bch_dev *ca)
return
0
;
}
static
void
flush_held_btree_writes
(
struct
bch_fs
*
c
)
static
bool
flush_done
(
struct
bch_fs
*
c
)
{
struct
bucket_table
*
tbl
;
struct
rhash_head
*
pos
;
struct
btree
*
b
;
bool
nodes_
blocked
;
bool
nodes_
unwritten
;
size_t
i
;
struct
closure
cl
;
closure_init_stack
(
&
cl
);
clear_bit
(
BCH_FS_HOLD_BTREE_WRITES
,
&
c
->
flags
);
again:
pr_debug
(
"flushing dirty btree nodes"
);
cond_resched
();
closure_wait
(
&
c
->
btree_interior_update_wait
,
&
cl
);
nodes_blocked
=
false
;
nodes_unwritten
=
false
;
rcu_read_lock
();
for_each_cached_btree
(
b
,
c
,
tbl
,
i
,
pos
)
...
...
@@ -1496,24 +1488,25 @@ static void flush_held_btree_writes(struct bch_fs *c)
six_unlock_read
(
&
b
->
lock
);
goto
again
;
}
else
{
nodes_
blocked
=
true
;
nodes_
unwritten
=
true
;
}
}
rcu_read_unlock
();
if
(
c
->
btree_roots_dirty
)
if
(
c
->
btree_roots_dirty
)
{
bch2_journal_meta
(
&
c
->
journal
);
if
(
nodes_blocked
)
{
closure_sync
(
&
cl
);
goto
again
;
}
closure_wake_up
(
&
c
->
btree_interior_update_wait
);
closure_sync
(
&
cl
);
return
!
nodes_unwritten
&&
!
bch2_btree_interior_updates_nr_pending
(
c
);
}
static
void
flush_held_btree_writes
(
struct
bch_fs
*
c
)
{
clear_bit
(
BCH_FS_HOLD_BTREE_WRITES
,
&
c
->
flags
);
closure_wait_event
(
&
c
->
btree_interior_update_wait
,
!
bch2_btree_interior_updates_nr_pending
(
c
));
closure_wait_event
(
&
c
->
btree_interior_update_wait
,
flush_done
(
c
));
}
static
void
allocator_start_issue_discards
(
struct
bch_fs
*
c
)
...
...
fs/bcachefs/recovery.c
View file @
1633e492
...
...
@@ -413,11 +413,13 @@ int bch2_fs_initialize(struct bch_fs *c)
bch2_btree_root_alloc
(
c
,
i
);
err
=
"unable to allocate journal buckets"
;
for_each_online_member
(
ca
,
c
,
i
)
if
(
bch2_dev_journal_alloc
(
ca
))
{
for_each_online_member
(
ca
,
c
,
i
)
{
ret
=
bch2_dev_journal_alloc
(
ca
);
if
(
ret
)
{
percpu_ref_put
(
&
ca
->
io_ref
);
goto
err
;
}
}
/*
* journal_res_get() will crash if called before this has
...
...
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