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
4cd91e2f
Commit
4cd91e2f
authored
May 03, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Convert to bch2_dev_tryget_noerror()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
b07eb825
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
18 deletions
+4
-18
fs/bcachefs/alloc_foreground.c
fs/bcachefs/alloc_foreground.c
+3
-12
fs/bcachefs/chardev.c
fs/bcachefs/chardev.c
+1
-6
No files found.
fs/bcachefs/alloc_foreground.c
View file @
4cd91e2f
...
@@ -717,25 +717,16 @@ int bch2_bucket_alloc_set_trans(struct btree_trans *trans,
...
@@ -717,25 +717,16 @@ int bch2_bucket_alloc_set_trans(struct btree_trans *trans,
struct
bch_fs
*
c
=
trans
->
c
;
struct
bch_fs
*
c
=
trans
->
c
;
struct
dev_alloc_list
devs_sorted
=
struct
dev_alloc_list
devs_sorted
=
bch2_dev_alloc_list
(
c
,
stripe
,
devs_may_alloc
);
bch2_dev_alloc_list
(
c
,
stripe
,
devs_may_alloc
);
unsigned
dev
;
struct
bch_dev
*
ca
;
int
ret
=
-
BCH_ERR_insufficient_devices
;
int
ret
=
-
BCH_ERR_insufficient_devices
;
unsigned
i
;
BUG_ON
(
*
nr_effective
>=
nr_replicas
);
BUG_ON
(
*
nr_effective
>=
nr_replicas
);
for
(
i
=
0
;
i
<
devs_sorted
.
nr
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
devs_sorted
.
nr
;
i
++
)
{
struct
bch_dev_usage
usage
;
struct
bch_dev_usage
usage
;
struct
open_bucket
*
ob
;
struct
open_bucket
*
ob
;
dev
=
devs_sorted
.
devs
[
i
];
unsigned
dev
=
devs_sorted
.
devs
[
i
];
struct
bch_dev
*
ca
=
bch2_dev_tryget_noerror
(
c
,
dev
);
rcu_read_lock
();
ca
=
rcu_dereference
(
c
->
devs
[
dev
]);
if
(
ca
)
bch2_dev_get
(
ca
);
rcu_read_unlock
();
if
(
!
ca
)
if
(
!
ca
)
continue
;
continue
;
...
...
fs/bcachefs/chardev.c
View file @
4cd91e2f
...
@@ -32,12 +32,7 @@ static struct bch_dev *bch2_device_lookup(struct bch_fs *c, u64 dev,
...
@@ -32,12 +32,7 @@ static struct bch_dev *bch2_device_lookup(struct bch_fs *c, u64 dev,
if
(
dev
>=
c
->
sb
.
nr_devices
)
if
(
dev
>=
c
->
sb
.
nr_devices
)
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
rcu_read_lock
();
ca
=
bch2_dev_tryget_noerror
(
c
,
dev
);
ca
=
rcu_dereference
(
c
->
devs
[
dev
]);
if
(
ca
)
bch2_dev_get
(
ca
);
rcu_read_unlock
();
if
(
!
ca
)
if
(
!
ca
)
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
}
else
{
}
else
{
...
...
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