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
037a2d9f
Commit
037a2d9f
authored
Dec 23, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: simplify bch_devs_list
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
defd9e39
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
23 deletions
+18
-23
fs/bcachefs/alloc_foreground.c
fs/bcachefs/alloc_foreground.c
+2
-2
fs/bcachefs/extents.h
fs/bcachefs/extents.h
+3
-3
fs/bcachefs/replicas.c
fs/bcachefs/replicas.c
+2
-4
fs/bcachefs/sb-members.h
fs/bcachefs/sb-members.h
+10
-13
fs/bcachefs/super_types.h
fs/bcachefs/super_types.h
+1
-1
No files found.
fs/bcachefs/alloc_foreground.c
View file @
037a2d9f
...
...
@@ -970,8 +970,8 @@ static int __open_bucket_add_buckets(struct btree_trans *trans,
devs
=
target_rw_devs
(
c
,
wp
->
data_type
,
target
);
/* Don't allocate from devices we already have pointers to: */
for
(
i
=
0
;
i
<
devs_have
->
nr
;
i
++
)
__clear_bit
(
devs_have
->
devs
[
i
]
,
devs
.
d
);
darray_for_each
(
*
devs_have
,
i
)
__clear_bit
(
*
i
,
devs
.
d
);
open_bucket_for_each
(
c
,
ptrs
,
ob
,
i
)
__clear_bit
(
ob
->
dev
,
devs
.
d
);
...
...
fs/bcachefs/extents.h
View file @
037a2d9f
...
...
@@ -568,7 +568,7 @@ static inline struct bch_devs_list bch2_bkey_devs(struct bkey_s_c k)
const
struct
bch_extent_ptr
*
ptr
;
bkey_for_each_ptr
(
p
,
ptr
)
ret
.
d
evs
[
ret
.
nr
++
]
=
ptr
->
dev
;
ret
.
d
ata
[
ret
.
nr
++
]
=
ptr
->
dev
;
return
ret
;
}
...
...
@@ -581,7 +581,7 @@ static inline struct bch_devs_list bch2_bkey_dirty_devs(struct bkey_s_c k)
bkey_for_each_ptr
(
p
,
ptr
)
if
(
!
ptr
->
cached
)
ret
.
d
evs
[
ret
.
nr
++
]
=
ptr
->
dev
;
ret
.
d
ata
[
ret
.
nr
++
]
=
ptr
->
dev
;
return
ret
;
}
...
...
@@ -594,7 +594,7 @@ static inline struct bch_devs_list bch2_bkey_cached_devs(struct bkey_s_c k)
bkey_for_each_ptr
(
p
,
ptr
)
if
(
ptr
->
cached
)
ret
.
d
evs
[
ret
.
nr
++
]
=
ptr
->
dev
;
ret
.
d
ata
[
ret
.
nr
++
]
=
ptr
->
dev
;
return
ret
;
}
...
...
fs/bcachefs/replicas.c
View file @
037a2d9f
...
...
@@ -173,8 +173,6 @@ void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *e,
enum
bch_data_type
data_type
,
struct
bch_devs_list
devs
)
{
unsigned
i
;
BUG_ON
(
!
data_type
||
data_type
==
BCH_DATA_sb
||
data_type
>=
BCH_DATA_NR
);
...
...
@@ -183,8 +181,8 @@ void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *e,
e
->
nr_devs
=
0
;
e
->
nr_required
=
1
;
for
(
i
=
0
;
i
<
devs
.
nr
;
i
++
)
e
->
devs
[
e
->
nr_devs
++
]
=
devs
.
devs
[
i
]
;
darray_for_each
(
devs
,
i
)
e
->
devs
[
e
->
nr_devs
++
]
=
*
i
;
bch2_replicas_entry_sort
(
e
);
}
...
...
fs/bcachefs/sb-members.h
View file @
037a2d9f
...
...
@@ -2,6 +2,8 @@
#ifndef _BCACHEFS_SB_MEMBERS_H
#define _BCACHEFS_SB_MEMBERS_H
#include "darray.h"
extern
char
*
const
bch2_member_error_strs
[];
static
inline
struct
bch_member
*
...
...
@@ -47,23 +49,18 @@ static inline unsigned dev_mask_nr(const struct bch_devs_mask *devs)
static
inline
bool
bch2_dev_list_has_dev
(
struct
bch_devs_list
devs
,
unsigned
dev
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
devs
.
nr
;
i
++
)
if
(
devs
.
devs
[
i
]
==
dev
)
darray_for_each
(
devs
,
i
)
if
(
*
i
==
dev
)
return
true
;
return
false
;
}
static
inline
void
bch2_dev_list_drop_dev
(
struct
bch_devs_list
*
devs
,
unsigned
dev
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
devs
->
nr
;
i
++
)
if
(
devs
->
devs
[
i
]
==
dev
)
{
array_remove_item
(
devs
->
devs
,
devs
->
nr
,
i
);
darray_for_each
(
*
devs
,
i
)
if
(
*
i
==
dev
)
{
darray_remove_item
(
devs
,
i
);
return
;
}
}
...
...
@@ -72,14 +69,14 @@ static inline void bch2_dev_list_add_dev(struct bch_devs_list *devs,
unsigned
dev
)
{
if
(
!
bch2_dev_list_has_dev
(
*
devs
,
dev
))
{
BUG_ON
(
devs
->
nr
>=
ARRAY_SIZE
(
devs
->
d
evs
));
devs
->
d
evs
[
devs
->
nr
++
]
=
dev
;
BUG_ON
(
devs
->
nr
>=
ARRAY_SIZE
(
devs
->
d
ata
));
devs
->
d
ata
[
devs
->
nr
++
]
=
dev
;
}
}
static
inline
struct
bch_devs_list
bch2_dev_list_single
(
unsigned
dev
)
{
return
(
struct
bch_devs_list
)
{
.
nr
=
1
,
.
d
evs
[
0
]
=
dev
};
return
(
struct
bch_devs_list
)
{
.
nr
=
1
,
.
d
ata
[
0
]
=
dev
};
}
static
inline
struct
bch_dev
*
__bch2_next_dev
(
struct
bch_fs
*
c
,
unsigned
*
iter
,
...
...
fs/bcachefs/super_types.h
View file @
037a2d9f
...
...
@@ -22,7 +22,7 @@ struct bch_devs_mask {
struct
bch_devs_list
{
u8
nr
;
u8
d
evs
[
BCH_BKEY_PTRS_MAX
];
u8
d
ata
[
BCH_BKEY_PTRS_MAX
];
};
struct
bch_member_cpu
{
...
...
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