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
c259bd95
Commit
c259bd95
authored
Nov 26, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: No need to allocate keys for write buffer
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
3c471b65
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
44 deletions
+37
-44
fs/bcachefs/backpointers.c
fs/bcachefs/backpointers.c
+16
-1
fs/bcachefs/backpointers.h
fs/bcachefs/backpointers.h
+10
-17
fs/bcachefs/btree_update.c
fs/bcachefs/btree_update.c
+5
-25
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update.h
+6
-1
No files found.
fs/bcachefs/backpointers.c
View file @
c259bd95
...
...
@@ -136,15 +136,30 @@ static noinline int backpointer_mod_err(struct btree_trans *trans,
}
int
bch2_bucket_backpointer_mod_nowritebuffer
(
struct
btree_trans
*
trans
,
struct
b
key_i_backpointer
*
bp_k
,
struct
b
pos
bucket
,
struct
bch_backpointer
bp
,
struct
bkey_s_c
orig_k
,
bool
insert
)
{
struct
btree_iter
bp_iter
;
struct
bkey_s_c
k
;
struct
bkey_i_backpointer
*
bp_k
;
int
ret
;
bp_k
=
bch2_trans_kmalloc_nomemzero
(
trans
,
sizeof
(
struct
bkey_i_backpointer
));
ret
=
PTR_ERR_OR_ZERO
(
bp_k
);
if
(
ret
)
return
ret
;
bkey_backpointer_init
(
&
bp_k
->
k_i
);
bp_k
->
k
.
p
=
bucket_pos_to_bp
(
trans
->
c
,
bucket
,
bp
.
bucket_offset
);
bp_k
->
v
=
bp
;
if
(
!
insert
)
{
bp_k
->
k
.
type
=
KEY_TYPE_deleted
;
set_bkey_val_u64s
(
&
bp_k
->
k
,
0
);
}
k
=
bch2_bkey_get_iter
(
trans
,
&
bp_iter
,
BTREE_ID_backpointers
,
bp_k
->
k
.
p
,
BTREE_ITER_INTENT
|
...
...
fs/bcachefs/backpointers.h
View file @
c259bd95
...
...
@@ -63,7 +63,7 @@ static inline struct bpos bucket_pos_to_bp(const struct bch_fs *c,
return
ret
;
}
int
bch2_bucket_backpointer_mod_nowritebuffer
(
struct
btree_trans
*
,
struct
b
key_i_backpointer
*
,
int
bch2_bucket_backpointer_mod_nowritebuffer
(
struct
btree_trans
*
,
struct
b
pos
bucket
,
struct
bch_backpointer
,
struct
bkey_s_c
,
bool
);
static
inline
int
bch2_bucket_backpointer_mod
(
struct
btree_trans
*
trans
,
...
...
@@ -72,28 +72,21 @@ static inline int bch2_bucket_backpointer_mod(struct btree_trans *trans,
struct
bkey_s_c
orig_k
,
bool
insert
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
bkey_i_backpointer
*
bp_k
;
int
ret
;
if
(
unlikely
(
bch2_backpointers_no_use_write_buffer
))
return
bch2_bucket_backpointer_mod_nowritebuffer
(
trans
,
bucket
,
bp
,
orig_k
,
insert
);
bp_k
=
bch2_trans_kmalloc_nomemzero
(
trans
,
sizeof
(
struct
bkey_i_backpointer
));
ret
=
PTR_ERR_OR_ZERO
(
bp_k
);
if
(
ret
)
return
ret
;
struct
bkey_i_backpointer
bp_k
;
bkey_backpointer_init
(
&
bp_k
->
k_i
);
bp_k
->
k
.
p
=
bucket_pos_to_bp
(
c
,
bucket
,
bp
.
bucket_offset
);
bp_k
->
v
=
bp
;
bkey_backpointer_init
(
&
bp_k
.
k_i
);
bp_k
.
k
.
p
=
bucket_pos_to_bp
(
trans
->
c
,
bucket
,
bp
.
bucket_offset
);
bp_k
.
v
=
bp
;
if
(
!
insert
)
{
bp_k
->
k
.
type
=
KEY_TYPE_deleted
;
set_bkey_val_u64s
(
&
bp_k
->
k
,
0
);
bp_k
.
k
.
type
=
KEY_TYPE_deleted
;
set_bkey_val_u64s
(
&
bp_k
.
k
,
0
);
}
if
(
unlikely
(
bch2_backpointers_no_use_write_buffer
))
return
bch2_bucket_backpointer_mod_nowritebuffer
(
trans
,
bp_k
,
bp
,
orig_k
,
insert
);
return
bch2_trans_update_buffered
(
trans
,
BTREE_ID_backpointers
,
&
bp_k
->
k_i
);
return
bch2_trans_update_buffered
(
trans
,
BTREE_ID_backpointers
,
&
bp_k
.
k_i
);
}
static
inline
enum
bch_data_type
bkey_ptr_data_type
(
enum
btree_id
btree_id
,
unsigned
level
,
...
...
fs/bcachefs/btree_update.c
View file @
c259bd95
...
...
@@ -710,20 +710,6 @@ int bch2_btree_delete_at(struct btree_trans *trans,
return
bch2_btree_delete_extent_at
(
trans
,
iter
,
0
,
update_flags
);
}
int
bch2_btree_delete_at_buffered
(
struct
btree_trans
*
trans
,
enum
btree_id
btree
,
struct
bpos
pos
)
{
struct
bkey_i
*
k
;
k
=
bch2_trans_kmalloc
(
trans
,
sizeof
(
*
k
));
if
(
IS_ERR
(
k
))
return
PTR_ERR
(
k
);
bkey_init
(
&
k
->
k
);
k
->
k
.
p
=
pos
;
return
bch2_trans_update_buffered
(
trans
,
btree
,
k
);
}
int
bch2_btree_delete
(
struct
btree_trans
*
trans
,
enum
btree_id
btree
,
struct
bpos
pos
,
unsigned
update_flags
)
...
...
@@ -828,19 +814,13 @@ int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id,
int
bch2_btree_bit_mod
(
struct
btree_trans
*
trans
,
enum
btree_id
btree
,
struct
bpos
pos
,
bool
set
)
{
struct
bkey_i
*
k
;
int
ret
=
0
;
struct
bkey_i
k
;
k
=
bch2_trans_kmalloc_nomemzero
(
trans
,
sizeof
(
*
k
));
ret
=
PTR_ERR_OR_ZERO
(
k
);
if
(
unlikely
(
ret
))
return
ret
;
bkey_init
(
&
k
->
k
);
k
->
k
.
type
=
set
?
KEY_TYPE_set
:
KEY_TYPE_deleted
;
k
->
k
.
p
=
pos
;
bkey_init
(
&
k
.
k
);
k
.
k
.
type
=
set
?
KEY_TYPE_set
:
KEY_TYPE_deleted
;
k
.
k
.
p
=
pos
;
return
bch2_trans_update_buffered
(
trans
,
btree
,
k
);
return
bch2_trans_update_buffered
(
trans
,
btree
,
&
k
);
}
__printf
(
2
,
0
)
...
...
fs/bcachefs/btree_update.h
View file @
c259bd95
...
...
@@ -47,7 +47,6 @@ enum bch_trans_commit_flags {
int
bch2_btree_delete_extent_at
(
struct
btree_trans
*
,
struct
btree_iter
*
,
unsigned
,
unsigned
);
int
bch2_btree_delete_at
(
struct
btree_trans
*
,
struct
btree_iter
*
,
unsigned
);
int
bch2_btree_delete_at_buffered
(
struct
btree_trans
*
,
enum
btree_id
,
struct
bpos
);
int
bch2_btree_delete
(
struct
btree_trans
*
,
enum
btree_id
,
struct
bpos
,
unsigned
);
int
bch2_btree_insert_nonextent
(
struct
btree_trans
*
,
enum
btree_id
,
...
...
@@ -65,6 +64,12 @@ int bch2_btree_delete_range(struct bch_fs *, enum btree_id,
int
bch2_btree_bit_mod
(
struct
btree_trans
*
,
enum
btree_id
,
struct
bpos
,
bool
);
static
inline
int
bch2_btree_delete_at_buffered
(
struct
btree_trans
*
trans
,
enum
btree_id
btree
,
struct
bpos
pos
)
{
return
bch2_btree_bit_mod
(
trans
,
btree
,
pos
,
false
);
}
int
__bch2_insert_snapshot_whiteouts
(
struct
btree_trans
*
,
enum
btree_id
,
struct
bpos
,
struct
bpos
);
...
...
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