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
2a6870ad
Commit
2a6870ad
authored
Mar 29, 2022
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Use darray for extra_journal_entries
Signed-off-by:
Kent Overstreet
<
kent.overstreet@gmail.com
>
parent
d8648425
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
22 deletions
+32
-22
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+3
-2
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+2
-2
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+19
-9
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/btree_update_leaf.c
+8
-9
No files found.
fs/bcachefs/btree_iter.c
View file @
2a6870ad
...
...
@@ -3055,8 +3055,7 @@ void bch2_trans_begin(struct btree_trans *trans)
trans
->
mem_top
=
0
;
trans
->
hooks
=
NULL
;
trans
->
extra_journal_entries
=
NULL
;
trans
->
extra_journal_entry_u64s
=
0
;
trans
->
extra_journal_entries
.
nr
=
0
;
if
(
trans
->
fs_usage_deltas
)
{
trans
->
fs_usage_deltas
->
used
=
0
;
...
...
@@ -3196,6 +3195,8 @@ void bch2_trans_exit(struct btree_trans *trans)
bch2_journal_preres_put
(
&
c
->
journal
,
&
trans
->
journal_preres
);
kfree
(
trans
->
extra_journal_entries
.
data
);
if
(
trans
->
fs_usage_deltas
)
{
if
(
trans
->
fs_usage_deltas
->
size
+
sizeof
(
trans
->
fs_usage_deltas
)
==
REPLICAS_DELTA_LIST_MAX
)
...
...
fs/bcachefs/btree_types.h
View file @
2a6870ad
...
...
@@ -7,6 +7,7 @@
#include "bkey_methods.h"
#include "buckets_types.h"
#include "darray.h"
#include "journal_types.h"
#include "six.h"
...
...
@@ -416,8 +417,7 @@ struct btree_trans {
/* update path: */
struct
btree_trans_commit_hook
*
hooks
;
struct
jset_entry
*
extra_journal_entries
;
unsigned
extra_journal_entry_u64s
;
DARRAY
(
u64
)
extra_journal_entries
;
struct
journal_entry_pin
*
journal_pin
;
struct
journal_res
journal_res
;
...
...
fs/bcachefs/btree_update_interior.c
View file @
2a6870ad
...
...
@@ -518,8 +518,15 @@ static int btree_update_nodes_written_trans(struct btree_trans *trans,
struct
bkey_i
*
k
;
int
ret
;
trans
->
extra_journal_entries
=
(
void
*
)
&
as
->
journal_entries
[
0
];
trans
->
extra_journal_entry_u64s
=
as
->
journal_u64s
;
ret
=
darray_make_room
(
&
trans
->
extra_journal_entries
,
as
->
journal_u64s
);
if
(
ret
)
return
ret
;
memcpy
(
&
darray_top
(
trans
->
extra_journal_entries
),
as
->
journal_entries
,
as
->
journal_u64s
*
sizeof
(
u64
));
trans
->
extra_journal_entries
.
nr
+=
as
->
journal_u64s
;
trans
->
journal_pin
=
&
as
->
journal
;
for_each_keylist_key
(
&
as
->
new_keys
,
k
)
{
...
...
@@ -1905,7 +1912,6 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans,
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_iter
iter2
=
{
NULL
};
struct
btree
*
parent
;
u64
journal_entries
[
BKEY_BTREE_PTR_U64s_MAX
];
int
ret
;
if
(
!
skip_triggers
)
{
...
...
@@ -1949,12 +1955,16 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans,
}
else
{
BUG_ON
(
btree_node_root
(
c
,
b
)
!=
b
);
trans
->
extra_journal_entries
=
(
void
*
)
&
journal_entries
[
0
];
trans
->
extra_journal_entry_u64s
=
journal_entry_set
((
void
*
)
&
journal_entries
[
0
],
BCH_JSET_ENTRY_btree_root
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
new_key
,
new_key
->
k
.
u64s
);
ret
=
darray_make_room
(
&
trans
->
extra_journal_entries
,
jset_u64s
(
new_key
->
k
.
u64s
));
if
(
ret
)
return
ret
;
journal_entry_set
((
void
*
)
&
darray_top
(
trans
->
extra_journal_entries
),
BCH_JSET_ENTRY_btree_root
,
b
->
c
.
btree_id
,
b
->
c
.
level
,
new_key
,
new_key
->
k
.
u64s
);
trans
->
extra_journal_entries
.
nr
+=
jset_u64s
(
new_key
->
k
.
u64s
);
}
ret
=
bch2_trans_commit
(
trans
,
NULL
,
NULL
,
...
...
fs/bcachefs/btree_update_leaf.c
View file @
2a6870ad
...
...
@@ -707,13 +707,13 @@ bch2_trans_commit_write_locked(struct btree_trans *trans,
trans
->
journal_res
.
seq
=
c
->
journal
.
replay_journal_seq
;
}
if
(
unlikely
(
trans
->
extra_journal_entr
y_u64s
))
{
if
(
unlikely
(
trans
->
extra_journal_entr
ies
.
nr
))
{
memcpy_u64s_small
(
journal_res_entry
(
&
c
->
journal
,
&
trans
->
journal_res
),
trans
->
extra_journal_entries
,
trans
->
extra_journal_entr
y_u64s
);
trans
->
extra_journal_entries
.
data
,
trans
->
extra_journal_entr
ies
.
nr
);
trans
->
journal_res
.
offset
+=
trans
->
extra_journal_entr
y_u64s
;
trans
->
journal_res
.
u64s
-=
trans
->
extra_journal_entr
y_u64s
;
trans
->
journal_res
.
offset
+=
trans
->
extra_journal_entr
ies
.
nr
;
trans
->
journal_res
.
u64s
-=
trans
->
extra_journal_entr
ies
.
nr
;
}
/*
...
...
@@ -1096,7 +1096,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
int
ret
=
0
;
if
(
!
trans
->
nr_updates
&&
!
trans
->
extra_journal_entr
y_u64s
)
!
trans
->
extra_journal_entr
ies
.
nr
)
goto
out_reset
;
if
(
trans
->
flags
&
BTREE_INSERT_GC_LOCK_HELD
)
...
...
@@ -1120,7 +1120,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
memset
(
&
trans
->
journal_preres
,
0
,
sizeof
(
trans
->
journal_preres
));
trans
->
journal_u64s
=
trans
->
extra_journal_entr
y_u64s
;
trans
->
journal_u64s
=
trans
->
extra_journal_entr
ies
.
nr
;
trans
->
journal_preres_u64s
=
0
;
trans
->
journal_transaction_names
=
READ_ONCE
(
c
->
opts
.
journal_transaction_names
);
...
...
@@ -1180,8 +1180,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
trans
->
extra_journal_res
=
0
;
trans
->
nr_updates
=
0
;
trans
->
hooks
=
NULL
;
trans
->
extra_journal_entries
=
NULL
;
trans
->
extra_journal_entry_u64s
=
0
;
trans
->
extra_journal_entries
.
nr
=
0
;
if
(
trans
->
fs_usage_deltas
)
{
trans
->
fs_usage_deltas
->
used
=
0
;
...
...
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