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
60755344
Commit
60755344
authored
May 10, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: kill BTREE_ITER_NOUNLOCK
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
b03b81df
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
26 deletions
+11
-26
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_cache.c
+1
-2
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+2
-5
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+1
-1
fs/bcachefs/btree_locking.h
fs/bcachefs/btree_locking.h
+1
-1
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+1
-1
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/btree_update_leaf.c
+5
-16
No files found.
fs/bcachefs/btree_cache.c
View file @
60755344
...
...
@@ -806,8 +806,7 @@ struct btree *bch2_btree_node_get_sibling(struct bch_fs *c,
ret
=
bch2_btree_node_get
(
c
,
iter
,
&
tmp
.
k
,
level
,
SIX_LOCK_intent
);
if
(
PTR_ERR_OR_ZERO
(
ret
)
==
-
EINTR
&&
!
(
iter
->
flags
&
BTREE_ITER_NOUNLOCK
))
{
if
(
PTR_ERR_OR_ZERO
(
ret
)
==
-
EINTR
&&
!
trans
->
nounlock
)
{
struct
btree_iter
*
linked
;
if
(
!
bch2_btree_node_relock
(
iter
,
level
+
1
))
...
...
fs/bcachefs/btree_iter.c
View file @
60755344
...
...
@@ -224,7 +224,7 @@ bool __bch2_btree_node_lock(struct btree *b, struct bpos pos,
*/
if
(
type
==
SIX_LOCK_intent
&&
linked
->
nodes_locked
!=
linked
->
nodes_intent_locked
)
{
if
(
!
(
iter
->
flags
&
BTREE_ITER_NOUNLOCK
))
{
if
(
!
(
iter
->
trans
->
nounlock
))
{
linked
->
locks_want
=
max_t
(
unsigned
,
linked
->
locks_want
,
__fls
(
linked
->
nodes_locked
)
+
1
);
...
...
@@ -240,7 +240,7 @@ bool __bch2_btree_node_lock(struct btree *b, struct bpos pos,
*/
if
(
linked
->
btree_id
==
iter
->
btree_id
&&
level
>
__fls
(
linked
->
nodes_locked
))
{
if
(
!
(
iter
->
flags
&
BTREE_ITER_NOUNLOCK
))
{
if
(
!
(
iter
->
trans
->
nounlock
))
{
linked
->
locks_want
=
max
(
level
+
1
,
max_t
(
unsigned
,
linked
->
locks_want
,
...
...
@@ -269,9 +269,6 @@ void bch2_btree_iter_verify_locks(struct btree_iter *iter)
{
unsigned
l
;
BUG_ON
((
iter
->
flags
&
BTREE_ITER_NOUNLOCK
)
&&
!
btree_node_locked
(
iter
,
0
));
for
(
l
=
0
;
btree_iter_node
(
iter
,
l
);
l
++
)
{
if
(
iter
->
uptodate
>=
BTREE_ITER_NEED_RELOCK
&&
!
btree_node_locked
(
iter
,
l
))
...
...
fs/bcachefs/btree_iter.h
View file @
60755344
...
...
@@ -117,7 +117,7 @@ static inline bool bch2_btree_iter_upgrade(struct btree_iter *iter,
new_locks_want
=
min
(
new_locks_want
,
BTREE_MAX_DEPTH
);
return
iter
->
locks_want
<
new_locks_want
?
(
!
(
iter
->
flags
&
BTREE_ITER_NOUNLOCK
)
?
(
!
iter
->
trans
->
nounlock
?
__bch2_btree_iter_upgrade
(
iter
,
new_locks_want
)
:
__bch2_btree_iter_upgrade_nounlock
(
iter
,
new_locks_want
))
:
iter
->
uptodate
<=
BTREE_ITER_NEED_PEEK
;
...
...
fs/bcachefs/btree_locking.h
View file @
60755344
...
...
@@ -107,7 +107,7 @@ static inline void __btree_node_unlock(struct btree_iter *iter, unsigned level)
static
inline
void
btree_node_unlock
(
struct
btree_iter
*
iter
,
unsigned
level
)
{
BUG_ON
(
!
level
&&
iter
->
flags
&
BTREE_ITER_NOUNLOCK
);
EBUG_ON
(
!
level
&&
iter
->
trans
->
nounlock
);
__btree_node_unlock
(
iter
,
level
);
}
...
...
fs/bcachefs/btree_types.h
View file @
60755344
...
...
@@ -197,7 +197,6 @@ enum btree_iter_type {
*/
#define BTREE_ITER_IS_EXTENTS (1 << 4)
#define BTREE_ITER_ERROR (1 << 5)
#define BTREE_ITER_NOUNLOCK (1 << 6)
enum
btree_iter_uptodate
{
BTREE_ITER_UPTODATE
=
0
,
...
...
@@ -287,6 +286,7 @@ struct btree_trans {
u8
size
;
unsigned
used_mempool
:
1
;
unsigned
error
:
1
;
unsigned
nounlock
:
1
;
unsigned
mem_top
;
unsigned
mem_bytes
;
...
...
fs/bcachefs/btree_update_leaf.c
View file @
60755344
...
...
@@ -551,7 +551,6 @@ static inline int do_btree_insert_at(struct btree_trans *trans,
struct
bch_fs
*
c
=
trans
->
c
;
struct
bch_fs_usage_online
*
fs_usage
=
NULL
;
struct
btree_insert_entry
*
i
;
struct
btree_iter
*
linked
;
int
ret
;
if
(
likely
(
!
(
trans
->
flags
&
BTREE_INSERT_NO_CLEAR_REPLICAS
)))
{
...
...
@@ -624,17 +623,6 @@ static inline int do_btree_insert_at(struct btree_trans *trans,
i
->
k
->
k
.
version
=
MAX_VERSION
;
}
if
(
trans
->
flags
&
BTREE_INSERT_NOUNLOCK
)
{
/*
* linked iterators that weren't being updated may or may not
* have been traversed/locked, depending on what the caller was
* doing:
*/
trans_for_each_iter
(
trans
,
linked
)
if
(
linked
->
uptodate
<
BTREE_ITER_NEED_RELOCK
)
linked
->
flags
|=
BTREE_ITER_NOUNLOCK
;
}
trans_for_each_update_iter
(
trans
,
i
)
if
(
update_has_triggers
(
trans
,
i
)
&&
!
update_triggers_transactional
(
trans
,
i
))
...
...
@@ -809,7 +797,6 @@ static int __bch2_trans_commit(struct btree_trans *trans,
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
struct
btree_iter
*
linked
;
int
ret
;
trans_for_each_update_iter
(
trans
,
i
)
{
...
...
@@ -832,18 +819,20 @@ static int __bch2_trans_commit(struct btree_trans *trans,
if
(
unlikely
(
ret
))
goto
err
;
if
(
trans
->
flags
&
BTREE_INSERT_NOUNLOCK
)
trans
->
nounlock
=
true
;
trans_for_each_update_leaf
(
trans
,
i
)
bch2_foreground_maybe_merge
(
c
,
i
->
iter
,
0
,
trans
->
flags
);
trans
->
nounlock
=
false
;
trans_for_each_update_iter
(
trans
,
i
)
bch2_btree_iter_downgrade
(
i
->
iter
);
err:
/* make sure we didn't drop or screw up locks: */
bch2_btree_trans_verify_locks
(
trans
);
trans_for_each_iter
(
trans
,
linked
)
linked
->
flags
&=
~
BTREE_ITER_NOUNLOCK
;
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