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
74e600c1
Commit
74e600c1
authored
Dec 10, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs; bch2_path_put() -> btree_path_idx_t
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
255ebbbf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
33 deletions
+31
-33
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+20
-22
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+2
-2
fs/bcachefs/btree_update.c
fs/bcachefs/btree_update.c
+2
-2
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update.h
+1
-1
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+6
-6
No files found.
fs/bcachefs/btree_iter.c
View file @
74e600c1
...
...
@@ -1305,19 +1305,18 @@ static struct btree_path *have_node_at_pos(struct btree_trans *trans, struct btr
return
NULL
;
}
static
inline
void
__bch2_path_free
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
)
static
inline
void
__bch2_path_free
(
struct
btree_trans
*
trans
,
btree_path_idx_t
path
)
{
__bch2_btree_path_unlock
(
trans
,
path
);
btree_path_list_remove
(
trans
,
path
);
__clear_bit
(
path
->
idx
,
trans
->
paths_allocated
);
__bch2_btree_path_unlock
(
trans
,
trans
->
paths
+
path
);
btree_path_list_remove
(
trans
,
trans
->
paths
+
path
);
__clear_bit
(
path
,
trans
->
paths_allocated
);
}
void
bch2_path_put
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
,
bool
intent
)
void
bch2_path_put
(
struct
btree_trans
*
trans
,
btree_path_idx_t
path_idx
,
bool
intent
)
{
struct
btree_path
*
dup
;
struct
btree_path
*
path
=
trans
->
paths
+
path_idx
,
*
dup
;
EBUG_ON
(
trans
->
paths
+
path
->
idx
!=
path
);
EBUG_ON
(
!
path
->
ref
);
EBUG_ON
(
path
->
idx
!=
path_idx
);
if
(
!
__btree_path_put
(
path
,
intent
))
return
;
...
...
@@ -1339,16 +1338,15 @@ void bch2_path_put(struct btree_trans *trans, struct btree_path *path, bool inte
dup
->
should_be_locked
|=
path
->
should_be_locked
;
}
__bch2_path_free
(
trans
,
path
);
__bch2_path_free
(
trans
,
path
_idx
);
}
static
void
bch2_path_put_nokeep
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
,
static
void
bch2_path_put_nokeep
(
struct
btree_trans
*
trans
,
btree_path_idx_t
path
,
bool
intent
)
{
EBUG_ON
(
trans
->
paths
+
path
->
idx
!=
path
);
EBUG_ON
(
!
path
->
ref
);
EBUG_ON
(
trans
->
paths
[
path
].
idx
!=
path
);
if
(
!
__btree_path_put
(
path
,
intent
))
if
(
!
__btree_path_put
(
trans
->
paths
+
path
,
intent
))
return
;
__bch2_path_free
(
trans
,
path
);
...
...
@@ -2066,7 +2064,7 @@ struct bkey_s_c bch2_btree_iter_peek_upto(struct btree_iter *iter, struct bpos e
EBUG_ON
((
iter
->
flags
&
BTREE_ITER_FILTER_SNAPSHOTS
)
&&
bkey_eq
(
end
,
POS_MAX
));
if
(
iter
->
update_path
)
{
bch2_path_put_nokeep
(
trans
,
iter
->
update_path
,
bch2_path_put_nokeep
(
trans
,
iter
->
update_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
iter
->
update_path
=
NULL
;
}
...
...
@@ -2095,7 +2093,7 @@ struct bkey_s_c bch2_btree_iter_peek_upto(struct btree_iter *iter, struct bpos e
if
(
iter
->
update_path
&&
!
bkey_eq
(
iter
->
update_path
->
pos
,
k
.
k
->
p
))
{
bch2_path_put_nokeep
(
trans
,
iter
->
update_path
,
bch2_path_put_nokeep
(
trans
,
iter
->
update_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
iter
->
update_path
=
NULL
;
}
...
...
@@ -2278,7 +2276,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter)
* that candidate
*/
if
(
saved_path
&&
!
bkey_eq
(
k
.
k
->
p
,
saved_k
.
p
))
{
bch2_path_put_nokeep
(
trans
,
iter
->
path
,
bch2_path_put_nokeep
(
trans
,
iter
->
path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
iter
->
path
=
saved_path
;
saved_path
=
NULL
;
...
...
@@ -2291,7 +2289,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter)
iter
->
snapshot
,
k
.
k
->
p
.
snapshot
))
{
if
(
saved_path
)
bch2_path_put_nokeep
(
trans
,
saved_path
,
bch2_path_put_nokeep
(
trans
,
saved_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
saved_path
=
btree_path_clone
(
trans
,
iter
->
path
,
iter
->
flags
&
BTREE_ITER_INTENT
);
...
...
@@ -2335,7 +2333,7 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter)
btree_path_set_should_be_locked
(
iter
->
path
);
out_no_locked:
if
(
saved_path
)
bch2_path_put_nokeep
(
trans
,
saved_path
,
iter
->
flags
&
BTREE_ITER_INTENT
);
bch2_path_put_nokeep
(
trans
,
saved_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
bch2_btree_iter_verify_entry_exit
(
iter
);
bch2_btree_iter_verify
(
iter
);
...
...
@@ -2639,13 +2637,13 @@ static inline void btree_path_list_add(struct btree_trans *trans,
void
bch2_trans_iter_exit
(
struct
btree_trans
*
trans
,
struct
btree_iter
*
iter
)
{
if
(
iter
->
update_path
)
bch2_path_put_nokeep
(
trans
,
iter
->
update_path
,
bch2_path_put_nokeep
(
trans
,
iter
->
update_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
if
(
iter
->
path
)
bch2_path_put
(
trans
,
iter
->
path
,
bch2_path_put
(
trans
,
iter
->
path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
if
(
iter
->
key_cache_path
)
bch2_path_put
(
trans
,
iter
->
key_cache_path
,
bch2_path_put
(
trans
,
iter
->
key_cache_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
iter
->
path
=
NULL
;
iter
->
update_path
=
NULL
;
...
...
@@ -2814,7 +2812,7 @@ u32 bch2_trans_begin(struct btree_trans *trans)
* iterators if we do that
*/
if
(
!
path
->
ref
&&
!
path
->
preserve
)
__bch2_path_free
(
trans
,
path
);
__bch2_path_free
(
trans
,
path
->
idx
);
else
path
->
preserve
=
false
;
}
...
...
fs/bcachefs/btree_iter.h
View file @
74e600c1
...
...
@@ -254,7 +254,7 @@ void bch2_btree_node_iter_fix(struct btree_trans *trans, struct btree_path *,
int
bch2_btree_path_relock_intent
(
struct
btree_trans
*
,
struct
btree_path
*
);
void
bch2_path_put
(
struct
btree_trans
*
,
struct
btree_path
*
,
bool
);
void
bch2_path_put
(
struct
btree_trans
*
,
btree_path_idx_t
,
bool
);
int
bch2_trans_relock
(
struct
btree_trans
*
);
int
bch2_trans_relock_notrace
(
struct
btree_trans
*
);
...
...
@@ -360,7 +360,7 @@ static inline void __bch2_btree_iter_set_pos(struct btree_iter *iter, struct bpo
static
inline
void
bch2_btree_iter_set_pos
(
struct
btree_iter
*
iter
,
struct
bpos
new_pos
)
{
if
(
unlikely
(
iter
->
update_path
))
bch2_path_put
(
iter
->
trans
,
iter
->
update_path
,
bch2_path_put
(
iter
->
trans
,
iter
->
update_path
->
idx
,
iter
->
flags
&
BTREE_ITER_INTENT
);
iter
->
update_path
=
NULL
;
...
...
fs/bcachefs/btree_update.c
View file @
74e600c1
...
...
@@ -372,7 +372,7 @@ static noinline int flush_new_cached_update(struct btree_trans *trans,
btree_path_set_should_be_locked
(
btree_path
);
ret
=
bch2_trans_update_by_path
(
trans
,
btree_path
,
i
->
k
,
flags
,
ip
);
out:
bch2_path_put
(
trans
,
btree_path
,
true
);
bch2_path_put
(
trans
,
btree_path
->
idx
,
true
);
return
ret
;
}
...
...
@@ -419,7 +419,7 @@ bch2_trans_update_by_path(struct btree_trans *trans, struct btree_path *path,
if
(
!
cmp
&&
i
<
trans
->
updates
+
trans
->
nr_updates
)
{
EBUG_ON
(
i
->
insert_trigger_run
||
i
->
overwrite_trigger_run
);
bch2_path_put
(
trans
,
i
->
path
,
true
);
bch2_path_put
(
trans
,
i
->
path
->
idx
,
true
);
i
->
flags
=
n
.
flags
;
i
->
cached
=
n
.
cached
;
i
->
k
=
n
.
k
;
...
...
fs/bcachefs/btree_update.h
View file @
74e600c1
...
...
@@ -194,7 +194,7 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
static
inline
void
bch2_trans_reset_updates
(
struct
btree_trans
*
trans
)
{
trans_for_each_update
(
trans
,
i
)
bch2_path_put
(
trans
,
i
->
path
,
true
);
bch2_path_put
(
trans
,
i
->
path
->
idx
,
true
);
trans
->
extra_journal_res
=
0
;
trans
->
nr_updates
=
0
;
...
...
fs/bcachefs/btree_update_interior.c
View file @
74e600c1
...
...
@@ -720,7 +720,7 @@ static void btree_update_nodes_written(struct btree_update *as)
btree_node_write_if_need
(
c
,
b
,
SIX_LOCK_intent
);
btree_node_unlock
(
trans
,
path
,
b
->
c
.
level
);
bch2_path_put
(
trans
,
path
,
true
);
bch2_path_put
(
trans
,
path
->
idx
,
true
);
}
bch2_journal_pin_drop
(
&
c
->
journal
,
&
as
->
journal
);
...
...
@@ -1615,11 +1615,11 @@ static int btree_split(struct btree_update *as, struct btree_trans *trans,
out:
if
(
path2
)
{
__bch2_btree_path_unlock
(
trans
,
path2
);
bch2_path_put
(
trans
,
path2
,
true
);
bch2_path_put
(
trans
,
path2
->
idx
,
true
);
}
if
(
path1
)
{
__bch2_btree_path_unlock
(
trans
,
path1
);
bch2_path_put
(
trans
,
path1
,
true
);
bch2_path_put
(
trans
,
path1
->
idx
,
true
);
}
bch2_trans_verify_locks
(
trans
);
...
...
@@ -1926,8 +1926,8 @@ int __bch2_foreground_maybe_merge(struct btree_trans *trans,
out:
err:
if
(
new_path
)
bch2_path_put
(
trans
,
new_path
,
true
);
bch2_path_put
(
trans
,
sib_path
,
true
);
bch2_path_put
(
trans
,
new_path
->
idx
,
true
);
bch2_path_put
(
trans
,
sib_path
->
idx
,
true
);
bch2_trans_verify_locks
(
trans
);
return
ret
;
err_free_update:
...
...
@@ -1992,7 +1992,7 @@ int bch2_btree_node_rewrite(struct btree_trans *trans,
bch2_btree_update_done
(
as
,
trans
);
out:
if
(
new_path
)
bch2_path_put
(
trans
,
new_path
,
true
);
bch2_path_put
(
trans
,
new_path
->
idx
,
true
);
bch2_trans_downgrade
(
trans
);
return
ret
;
err:
...
...
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