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
53beb841
Commit
53beb841
authored
Apr 16, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: lockdep fix when going rw from bch2_alloc_write()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
c6dd04f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+23
-12
No files found.
fs/bcachefs/alloc_background.c
View file @
53beb841
...
@@ -411,21 +411,21 @@ static int __bch2_alloc_write_key(struct btree_trans *trans, struct bch_dev *ca,
...
@@ -411,21 +411,21 @@ static int __bch2_alloc_write_key(struct btree_trans *trans, struct bch_dev *ca,
int
bch2_alloc_write
(
struct
bch_fs
*
c
,
unsigned
flags
,
bool
*
wrote
)
int
bch2_alloc_write
(
struct
bch_fs
*
c
,
unsigned
flags
,
bool
*
wrote
)
{
{
struct
btree_trans
trans
;
struct
btree_iter
*
iter
;
struct
bucket_array
*
buckets
;
struct
bch_dev
*
ca
;
struct
bch_dev
*
ca
;
unsigned
i
;
unsigned
i
;
size_t
b
;
int
ret
=
0
;
int
ret
=
0
;
for_each_rw_member
(
ca
,
c
,
i
)
{
bch2_trans_init
(
&
trans
,
c
);
struct
btree_trans
trans
;
struct
btree_iter
*
iter
;
struct
bucket_array
*
buckets
;
size_t
b
;
bch2_trans_init
(
&
trans
,
c
);
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_ALLOC
,
POS_MIN
,
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_ALLOC
,
POS_MIN
,
BTREE_ITER_SLOTS
|
BTREE_ITER_INTENT
);
BTREE_ITER_SLOTS
|
BTREE_ITER_INTENT
);
for_each_rw_member
(
ca
,
c
,
i
)
{
relock:
down_read
(
&
ca
->
bucket_lock
);
down_read
(
&
ca
->
bucket_lock
);
buckets
=
bucket_array
(
ca
);
buckets
=
bucket_array
(
ca
);
...
@@ -435,6 +435,17 @@ int bch2_alloc_write(struct bch_fs *c, unsigned flags, bool *wrote)
...
@@ -435,6 +435,17 @@ int bch2_alloc_write(struct bch_fs *c, unsigned flags, bool *wrote)
if
(
!
buckets
->
b
[
b
].
mark
.
dirty
)
if
(
!
buckets
->
b
[
b
].
mark
.
dirty
)
continue
;
continue
;
if
((
flags
&
BTREE_INSERT_LAZY_RW
)
&&
percpu_ref_is_zero
(
&
c
->
writes
))
{
up_read
(
&
ca
->
bucket_lock
);
bch2_trans_unlock
(
&
trans
);
ret
=
bch2_fs_read_write_early
(
c
);
if
(
ret
)
goto
out
;
goto
relock
;
}
ret
=
__bch2_alloc_write_key
(
&
trans
,
ca
,
b
,
ret
=
__bch2_alloc_write_key
(
&
trans
,
ca
,
b
,
iter
,
flags
);
iter
,
flags
);
if
(
ret
)
if
(
ret
)
...
@@ -444,15 +455,15 @@ int bch2_alloc_write(struct bch_fs *c, unsigned flags, bool *wrote)
...
@@ -444,15 +455,15 @@ int bch2_alloc_write(struct bch_fs *c, unsigned flags, bool *wrote)
*
wrote
=
true
;
*
wrote
=
true
;
}
}
up_read
(
&
ca
->
bucket_lock
);
up_read
(
&
ca
->
bucket_lock
);
out:
bch2_trans_exit
(
&
trans
);
if
(
ret
)
{
if
(
ret
)
{
percpu_ref_put
(
&
ca
->
io_ref
);
percpu_ref_put
(
&
ca
->
io_ref
);
break
;
break
;
}
}
}
}
bch2_trans_exit
(
&
trans
);
return
ret
;
return
ret
;
}
}
...
...
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