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
0beebd92
Commit
0beebd92
authored
Dec 21, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: bkey_for_each_ptr() now declares loop iter
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
0bc64d7e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
7 additions
and
38 deletions
+7
-38
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+0
-1
fs/bcachefs/btree_io.c
fs/bcachefs/btree_io.c
+0
-2
fs/bcachefs/data_update.c
fs/bcachefs/data_update.c
+0
-4
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+0
-1
fs/bcachefs/extents.c
fs/bcachefs/extents.c
+0
-4
fs/bcachefs/extents.h
fs/bcachefs/extents.h
+1
-5
fs/bcachefs/io_misc.c
fs/bcachefs/io_misc.c
+0
-1
fs/bcachefs/io_write.c
fs/bcachefs/io_write.c
+5
-15
fs/bcachefs/journal_io.c
fs/bcachefs/journal_io.c
+0
-1
fs/bcachefs/move.c
fs/bcachefs/move.c
+1
-4
No files found.
fs/bcachefs/btree_gc.c
View file @
0beebd92
...
...
@@ -1844,7 +1844,6 @@ static int gc_btree_gens_key(struct btree_trans *trans,
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
struct
bkey_i
*
u
;
int
ret
;
...
...
fs/bcachefs/btree_io.c
View file @
0beebd92
...
...
@@ -934,7 +934,6 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
struct
sort_iter
*
iter
;
struct
btree_node
*
sorted
;
struct
bkey_packed
*
k
;
struct
bch_extent_ptr
*
ptr
;
struct
bset
*
i
;
bool
used_mempool
,
blacklisted
;
bool
updated_range
=
b
->
key
.
k
.
type
==
KEY_TYPE_btree_ptr_v2
&&
...
...
@@ -1896,7 +1895,6 @@ static int validate_bset_for_write(struct bch_fs *c, struct btree *b,
static
void
btree_write_submit
(
struct
work_struct
*
work
)
{
struct
btree_write_bio
*
wbio
=
container_of
(
work
,
struct
btree_write_bio
,
work
);
struct
bch_extent_ptr
*
ptr
;
BKEY_PADDED_ONSTACK
(
k
,
BKEY_BTREE_PTR_VAL_U64s_MAX
)
tmp
;
bkey_copy
(
&
tmp
.
k
,
&
wbio
->
key
);
...
...
fs/bcachefs/data_update.c
View file @
0beebd92
...
...
@@ -356,7 +356,6 @@ void bch2_data_update_exit(struct data_update *update)
struct
bch_fs
*
c
=
update
->
op
.
c
;
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
bkey_i_to_s_c
(
update
->
k
.
k
));
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
{
if
(
c
->
opts
.
nocow_enabled
)
...
...
@@ -377,7 +376,6 @@ static void bch2_update_unwritten_extent(struct btree_trans *trans,
struct
bio
*
bio
=
&
update
->
op
.
wbio
.
bio
;
struct
bkey_i_extent
*
e
;
struct
write_point
*
wp
;
struct
bch_extent_ptr
*
ptr
;
struct
closure
cl
;
struct
btree_iter
iter
;
struct
bkey_s_c
k
;
...
...
@@ -509,7 +507,6 @@ int bch2_data_update_init(struct btree_trans *trans,
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
union
bch_extent_entry
*
entry
;
struct
extent_ptr_decoded
p
;
const
struct
bch_extent_ptr
*
ptr
;
unsigned
i
,
reserve_sectors
=
k
.
k
->
size
*
data_opts
.
extra_replicas
;
unsigned
ptrs_locked
=
0
;
int
ret
=
0
;
...
...
@@ -655,7 +652,6 @@ int bch2_data_update_init(struct btree_trans *trans,
void
bch2_data_update_opts_normalize
(
struct
bkey_s_c
k
,
struct
data_update_opts
*
opts
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
unsigned
i
=
0
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
{
...
...
fs/bcachefs/ec.c
View file @
0beebd92
...
...
@@ -161,7 +161,6 @@ static const struct bch_extent_ptr *bkey_matches_stripe(struct bch_stripe *s,
struct
bkey_s_c
k
,
unsigned
*
block
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
unsigned
i
,
nr_data
=
s
->
nr_blocks
-
s
->
nr_redundant
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
...
...
fs/bcachefs/extents.c
View file @
0beebd92
...
...
@@ -843,7 +843,6 @@ void bch2_bkey_drop_device_noerror(struct bkey_s k, unsigned dev)
const
struct
bch_extent_ptr
*
bch2_bkey_has_device_c
(
struct
bkey_s_c
k
,
unsigned
dev
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
if
(
ptr
->
dev
==
dev
)
...
...
@@ -855,7 +854,6 @@ const struct bch_extent_ptr *bch2_bkey_has_device_c(struct bkey_s_c k, unsigned
bool
bch2_bkey_has_target
(
struct
bch_fs
*
c
,
struct
bkey_s_c
k
,
unsigned
target
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
if
(
bch2_dev_in_target
(
c
,
ptr
->
dev
,
target
)
&&
...
...
@@ -1065,7 +1063,6 @@ static int extent_ptr_invalid(struct bch_fs *c,
struct
printbuf
*
err
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr2
;
u64
bucket
;
u32
bucket_offset
;
struct
bch_dev
*
ca
;
...
...
@@ -1307,7 +1304,6 @@ unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c, struct bkey_s_c k,
}
incompressible:
if
(
target
&&
bch2_target_accepts_data
(
c
,
BCH_DATA_user
,
target
))
{
const
struct
bch_extent_ptr
*
ptr
;
unsigned
i
=
0
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
{
...
...
fs/bcachefs/extents.h
View file @
0beebd92
...
...
@@ -300,7 +300,7 @@ static inline struct bkey_ptrs bch2_bkey_ptrs(struct bkey_s k)
bkey_extent_entry_for_each_from(_p, _entry, _p.start)
#define __bkey_for_each_ptr(_start, _end, _ptr) \
for (
(_ptr) = (_start);
\
for (
typeof(_start) (_ptr) = (_start);
\
((_ptr) = __bkey_ptr_next(_ptr, _end)); \
(_ptr)++)
...
...
@@ -547,7 +547,6 @@ static inline bool bkey_extent_is_allocation(const struct bkey *k)
static
inline
bool
bkey_extent_is_unwritten
(
struct
bkey_s_c
k
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
ptrs
,
ptr
)
if
(
ptr
->
unwritten
)
...
...
@@ -565,7 +564,6 @@ static inline struct bch_devs_list bch2_bkey_devs(struct bkey_s_c k)
{
struct
bch_devs_list
ret
=
(
struct
bch_devs_list
)
{
0
};
struct
bkey_ptrs_c
p
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
p
,
ptr
)
ret
.
data
[
ret
.
nr
++
]
=
ptr
->
dev
;
...
...
@@ -577,7 +575,6 @@ static inline struct bch_devs_list bch2_bkey_dirty_devs(struct bkey_s_c k)
{
struct
bch_devs_list
ret
=
(
struct
bch_devs_list
)
{
0
};
struct
bkey_ptrs_c
p
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
p
,
ptr
)
if
(
!
ptr
->
cached
)
...
...
@@ -590,7 +587,6 @@ static inline struct bch_devs_list bch2_bkey_cached_devs(struct bkey_s_c k)
{
struct
bch_devs_list
ret
=
(
struct
bch_devs_list
)
{
0
};
struct
bkey_ptrs_c
p
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
p
,
ptr
)
if
(
ptr
->
cached
)
...
...
fs/bcachefs/io_misc.c
View file @
0beebd92
...
...
@@ -74,7 +74,6 @@ int bch2_extent_fallocate(struct btree_trans *trans,
struct
bkey_i_extent
*
e
;
struct
bch_devs_list
devs_have
;
struct
write_point
*
wp
;
struct
bch_extent_ptr
*
ptr
;
devs_have
.
nr
=
0
;
...
...
fs/bcachefs/io_write.c
View file @
0beebd92
...
...
@@ -396,16 +396,14 @@ void bch2_submit_wbio_replicas(struct bch_write_bio *wbio, struct bch_fs *c,
bool
nocow
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
bkey_i_to_s_c
(
k
));
const
struct
bch_extent_ptr
*
ptr
;
struct
bch_write_bio
*
n
;
struct
bch_dev
*
ca
;
BUG_ON
(
c
->
opts
.
nochanges
);
bkey_for_each_ptr
(
ptrs
,
ptr
)
{
BUG_ON
(
!
bch2_dev_exists2
(
c
,
ptr
->
dev
));
ca
=
bch_dev_bkey_exists
(
c
,
ptr
->
dev
);
struct
bch_dev
*
ca
=
bch_dev_bkey_exists
(
c
,
ptr
->
dev
);
if
(
to_entry
(
ptr
+
1
)
<
ptrs
.
end
)
{
n
=
to_wbio
(
bio_alloc_clone
(
NULL
,
&
wbio
->
bio
,
...
...
@@ -1108,7 +1106,6 @@ static bool bch2_extent_is_writeable(struct bch_write_op *op,
static
inline
void
bch2_nocow_write_unlock
(
struct
bch_write_op
*
op
)
{
struct
bch_fs
*
c
=
op
->
c
;
const
struct
bch_extent_ptr
*
ptr
;
struct
bkey_i
*
k
;
for_each_keylist_key
(
&
op
->
insert_keys
,
k
)
{
...
...
@@ -1127,25 +1124,20 @@ static int bch2_nocow_write_convert_one_unwritten(struct btree_trans *trans,
struct
bkey_s_c
k
,
u64
new_i_size
)
{
struct
bkey_i
*
new
;
struct
bkey_ptrs
ptrs
;
struct
bch_extent_ptr
*
ptr
;
int
ret
;
if
(
!
bch2_extents_match
(
bkey_i_to_s_c
(
orig
),
k
))
{
/* trace this */
return
0
;
}
new
=
bch2_bkey_make_mut_noupdate
(
trans
,
k
);
ret
=
PTR_ERR_OR_ZERO
(
new
);
struct
bkey_i
*
new
=
bch2_bkey_make_mut_noupdate
(
trans
,
k
);
int
ret
=
PTR_ERR_OR_ZERO
(
new
);
if
(
ret
)
return
ret
;
bch2_cut_front
(
bkey_start_pos
(
&
orig
->
k
),
new
);
bch2_cut_back
(
orig
->
k
.
p
,
new
);
ptrs
=
bch2_bkey_ptrs
(
bkey_i_to_s
(
new
));
struct
bkey_ptrs
ptrs
=
bch2_bkey_ptrs
(
bkey_i_to_s
(
new
));
bkey_for_each_ptr
(
ptrs
,
ptr
)
ptr
->
unwritten
=
0
;
...
...
@@ -1225,8 +1217,6 @@ static void bch2_nocow_write(struct bch_write_op *op)
struct
btree_trans
*
trans
;
struct
btree_iter
iter
;
struct
bkey_s_c
k
;
struct
bkey_ptrs_c
ptrs
;
const
struct
bch_extent_ptr
*
ptr
;
DARRAY_PREALLOCATED
(
struct
bucket_to_lock
,
3
)
buckets
;
u32
snapshot
;
struct
bucket_to_lock
*
stale_at
;
...
...
@@ -1269,7 +1259,7 @@ static void bch2_nocow_write(struct bch_write_op *op)
break
;
/* Get iorefs before dropping btree locks: */
ptrs
=
bch2_bkey_ptrs_c
(
k
);
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
bkey_for_each_ptr
(
ptrs
,
ptr
)
{
struct
bpos
b
=
PTR_BUCKET_POS
(
c
,
ptr
);
struct
nocow_lock_bucket
*
l
=
...
...
fs/bcachefs/journal_io.c
View file @
0beebd92
...
...
@@ -1678,7 +1678,6 @@ static CLOSURE_CALLBACK(do_journal_write)
struct
bch_fs
*
c
=
container_of
(
j
,
struct
bch_fs
,
journal
);
struct
bch_dev
*
ca
;
struct
journal_buf
*
w
=
journal_last_unwritten_buf
(
j
);
struct
bch_extent_ptr
*
ptr
;
struct
bio
*
bio
;
unsigned
sectors
=
vstruct_sectors
(
w
->
data
,
c
->
block_bits
);
...
...
fs/bcachefs/move.c
View file @
0beebd92
...
...
@@ -695,9 +695,6 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
break
;
if
(
!
bp
.
level
)
{
const
struct
bch_extent_ptr
*
ptr
;
unsigned
i
=
0
;
k
=
bch2_backpointer_get_key
(
trans
,
&
iter
,
bp_pos
,
bp
,
0
);
ret
=
bkey_err
(
k
);
if
(
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
...
...
@@ -720,6 +717,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt,
data_opts
.
target
=
io_opts
.
background_target
;
data_opts
.
rewrite_ptrs
=
0
;
unsigned
i
=
0
;
bkey_for_each_ptr
(
bch2_bkey_ptrs_c
(
k
),
ptr
)
{
if
(
ptr
->
dev
==
bucket
.
inode
)
{
data_opts
.
rewrite_ptrs
|=
1U
<<
i
;
...
...
@@ -890,7 +888,6 @@ static bool migrate_pred(struct bch_fs *c, void *arg,
struct
data_update_opts
*
data_opts
)
{
struct
bkey_ptrs_c
ptrs
=
bch2_bkey_ptrs_c
(
k
);
const
struct
bch_extent_ptr
*
ptr
;
struct
bch_ioctl_data
*
op
=
arg
;
unsigned
i
=
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