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
cbdf24ce
Commit
cbdf24ce
authored
Aug 21, 2018
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Fix a btree iter bug when iter pos == POS_MAX
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
a00fd8c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+11
-3
No files found.
fs/bcachefs/btree_iter.c
View file @
cbdf24ce
...
@@ -36,7 +36,16 @@ static inline int __btree_iter_pos_cmp(struct btree_iter *iter,
...
@@ -36,7 +36,16 @@ static inline int __btree_iter_pos_cmp(struct btree_iter *iter,
return
cmp
;
return
cmp
;
if
(
bkey_deleted
(
k
))
if
(
bkey_deleted
(
k
))
return
-
1
;
return
-
1
;
if
(
iter
->
flags
&
BTREE_ITER_IS_EXTENTS
)
/*
* Normally, for extents we want the first key strictly greater than
* the iterator position - with the exception that for interior nodes,
* we don't want to advance past the last key if the iterator position
* is POS_MAX:
*/
if
(
iter
->
flags
&
BTREE_ITER_IS_EXTENTS
&&
(
!
interior_node
||
bkey_cmp_left_packed_byval
(
b
,
k
,
POS_MAX
)))
return
-
1
;
return
-
1
;
return
1
;
return
1
;
}
}
...
@@ -691,8 +700,7 @@ static inline bool btree_iter_pos_after_node(struct btree_iter *iter,
...
@@ -691,8 +700,7 @@ static inline bool btree_iter_pos_after_node(struct btree_iter *iter,
struct
btree
*
b
)
struct
btree
*
b
)
{
{
return
__btree_iter_pos_cmp
(
iter
,
NULL
,
return
__btree_iter_pos_cmp
(
iter
,
NULL
,
bkey_to_packed
(
&
b
->
key
),
true
)
<
0
&&
bkey_to_packed
(
&
b
->
key
),
true
)
<
0
;
bkey_cmp
(
b
->
key
.
k
.
p
,
POS_MAX
);
}
}
static
inline
bool
btree_iter_pos_in_node
(
struct
btree_iter
*
iter
,
static
inline
bool
btree_iter_pos_in_node
(
struct
btree_iter
*
iter
,
...
...
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