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
3fb5ebcd
Commit
3fb5ebcd
authored
Aug 22, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Inline some fast paths
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
416f6852
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
27 deletions
+30
-27
fs/bcachefs/extents.c
fs/bcachefs/extents.c
+0
-13
fs/bcachefs/extents.h
fs/bcachefs/extents.h
+12
-1
fs/bcachefs/fs-io.c
fs/bcachefs/fs-io.c
+1
-1
fs/bcachefs/fs.c
fs/bcachefs/fs.c
+1
-1
fs/bcachefs/io.c
fs/bcachefs/io.c
+5
-9
fs/bcachefs/io.h
fs/bcachefs/io.h
+11
-2
No files found.
fs/bcachefs/extents.c
View file @
3fb5ebcd
...
...
@@ -806,19 +806,6 @@ bool bch2_cut_back(struct bpos where, struct bkey *k)
return
true
;
}
/**
* bch_key_resize - adjust size of @k
*
* bkey_start_offset(k) will be preserved, modifies where the extent ends
*/
void
bch2_key_resize
(
struct
bkey
*
k
,
unsigned
new_size
)
{
k
->
p
.
offset
-=
k
->
size
;
k
->
p
.
offset
+=
new_size
;
k
->
size
=
new_size
;
}
static
bool
extent_i_save
(
struct
btree
*
b
,
struct
bkey_packed
*
dst
,
struct
bkey_i
*
src
)
{
...
...
fs/bcachefs/extents.h
View file @
3fb5ebcd
...
...
@@ -540,7 +540,18 @@ static inline void bch2_cut_front(struct bpos where, struct bkey_i *k)
}
bool
bch2_cut_back
(
struct
bpos
,
struct
bkey
*
);
void
bch2_key_resize
(
struct
bkey
*
,
unsigned
);
/**
* bch_key_resize - adjust size of @k
*
* bkey_start_offset(k) will be preserved, modifies where the extent ends
*/
static
inline
void
bch2_key_resize
(
struct
bkey
*
k
,
unsigned
new_size
)
{
k
->
p
.
offset
-=
k
->
size
;
k
->
p
.
offset
+=
new_size
;
k
->
size
=
new_size
;
}
/*
* In extent_sort_fix_overlapping(), insert_fixup_extent(),
...
...
fs/bcachefs/fs-io.c
View file @
3fb5ebcd
...
...
@@ -1036,7 +1036,7 @@ static void bchfs_read(struct btree_trans *trans, struct btree_iter *iter,
bkey_start_offset
(
k
.
k
);
sectors
=
k
.
k
->
size
-
offset_into_extent
;
ret
=
bch2_read_indirect_extent
(
trans
,
iter
,
ret
=
bch2_read_indirect_extent
(
trans
,
&
offset_into_extent
,
&
tmp
.
k
);
if
(
ret
)
break
;
...
...
fs/bcachefs/fs.c
View file @
3fb5ebcd
...
...
@@ -1233,7 +1233,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
bkey_start_offset
(
k
.
k
);
sectors
=
k
.
k
->
size
-
offset_into_extent
;
ret
=
bch2_read_indirect_extent
(
&
trans
,
iter
,
ret
=
bch2_read_indirect_extent
(
&
trans
,
&
offset_into_extent
,
&
cur
.
k
);
if
(
ret
)
break
;
...
...
fs/bcachefs/io.c
View file @
3fb5ebcd
...
...
@@ -1305,7 +1305,7 @@ static void bch2_read_retry(struct bch_fs *c, struct bch_read_bio *rbio,
bkey_start_offset
(
k
.
k
);
sectors
=
k
.
k
->
size
-
offset_into_extent
;
ret
=
bch2_read_indirect_extent
(
&
trans
,
iter
,
ret
=
bch2_read_indirect_extent
(
&
trans
,
&
offset_into_extent
,
&
tmp
.
k
);
if
(
ret
)
break
;
...
...
@@ -1594,19 +1594,15 @@ static void bch2_read_endio(struct bio *bio)
bch2_rbio_punt
(
rbio
,
__bch2_read_endio
,
context
,
wq
);
}
int
bch2_read_indirect_extent
(
struct
btree_trans
*
trans
,
struct
btree_iter
*
extent_iter
,
unsigned
*
offset_into_extent
,
struct
bkey_i
*
orig_k
)
int
__bch2_read_indirect_extent
(
struct
btree_trans
*
trans
,
unsigned
*
offset_into_extent
,
struct
bkey_i
*
orig_k
)
{
struct
btree_iter
*
iter
;
struct
bkey_s_c
k
;
u64
reflink_offset
;
int
ret
;
if
(
orig_k
->
k
.
type
!=
KEY_TYPE_reflink_p
)
return
0
;
reflink_offset
=
le64_to_cpu
(
bkey_i_to_reflink_p
(
orig_k
)
->
v
.
idx
)
+
*
offset_into_extent
;
...
...
@@ -1920,7 +1916,7 @@ void bch2_read(struct bch_fs *c, struct bch_read_bio *rbio, u64 inode)
bkey_start_offset
(
k
.
k
);
sectors
=
k
.
k
->
size
-
offset_into_extent
;
ret
=
bch2_read_indirect_extent
(
&
trans
,
iter
,
ret
=
bch2_read_indirect_extent
(
&
trans
,
&
offset_into_extent
,
&
tmp
.
k
);
if
(
ret
)
goto
err
;
...
...
fs/bcachefs/io.h
View file @
3fb5ebcd
...
...
@@ -99,8 +99,17 @@ struct bch_devs_mask;
struct
cache_promote_op
;
struct
extent_ptr_decoded
;
int
bch2_read_indirect_extent
(
struct
btree_trans
*
,
struct
btree_iter
*
,
unsigned
*
,
struct
bkey_i
*
);
int
__bch2_read_indirect_extent
(
struct
btree_trans
*
,
unsigned
*
,
struct
bkey_i
*
);
static
inline
int
bch2_read_indirect_extent
(
struct
btree_trans
*
trans
,
unsigned
*
offset_into_extent
,
struct
bkey_i
*
k
)
{
return
k
->
k
.
type
==
KEY_TYPE_reflink_p
?
__bch2_read_indirect_extent
(
trans
,
offset_into_extent
,
k
)
:
0
;
}
enum
bch_read_flags
{
BCH_READ_RETRY_IF_STALE
=
1
<<
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