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
32913f49
Commit
32913f49
authored
Jun 16, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
six locks: Seq now only incremented on unlock
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
2804d0f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
16 deletions
+3
-16
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+0
-1
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+1
-8
fs/bcachefs/btree_locking.h
fs/bcachefs/btree_locking.h
+2
-2
fs/bcachefs/six.c
fs/bcachefs/six.c
+0
-5
No files found.
fs/bcachefs/btree_iter.c
View file @
32913f49
...
...
@@ -652,7 +652,6 @@ void bch2_btree_path_level_init(struct btree_trans *trans,
BUG_ON
(
path
->
cached
);
EBUG_ON
(
!
btree_path_pos_in_node
(
path
,
b
));
EBUG_ON
(
six_lock_seq
(
&
b
->
c
.
lock
)
&
1
);
path
->
l
[
b
->
c
.
level
].
lock_seq
=
six_lock_seq
(
&
b
->
c
.
lock
);
path
->
l
[
b
->
c
.
level
].
b
=
b
;
...
...
fs/bcachefs/btree_iter.h
View file @
32913f49
...
...
@@ -42,14 +42,7 @@ static inline struct btree *btree_path_node(struct btree_path *path,
static
inline
bool
btree_node_lock_seq_matches
(
const
struct
btree_path
*
path
,
const
struct
btree
*
b
,
unsigned
level
)
{
/*
* We don't compare the low bits of the lock sequence numbers because
* @path might have taken a write lock on @b, and we don't want to skip
* the linked path if the sequence numbers were equal before taking that
* write lock. The lock sequence number is incremented by taking and
* releasing write locks and is even when unlocked:
*/
return
path
->
l
[
level
].
lock_seq
>>
1
==
six_lock_seq
(
&
b
->
c
.
lock
)
>>
1
;
return
path
->
l
[
level
].
lock_seq
==
six_lock_seq
(
&
b
->
c
.
lock
);
}
static
inline
struct
btree
*
btree_node_parent
(
struct
btree_path
*
path
,
...
...
fs/bcachefs/btree_locking.h
View file @
32913f49
...
...
@@ -175,13 +175,13 @@ bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_pat
struct
btree_path
*
linked
;
EBUG_ON
(
path
->
l
[
b
->
c
.
level
].
b
!=
b
);
EBUG_ON
(
path
->
l
[
b
->
c
.
level
].
lock_seq
+
1
!=
six_lock_seq
(
&
b
->
c
.
lock
));
EBUG_ON
(
path
->
l
[
b
->
c
.
level
].
lock_seq
!=
six_lock_seq
(
&
b
->
c
.
lock
));
EBUG_ON
(
btree_node_locked_type
(
path
,
b
->
c
.
level
)
!=
SIX_LOCK_write
);
mark_btree_node_locked_noreset
(
path
,
b
->
c
.
level
,
SIX_LOCK_intent
);
trans_for_each_path_with_node
(
trans
,
b
,
linked
)
linked
->
l
[
b
->
c
.
level
].
lock_seq
+=
2
;
linked
->
l
[
b
->
c
.
level
].
lock_seq
++
;
six_unlock_write
(
&
b
->
c
.
lock
);
}
...
...
fs/bcachefs/six.c
View file @
32913f49
...
...
@@ -302,9 +302,6 @@ bool six_trylock_ip(struct six_lock *lock, enum six_lock_type type, unsigned lon
if
(
type
!=
SIX_LOCK_write
)
six_acquire
(
&
lock
->
dep_map
,
1
,
type
==
SIX_LOCK_read
,
ip
);
else
lock
->
seq
++
;
return
true
;
}
EXPORT_SYMBOL_GPL
(
six_trylock_ip
);
...
...
@@ -596,8 +593,6 @@ int six_lock_ip_waiter(struct six_lock *lock, enum six_lock_type type,
ret
=
do_six_trylock
(
lock
,
type
,
true
)
?
0
:
six_lock_slowpath
(
lock
,
type
,
wait
,
should_sleep_fn
,
p
,
ip
);
lock
->
seq
+=
!
ret
&&
type
==
SIX_LOCK_write
;
if
(
ret
&&
type
!=
SIX_LOCK_write
)
six_release
(
&
lock
->
dep_map
,
ip
);
if
(
!
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