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
91b5d97f
Commit
91b5d97f
authored
Apr 12, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: get_unlocked_mut_path -> bch2_path_get_unlocked_mut
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
d434c239
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
23 deletions
+26
-23
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+16
-0
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+3
-0
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+7
-23
No files found.
fs/bcachefs/btree_iter.c
View file @
91b5d97f
...
...
@@ -1729,6 +1729,22 @@ btree_path_idx_t bch2_path_get(struct btree_trans *trans,
return
path_idx
;
}
btree_path_idx_t
bch2_path_get_unlocked_mut
(
struct
btree_trans
*
trans
,
enum
btree_id
btree_id
,
unsigned
level
,
struct
bpos
pos
)
{
btree_path_idx_t
path_idx
=
bch2_path_get
(
trans
,
btree_id
,
pos
,
level
+
1
,
level
,
BTREE_ITER_nopreserve
|
BTREE_ITER_intent
,
_RET_IP_
);
path_idx
=
bch2_btree_path_make_mut
(
trans
,
path_idx
,
true
,
_RET_IP_
);
struct
btree_path
*
path
=
trans
->
paths
+
path_idx
;
bch2_btree_path_downgrade
(
trans
,
path
);
__bch2_btree_path_unlock
(
trans
,
path
);
return
path_idx
;
}
struct
bkey_s_c
bch2_btree_path_peek_slot
(
struct
btree_path
*
path
,
struct
bkey
*
u
)
{
...
...
fs/bcachefs/btree_iter.h
View file @
91b5d97f
...
...
@@ -227,6 +227,9 @@ static inline int __must_check bch2_btree_path_traverse(struct btree_trans *tran
btree_path_idx_t
bch2_path_get
(
struct
btree_trans
*
,
enum
btree_id
,
struct
bpos
,
unsigned
,
unsigned
,
unsigned
,
unsigned
long
);
btree_path_idx_t
bch2_path_get_unlocked_mut
(
struct
btree_trans
*
,
enum
btree_id
,
unsigned
,
struct
bpos
);
struct
bkey_s_c
bch2_btree_path_peek_slot
(
struct
btree_path
*
,
struct
bkey
*
);
/*
...
...
fs/bcachefs/btree_update_interior.c
View file @
91b5d97f
...
...
@@ -38,22 +38,6 @@ static int bch2_btree_insert_node(struct btree_update *, struct btree_trans *,
btree_path_idx_t
,
struct
btree
*
,
struct
keylist
*
);
static
void
bch2_btree_update_add_new_node
(
struct
btree_update
*
,
struct
btree
*
);
static
btree_path_idx_t
get_unlocked_mut_path
(
struct
btree_trans
*
trans
,
enum
btree_id
btree_id
,
unsigned
level
,
struct
bpos
pos
)
{
btree_path_idx_t
path_idx
=
bch2_path_get
(
trans
,
btree_id
,
pos
,
level
+
1
,
level
,
BTREE_ITER_nopreserve
|
BTREE_ITER_intent
,
_RET_IP_
);
path_idx
=
bch2_btree_path_make_mut
(
trans
,
path_idx
,
true
,
_RET_IP_
);
struct
btree_path
*
path
=
trans
->
paths
+
path_idx
;
bch2_btree_path_downgrade
(
trans
,
path
);
__bch2_btree_path_unlock
(
trans
,
path
);
return
path_idx
;
}
/*
* Verify that child nodes correctly span parent node's range:
*/
...
...
@@ -753,7 +737,7 @@ static void btree_update_nodes_written(struct btree_update *as)
*/
b
=
READ_ONCE
(
as
->
b
);
if
(
b
)
{
btree_path_idx_t
path_idx
=
get_unlocked_mut_path
(
trans
,
btree_path_idx_t
path_idx
=
bch2_path_get_unlocked_mut
(
trans
,
as
->
btree_id
,
b
->
c
.
level
,
b
->
key
.
k
.
p
);
struct
btree_path
*
path
=
trans
->
paths
+
path_idx
;
/*
...
...
@@ -773,7 +757,7 @@ static void btree_update_nodes_written(struct btree_update *as)
* btree_node_lock_nopath() (the use of which is always suspect,
* we need to work on removing this in the future)
*
* It should be, but
get_unlocked_mut_path
() -> bch2_path_get()
* It should be, but
bch2_path_get_unlocked_mut
() -> bch2_path_get()
* calls bch2_path_upgrade(), before we call path_make_mut(), so
* we may rarely end up with a locked path besides the one we
* have here:
...
...
@@ -1637,12 +1621,12 @@ static int btree_split(struct btree_update *as, struct btree_trans *trans,
six_unlock_write
(
&
n2
->
c
.
lock
);
six_unlock_write
(
&
n1
->
c
.
lock
);
path1
=
get_unlocked_mut_path
(
trans
,
as
->
btree_id
,
n1
->
c
.
level
,
n1
->
key
.
k
.
p
);
path1
=
bch2_path_get_unlocked_mut
(
trans
,
as
->
btree_id
,
n1
->
c
.
level
,
n1
->
key
.
k
.
p
);
six_lock_increment
(
&
n1
->
c
.
lock
,
SIX_LOCK_intent
);
mark_btree_node_locked
(
trans
,
trans
->
paths
+
path1
,
n1
->
c
.
level
,
BTREE_NODE_INTENT_LOCKED
);
bch2_btree_path_level_init
(
trans
,
trans
->
paths
+
path1
,
n1
);
path2
=
get_unlocked_mut_path
(
trans
,
as
->
btree_id
,
n2
->
c
.
level
,
n2
->
key
.
k
.
p
);
path2
=
bch2_path_get_unlocked_mut
(
trans
,
as
->
btree_id
,
n2
->
c
.
level
,
n2
->
key
.
k
.
p
);
six_lock_increment
(
&
n2
->
c
.
lock
,
SIX_LOCK_intent
);
mark_btree_node_locked
(
trans
,
trans
->
paths
+
path2
,
n2
->
c
.
level
,
BTREE_NODE_INTENT_LOCKED
);
bch2_btree_path_level_init
(
trans
,
trans
->
paths
+
path2
,
n2
);
...
...
@@ -1687,7 +1671,7 @@ static int btree_split(struct btree_update *as, struct btree_trans *trans,
bch2_btree_update_add_new_node
(
as
,
n1
);
six_unlock_write
(
&
n1
->
c
.
lock
);
path1
=
get_unlocked_mut_path
(
trans
,
as
->
btree_id
,
n1
->
c
.
level
,
n1
->
key
.
k
.
p
);
path1
=
bch2_path_get_unlocked_mut
(
trans
,
as
->
btree_id
,
n1
->
c
.
level
,
n1
->
key
.
k
.
p
);
six_lock_increment
(
&
n1
->
c
.
lock
,
SIX_LOCK_intent
);
mark_btree_node_locked
(
trans
,
trans
->
paths
+
path1
,
n1
->
c
.
level
,
BTREE_NODE_INTENT_LOCKED
);
bch2_btree_path_level_init
(
trans
,
trans
->
paths
+
path1
,
n1
);
...
...
@@ -2090,7 +2074,7 @@ int __bch2_foreground_maybe_merge(struct btree_trans *trans,
bch2_btree_update_add_new_node
(
as
,
n
);
six_unlock_write
(
&
n
->
c
.
lock
);
new_path
=
get_unlocked_mut_path
(
trans
,
btree
,
n
->
c
.
level
,
n
->
key
.
k
.
p
);
new_path
=
bch2_path_get_unlocked_mut
(
trans
,
btree
,
n
->
c
.
level
,
n
->
key
.
k
.
p
);
six_lock_increment
(
&
n
->
c
.
lock
,
SIX_LOCK_intent
);
mark_btree_node_locked
(
trans
,
trans
->
paths
+
new_path
,
n
->
c
.
level
,
BTREE_NODE_INTENT_LOCKED
);
bch2_btree_path_level_init
(
trans
,
trans
->
paths
+
new_path
,
n
);
...
...
@@ -2168,7 +2152,7 @@ int bch2_btree_node_rewrite(struct btree_trans *trans,
bch2_btree_update_add_new_node
(
as
,
n
);
six_unlock_write
(
&
n
->
c
.
lock
);
new_path
=
get_unlocked_mut_path
(
trans
,
iter
->
btree_id
,
n
->
c
.
level
,
n
->
key
.
k
.
p
);
new_path
=
bch2_path_get_unlocked_mut
(
trans
,
iter
->
btree_id
,
n
->
c
.
level
,
n
->
key
.
k
.
p
);
six_lock_increment
(
&
n
->
c
.
lock
,
SIX_LOCK_intent
);
mark_btree_node_locked
(
trans
,
trans
->
paths
+
new_path
,
n
->
c
.
level
,
BTREE_NODE_INTENT_LOCKED
);
bch2_btree_path_level_init
(
trans
,
trans
->
paths
+
new_path
,
n
);
...
...
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