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
398c9834
Commit
398c9834
authored
Dec 11, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: kill btree_path.idx
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
d7e14035
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
31 deletions
+8
-31
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+1
-6
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+6
-22
fs/bcachefs/btree_locking.c
fs/bcachefs/btree_locking.c
+1
-1
fs/bcachefs/btree_locking.h
fs/bcachefs/btree_locking.h
+0
-1
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+0
-1
No files found.
fs/bcachefs/btree_iter.c
View file @
398c9834
...
...
@@ -1324,8 +1324,6 @@ void bch2_path_put(struct btree_trans *trans, btree_path_idx_t path_idx, bool in
{
struct
btree_path
*
path
=
trans
->
paths
+
path_idx
,
*
dup
;
EBUG_ON
(
path
->
idx
!=
path_idx
);
if
(
!
__btree_path_put
(
path
,
intent
))
return
;
...
...
@@ -1352,8 +1350,6 @@ void bch2_path_put(struct btree_trans *trans, btree_path_idx_t path_idx, bool in
static
void
bch2_path_put_nokeep
(
struct
btree_trans
*
trans
,
btree_path_idx_t
path
,
bool
intent
)
{
EBUG_ON
(
trans
->
paths
[
path
].
idx
!=
path
);
if
(
!
__btree_path_put
(
trans
->
paths
+
path
,
intent
))
return
;
...
...
@@ -1542,7 +1538,6 @@ static inline btree_path_idx_t btree_path_alloc(struct btree_trans *trans,
__set_bit
(
idx
,
trans
->
paths_allocated
);
struct
btree_path
*
path
=
&
trans
->
paths
[
idx
];
path
->
idx
=
idx
;
path
->
ref
=
0
;
path
->
intent_ref
=
0
;
path
->
nodes_locked
=
0
;
...
...
@@ -3090,7 +3085,7 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans)
prt_printf
(
out
,
"%i %s
\n
"
,
task
?
task
->
pid
:
0
,
trans
->
fn
);
trans_for_each_path
_safe
(
trans
,
path
,
idx
)
{
trans_for_each_path
(
trans
,
path
,
idx
)
{
if
(
!
path
->
nodes_locked
)
continue
;
...
...
fs/bcachefs/btree_iter.h
View file @
398c9834
...
...
@@ -64,40 +64,24 @@ static inline void btree_trans_sort_paths(struct btree_trans *trans)
}
static
inline
struct
btree_path
*
__trans_next_path
_safe
(
struct
btree_trans
*
trans
,
unsigned
*
idx
)
__trans_next_path
(
struct
btree_trans
*
trans
,
unsigned
*
idx
)
{
*
idx
=
find_next_bit
(
trans
->
paths_allocated
,
BTREE_ITER_MAX
,
*
idx
);
if
(
*
idx
==
BTREE_ITER_MAX
)
return
NULL
;
EBUG_ON
(
*
idx
>
BTREE_ITER_MAX
);
return
&
trans
->
paths
[
*
idx
];
return
*
idx
<
BTREE_ITER_MAX
?
&
trans
->
paths
[
*
idx
]
:
NULL
;
}
/*
* This version is intended to be safe for use on a btree_trans that is owned by
* another thread, for bch2_btree_trans_to_text();
*/
#define trans_for_each_path_
safe_from(_trans, _path, _idx, _start)
\
#define trans_for_each_path_
from(_trans, _path, _idx, _start)
\
for (_idx = _start; \
(_path = __trans_next_path
_safe
((_trans), &_idx)); \
(_path = __trans_next_path((_trans), &_idx)); \
_idx++)
#define trans_for_each_path_safe(_trans, _path, _idx) \
trans_for_each_path_safe_from(_trans, _path, _idx, 1)
static
inline
struct
btree_path
*
__trans_next_path
(
struct
btree_trans
*
trans
,
unsigned
*
idx
)
{
struct
btree_path
*
path
=
__trans_next_path_safe
(
trans
,
idx
);
EBUG_ON
(
path
&&
path
->
idx
!=
*
idx
);
return
path
;
}
#define trans_for_each_path(_trans, _path, _iter) \
for (_iter = 1; \
(_path = __trans_next_path((_trans), &_iter)); \
_iter++)
#define trans_for_each_path(_trans, _path, _idx) \
trans_for_each_path_from(_trans, _path, _idx, 1)
static
inline
struct
btree_path
*
next_btree_path
(
struct
btree_trans
*
trans
,
struct
btree_path
*
path
)
{
...
...
fs/bcachefs/btree_locking.c
View file @
398c9834
...
...
@@ -302,7 +302,7 @@ int bch2_check_for_deadlock(struct btree_trans *trans, struct printbuf *cycle)
top
=
&
g
.
g
[
g
.
nr
-
1
];
trans_for_each_path_
safe_
from
(
top
->
trans
,
path
,
path_idx
,
top
->
path_idx
)
{
trans_for_each_path_from
(
top
->
trans
,
path
,
path_idx
,
top
->
path_idx
)
{
if
(
!
path
->
nodes_locked
)
continue
;
...
...
fs/bcachefs/btree_locking.h
View file @
398c9834
...
...
@@ -265,7 +265,6 @@ static inline int btree_node_lock(struct btree_trans *trans,
int
ret
=
0
;
EBUG_ON
(
level
>=
BTREE_MAX_DEPTH
);
EBUG_ON
(
!
test_bit
(
path
->
idx
,
trans
->
paths_allocated
));
if
(
likely
(
six_trylock_type
(
&
b
->
lock
,
type
))
||
btree_node_lock_increment
(
trans
,
b
,
level
,
(
enum
btree_node_locked_type
)
type
)
||
...
...
fs/bcachefs/btree_types.h
View file @
398c9834
...
...
@@ -225,7 +225,6 @@ enum btree_path_uptodate {
typedef
u16
btree_path_idx_t
;
struct
btree_path
{
btree_path_idx_t
idx
;
btree_path_idx_t
sorted_idx
;
u8
ref
;
u8
intent_ref
;
...
...
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