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
dd81a060
Commit
dd81a060
authored
Feb 09, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: ec_stripe_delete_work() now takes ref on c->writes
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
06ab86d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+11
-3
fs/bcachefs/ec.h
fs/bcachefs/ec.h
+2
-0
fs/bcachefs/super.c
fs/bcachefs/super.c
+4
-5
No files found.
fs/bcachefs/ec.c
View file @
dd81a060
...
...
@@ -672,9 +672,8 @@ void bch2_stripes_heap_update(struct bch_fs *c,
heap_verify_backpointer
(
c
,
idx
);
if
(
stripe_idx_to_delete
(
c
)
>=
0
&&
!
percpu_ref_is_dying
(
&
c
->
writes
))
schedule_work
(
&
c
->
ec_stripe_delete_work
);
if
(
stripe_idx_to_delete
(
c
)
>=
0
)
bch2_do_stripe_deletes
(
c
);
}
/* stripe deletion */
...
...
@@ -707,6 +706,15 @@ static void ec_stripe_delete_work(struct work_struct *work)
if
(
ec_stripe_delete
(
c
,
idx
))
break
;
}
percpu_ref_put
(
&
c
->
writes
);
}
void
bch2_do_stripe_deletes
(
struct
bch_fs
*
c
)
{
if
(
percpu_ref_tryget_live
(
&
c
->
writes
)
&&
!
schedule_work
(
&
c
->
ec_stripe_delete_work
))
percpu_ref_put
(
&
c
->
writes
);
}
/* stripe creation: */
...
...
fs/bcachefs/ec.h
View file @
dd81a060
...
...
@@ -213,6 +213,8 @@ void bch2_stripes_heap_update(struct bch_fs *, struct stripe *, size_t);
void
bch2_stripes_heap_del
(
struct
bch_fs
*
,
struct
stripe
*
,
size_t
);
void
bch2_stripes_heap_insert
(
struct
bch_fs
*
,
struct
stripe
*
,
size_t
);
void
bch2_do_stripe_deletes
(
struct
bch_fs
*
);
void
bch2_ec_stop_dev
(
struct
bch_fs
*
,
struct
bch_dev
*
);
void
bch2_ec_flush_new_stripes
(
struct
bch_fs
*
);
...
...
fs/bcachefs/super.c
View file @
dd81a060
...
...
@@ -258,8 +258,6 @@ void bch2_fs_read_only(struct bch_fs *c)
*/
percpu_ref_kill
(
&
c
->
writes
);
cancel_work_sync
(
&
c
->
ec_stripe_delete_work
);
/*
* If we're not doing an emergency shutdown, we want to wait on
* outstanding writes to complete so they don't see spurious errors due
...
...
@@ -391,9 +389,6 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
bch2_dev_allocator_add
(
c
,
ca
);
bch2_recalc_capacity
(
c
);
bch2_do_discards
(
c
);
bch2_do_invalidates
(
c
);
if
(
!
early
)
{
ret
=
bch2_fs_read_write_late
(
c
);
if
(
ret
)
...
...
@@ -403,6 +398,10 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
percpu_ref_reinit
(
&
c
->
writes
);
set_bit
(
BCH_FS_RW
,
&
c
->
flags
);
set_bit
(
BCH_FS_WAS_RW
,
&
c
->
flags
);
bch2_do_discards
(
c
);
bch2_do_invalidates
(
c
);
bch2_do_stripe_deletes
(
c
);
return
0
;
err:
__bch2_fs_read_only
(
c
);
...
...
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