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
bbd8d203
Commit
bbd8d203
authored
Sep 22, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: BTREE_ITER_SLOTS isn't a type of btree iter
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
ef9f95ba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
49 deletions
+43
-49
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+28
-38
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+10
-5
fs/bcachefs/fs-io.c
fs/bcachefs/fs-io.c
+3
-4
fs/bcachefs/io.c
fs/bcachefs/io.c
+2
-2
No files found.
fs/bcachefs/btree_iter.c
View file @
bbd8d203
...
...
@@ -473,7 +473,7 @@ static void __bch2_btree_iter_verify(struct btree_iter *iter,
}
BUG_ON
(
iter
->
uptodate
==
BTREE_ITER_UPTODATE
&&
(
iter
->
flags
&
BTREE_ITER_TYPE
)
==
BTREE_ITER_KEYS
&&
btree_iter_type
(
iter
)
==
BTREE_ITER_KEYS
&&
!
bkey_whiteout
(
&
iter
->
k
)
&&
bch2_btree_node_iter_end
(
&
l
->
iter
));
}
...
...
@@ -1152,6 +1152,7 @@ static inline void bch2_btree_iter_checks(struct btree_iter *iter,
EBUG_ON
(
!!
(
iter
->
flags
&
BTREE_ITER_IS_EXTENTS
)
!=
(
btree_node_type_is_extents
(
iter
->
btree_id
)
&&
type
!=
BTREE_ITER_NODES
));
EBUG_ON
(
btree_iter_type
(
iter
)
!=
type
);
bch2_btree_trans_verify_locks
(
iter
->
trans
);
}
...
...
@@ -1661,7 +1662,7 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter)
{
int
ret
;
bch2_btree_iter_checks
(
iter
,
BTREE_ITER_
SLOT
S
);
bch2_btree_iter_checks
(
iter
,
BTREE_ITER_
KEY
S
);
if
(
iter
->
uptodate
==
BTREE_ITER_UPTODATE
)
return
btree_iter_peek_uptodate
(
iter
);
...
...
@@ -1675,7 +1676,7 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter)
struct
bkey_s_c
bch2_btree_iter_next_slot
(
struct
btree_iter
*
iter
)
{
bch2_btree_iter_checks
(
iter
,
BTREE_ITER_
SLOT
S
);
bch2_btree_iter_checks
(
iter
,
BTREE_ITER_
KEY
S
);
iter
->
pos
=
btree_type_successor
(
iter
->
btree_id
,
iter
->
k
.
p
);
...
...
@@ -1830,7 +1831,7 @@ static int bch2_trans_realloc_iters(struct btree_trans *trans,
return
0
;
}
static
int
btree_trans_iter_alloc
(
struct
btree_trans
*
trans
)
static
struct
btree_iter
*
btree_trans_iter_alloc
(
struct
btree_trans
*
trans
)
{
unsigned
idx
=
__ffs64
(
~
trans
->
iters_linked
);
...
...
@@ -1840,7 +1841,7 @@ static int btree_trans_iter_alloc(struct btree_trans *trans)
if
(
trans
->
nr_iters
==
trans
->
size
)
{
int
ret
=
bch2_trans_realloc_iters
(
trans
,
trans
->
size
*
2
);
if
(
ret
)
return
ret
;
return
ERR_PTR
(
ret
)
;
}
idx
=
trans
->
nr_iters
++
;
...
...
@@ -1850,7 +1851,7 @@ static int btree_trans_iter_alloc(struct btree_trans *trans)
got_slot:
BUG_ON
(
trans
->
iters_linked
&
(
1ULL
<<
idx
));
trans
->
iters_linked
|=
1ULL
<<
idx
;
return
idx
;
return
&
trans
->
iters
[
idx
]
;
}
static
struct
btree_iter
*
__btree_trans_get_iter
(
struct
btree_trans
*
trans
,
...
...
@@ -1858,37 +1859,29 @@ static struct btree_iter *__btree_trans_get_iter(struct btree_trans *trans,
unsigned
flags
,
u64
iter_id
)
{
struct
btree_iter
*
iter
;
int
idx
;
BUG_ON
(
trans
->
nr_iters
>
BTREE_ITER_MAX
);
for
(
idx
=
0
;
idx
<
trans
->
nr_iters
;
idx
++
)
{
if
(
!
(
trans
->
iters_linked
&
(
1ULL
<<
idx
)))
continue
;
iter
=
&
trans
->
iters
[
idx
];
trans_for_each_iter
(
trans
,
iter
)
if
(
iter_id
?
iter
->
id
==
iter_id
:
(
iter
->
btree_id
==
btree_id
&&
!
bkey_cmp
(
iter
->
pos
,
pos
)))
goto
found
;
}
i
dx
=
-
1
;
i
ter
=
NULL
;
found:
if
(
idx
<
0
)
{
i
dx
=
btree_trans_iter_alloc
(
trans
);
if
(
idx
<
0
)
return
ERR_PTR
(
idx
)
;
if
(
!
iter
)
{
i
ter
=
btree_trans_iter_alloc
(
trans
);
if
(
IS_ERR
(
iter
)
)
return
iter
;
iter
=
&
trans
->
iters
[
idx
];
iter
->
id
=
iter_id
;
bch2_btree_iter_init
(
trans
,
iter
,
btree_id
,
pos
,
flags
);
}
else
{
iter
=
&
trans
->
iters
[
idx
];
iter
->
flags
&=
~
(
BTREE_ITER_INTENT
|
BTREE_ITER_PREFETCH
);
iter
->
flags
|=
flags
&
(
BTREE_ITER_INTENT
|
BTREE_ITER_PREFETCH
);
iter
->
flags
&=
~
(
BTREE_ITER_SLOTS
|
BTREE_ITER_INTENT
|
BTREE_ITER_PREFETCH
);
iter
->
flags
|=
flags
&
(
BTREE_ITER_SLOTS
|
BTREE_ITER_INTENT
|
BTREE_ITER_PREFETCH
);
if
((
iter
->
flags
&
BTREE_ITER_INTENT
)
&&
!
bch2_btree_iter_upgrade
(
iter
,
1
))
{
...
...
@@ -1898,9 +1891,9 @@ static struct btree_iter *__btree_trans_get_iter(struct btree_trans *trans,
}
BUG_ON
(
iter
->
btree_id
!=
btree_id
);
BUG_ON
(
trans
->
iters_live
&
(
1ULL
<<
idx
));
trans
->
iters_live
|=
1ULL
<<
idx
;
trans
->
iters_touched
|=
1ULL
<<
idx
;
BUG_ON
(
trans
->
iters_live
&
(
1ULL
<<
i
ter
->
i
dx
));
trans
->
iters_live
|=
1ULL
<<
i
ter
->
i
dx
;
trans
->
iters_touched
|=
1ULL
<<
i
ter
->
i
dx
;
BUG_ON
(
iter
->
btree_id
!=
btree_id
);
BUG_ON
((
iter
->
flags
^
flags
)
&
BTREE_ITER_TYPE
);
...
...
@@ -1950,29 +1943,26 @@ struct btree_iter *bch2_trans_copy_iter(struct btree_trans *trans,
struct
btree_iter
*
src
)
{
struct
btree_iter
*
iter
;
unsigned
offset
=
offsetof
(
struct
btree_iter
,
trans
);
int
i
,
idx
;
int
idx
,
i
;
idx
=
btree_trans_iter_alloc
(
trans
);
if
(
idx
<
0
)
return
ERR_PTR
(
idx
);
iter
=
btree_trans_iter_alloc
(
trans
);
if
(
IS_ERR
(
iter
))
return
iter
;
idx
=
iter
->
idx
;
*
iter
=
*
src
;
iter
->
idx
=
idx
;
trans
->
iters_live
|=
1ULL
<<
idx
;
trans
->
iters_touched
|=
1ULL
<<
idx
;
trans
->
iters_unlink_on_restart
|=
1ULL
<<
idx
;
iter
=
&
trans
->
iters
[
idx
];
memcpy
((
void
*
)
iter
+
offset
,
(
void
*
)
src
+
offset
,
sizeof
(
*
iter
)
-
offset
);
for
(
i
=
0
;
i
<
BTREE_MAX_DEPTH
;
i
++
)
if
(
btree_node_locked
(
iter
,
i
))
six_lock_increment
(
&
iter
->
l
[
i
].
b
->
c
.
lock
,
__btree_lock_want
(
iter
,
i
));
return
&
trans
->
iters
[
idx
]
;
return
iter
;
}
static
int
bch2_trans_preload_mem
(
struct
btree_trans
*
trans
,
size_t
size
)
...
...
fs/bcachefs/btree_types.h
View file @
bbd8d203
...
...
@@ -183,20 +183,20 @@ struct btree_node_iter {
enum
btree_iter_type
{
BTREE_ITER_KEYS
,
BTREE_ITER_SLOTS
,
BTREE_ITER_NODES
,
};
#define BTREE_ITER_TYPE ((1 << 2) - 1)
#define BTREE_ITER_INTENT (1 << 2)
#define BTREE_ITER_PREFETCH (1 << 3)
#define BTREE_ITER_SLOTS (1 << 2)
#define BTREE_ITER_INTENT (1 << 3)
#define BTREE_ITER_PREFETCH (1 << 4)
/*
* Used in bch2_btree_iter_traverse(), to indicate whether we're searching for
* @pos or the first key strictly greater than @pos
*/
#define BTREE_ITER_IS_EXTENTS (1 <<
4
)
#define BTREE_ITER_ERROR (1 <<
5
)
#define BTREE_ITER_IS_EXTENTS (1 <<
5
)
#define BTREE_ITER_ERROR (1 <<
6
)
enum
btree_iter_uptodate
{
BTREE_ITER_UPTODATE
=
0
,
...
...
@@ -241,6 +241,11 @@ struct btree_iter {
u64
id
;
};
static
inline
enum
btree_iter_type
btree_iter_type
(
struct
btree_iter
*
iter
)
{
return
iter
->
flags
&
BTREE_ITER_TYPE
;
}
struct
deferred_update
{
struct
journal_preres
res
;
struct
journal_entry_pin
journal
;
...
...
fs/bcachefs/fs-io.c
View file @
bbd8d203
...
...
@@ -447,10 +447,9 @@ static int bchfs_write_index_update(struct bch_write_op *wop)
bch2_trans_init
(
&
trans
,
c
,
BTREE_ITER_MAX
,
1024
);
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_EXTENTS
,
bkey_start_pos
(
&
k
->
k
),
BTREE_ITER_INTENT
);
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_EXTENTS
,
bkey_start_pos
(
&
k
->
k
),
BTREE_ITER_SLOTS
|
BTREE_ITER_INTENT
);
do
{
BKEY_PADDED
(
k
)
tmp
;
...
...
fs/bcachefs/io.c
View file @
bbd8d203
...
...
@@ -1417,8 +1417,8 @@ static void bch2_rbio_narrow_crcs(struct bch_read_bio *rbio)
bch2_trans_begin
(
&
trans
);
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_EXTENTS
,
rbio
->
pos
,
BTREE_ITER_INTENT
);
k
=
bch2_btree_iter_peek
(
iter
);
BTREE_ITER_
SLOTS
|
BTREE_ITER_
INTENT
);
k
=
bch2_btree_iter_peek
_slot
(
iter
);
if
(
IS_ERR_OR_NULL
(
k
.
k
))
goto
out
;
...
...
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