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
559e6c23
Commit
559e6c23
authored
Dec 16, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: trans_for_each_update() now declares loop iter
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
cee0a8ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
25 deletions
+7
-25
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+0
-5
fs/bcachefs/btree_trans_commit.c
fs/bcachefs/btree_trans_commit.c
+5
-16
fs/bcachefs/btree_update.c
fs/bcachefs/btree_update.c
+1
-1
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update.h
+1
-3
No files found.
fs/bcachefs/btree_iter.c
View file @
559e6c23
...
...
@@ -648,7 +648,6 @@ void bch2_btree_path_level_init(struct btree_trans *trans,
static
void
bch2_trans_revalidate_updates_in_node
(
struct
btree_trans
*
trans
,
struct
btree
*
b
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
trans_for_each_update
(
trans
,
i
)
if
(
!
i
->
cached
&&
...
...
@@ -1369,8 +1368,6 @@ void __noreturn bch2_trans_in_restart_error(struct btree_trans *trans)
noinline
__cold
void
bch2_trans_updates_to_text
(
struct
printbuf
*
buf
,
struct
btree_trans
*
trans
)
{
struct
btree_insert_entry
*
i
;
prt_printf
(
buf
,
"transaction updates for %s journal seq %llu"
,
trans
->
fn
,
trans
->
journal_res
.
seq
);
prt_newline
(
buf
);
...
...
@@ -1840,7 +1837,6 @@ inline bool bch2_btree_iter_rewind(struct btree_iter *iter)
static
noinline
struct
bkey_i
*
__bch2_btree_trans_peek_updates
(
struct
btree_iter
*
iter
)
{
struct
btree_insert_entry
*
i
;
struct
bkey_i
*
ret
=
NULL
;
trans_for_each_update
(
iter
->
trans
,
i
)
{
...
...
@@ -2975,7 +2971,6 @@ static void check_btree_paths_leaked(struct btree_trans *trans)
void
bch2_trans_put
(
struct
btree_trans
*
trans
)
__releases
(
&
c
->
btree_trans_barrier
)
{
struct
btree_insert_entry
*
i
;
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_transaction_stats
*
s
=
btree_trans_stats
(
trans
);
...
...
fs/bcachefs/btree_trans_commit.c
View file @
559e6c23
...
...
@@ -93,8 +93,6 @@ static noinline int trans_lock_write_fail(struct btree_trans *trans, struct btre
static
inline
int
bch2_trans_lock_write
(
struct
btree_trans
*
trans
)
{
struct
btree_insert_entry
*
i
;
EBUG_ON
(
trans
->
write_locked
);
trans_for_each_update
(
trans
,
i
)
{
...
...
@@ -115,8 +113,6 @@ static inline int bch2_trans_lock_write(struct btree_trans *trans)
static
inline
void
bch2_trans_unlock_write
(
struct
btree_trans
*
trans
)
{
if
(
likely
(
trans
->
write_locked
))
{
struct
btree_insert_entry
*
i
;
trans_for_each_update
(
trans
,
i
)
if
(
!
same_leaf_as_prev
(
trans
,
i
))
bch2_btree_node_unlock_write_inlined
(
trans
,
i
->
path
,
...
...
@@ -361,7 +357,6 @@ noinline static int
btree_key_can_insert_cached_slowpath
(
struct
btree_trans
*
trans
,
unsigned
flags
,
struct
btree_path
*
path
,
unsigned
new_u64s
)
{
struct
btree_insert_entry
*
i
;
struct
bkey_cached
*
ck
=
(
void
*
)
path
->
l
[
0
].
b
;
struct
bkey_i
*
new_k
;
int
ret
;
...
...
@@ -400,7 +395,6 @@ static int btree_key_can_insert_cached(struct btree_trans *trans, unsigned flags
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
bkey_cached
*
ck
=
(
void
*
)
path
->
l
[
0
].
b
;
struct
btree_insert_entry
*
i
;
unsigned
new_u64s
;
struct
bkey_i
*
new_k
;
...
...
@@ -550,7 +544,7 @@ static int run_btree_triggers(struct btree_trans *trans, enum btree_id btree_id,
static
int
bch2_trans_commit_run_triggers
(
struct
btree_trans
*
trans
)
{
struct
btree_insert_entry
*
i
=
NULL
,
*
btree_id_start
=
trans
->
updates
;
struct
btree_insert_entry
*
btree_id_start
=
trans
->
updates
;
unsigned
btree_id
=
0
;
int
ret
=
0
;
...
...
@@ -597,7 +591,6 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans)
static
noinline
int
bch2_trans_commit_run_gc_triggers
(
struct
btree_trans
*
trans
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
int
ret
=
0
;
trans_for_each_update
(
trans
,
i
)
{
...
...
@@ -623,7 +616,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
unsigned
long
trace_ip
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
struct
btree_trans_commit_hook
*
h
;
unsigned
u64s
=
0
;
int
ret
;
...
...
@@ -775,8 +767,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
static
noinline
void
bch2_drop_overwrites_from_journal
(
struct
btree_trans
*
trans
)
{
struct
btree_insert_entry
*
i
;
trans_for_each_update
(
trans
,
i
)
bch2_journal_key_overwritten
(
trans
->
c
,
i
->
btree_id
,
i
->
level
,
i
->
k
->
k
.
p
);
}
...
...
@@ -820,7 +810,6 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
unsigned
long
trace_ip
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
int
ret
=
0
,
u64s_delta
=
0
;
trans_for_each_update
(
trans
,
i
)
{
...
...
@@ -964,7 +953,6 @@ static noinline int
do_bch2_trans_commit_to_journal_replay
(
struct
btree_trans
*
trans
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
;
int
ret
=
0
;
trans_for_each_update
(
trans
,
i
)
{
...
...
@@ -978,8 +966,8 @@ do_bch2_trans_commit_to_journal_replay(struct btree_trans *trans)
int
__bch2_trans_commit
(
struct
btree_trans
*
trans
,
unsigned
flags
)
{
struct
btree_insert_entry
*
errored_at
=
NULL
;
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_insert_entry
*
i
=
NULL
;
int
ret
=
0
;
if
(
!
trans
->
nr_updates
&&
...
...
@@ -1058,11 +1046,12 @@ int __bch2_trans_commit(struct btree_trans *trans, unsigned flags)
goto
err
;
}
retry:
errored_at
=
NULL
;
bch2_trans_verify_not_in_restart
(
trans
);
if
(
likely
(
!
(
flags
&
BCH_TRANS_COMMIT_no_journal_res
)))
memset
(
&
trans
->
journal_res
,
0
,
sizeof
(
trans
->
journal_res
));
ret
=
do_bch2_trans_commit
(
trans
,
flags
,
&
i
,
_RET_IP_
);
ret
=
do_bch2_trans_commit
(
trans
,
flags
,
&
errored_at
,
_RET_IP_
);
/* make sure we didn't drop or screw up locks: */
bch2_trans_verify_locks
(
trans
);
...
...
@@ -1081,7 +1070,7 @@ int __bch2_trans_commit(struct btree_trans *trans, unsigned flags)
return
ret
;
err:
ret
=
bch2_trans_commit_error
(
trans
,
flags
,
i
,
ret
,
_RET_IP_
);
ret
=
bch2_trans_commit_error
(
trans
,
flags
,
errored_at
,
ret
,
_RET_IP_
);
if
(
ret
)
goto
out
;
...
...
fs/bcachefs/btree_update.c
View file @
559e6c23
...
...
@@ -408,7 +408,7 @@ bch2_trans_update_by_path(struct btree_trans *trans, struct btree_path *path,
* Pending updates are kept sorted: first, find position of new update,
* then delete/trim any updates the new update overwrites:
*/
trans_for_each_update
(
trans
,
i
)
{
for
(
i
=
trans
->
updates
;
i
<
trans
->
updates
+
trans
->
nr_updates
;
i
++
)
{
cmp
=
btree_insert_entry_cmp
(
&
n
,
i
);
if
(
cmp
<=
0
)
break
;
...
...
fs/bcachefs/btree_update.h
View file @
559e6c23
...
...
@@ -187,14 +187,12 @@ static inline int bch2_trans_commit(struct btree_trans *trans,
bch2_trans_run(_c, commit_do(trans, _disk_res, _journal_seq, _flags, _do))
#define trans_for_each_update(_trans, _i) \
for (
(_i) = (_trans)->updates;
\
for (
struct btree_insert_entry *_i = (_trans)->updates;
\
(_i) < (_trans)->updates + (_trans)->nr_updates; \
(_i)++)
static
inline
void
bch2_trans_reset_updates
(
struct
btree_trans
*
trans
)
{
struct
btree_insert_entry
*
i
;
trans_for_each_update
(
trans
,
i
)
bch2_path_put
(
trans
,
i
->
path
,
true
);
...
...
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