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
e46c181a
Commit
e46c181a
authored
Sep 11, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Convert more code to bch_err_msg()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
da187cac
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
67 additions
and
79 deletions
+67
-79
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+1
-1
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+6
-6
fs/bcachefs/btree_update_interior.c
fs/bcachefs/btree_update_interior.c
+2
-3
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+1
-2
fs/bcachefs/fs.c
fs/bcachefs/fs.c
+1
-1
fs/bcachefs/fsck.c
fs/bcachefs/fsck.c
+22
-28
fs/bcachefs/journal.c
fs/bcachefs/journal.c
+1
-1
fs/bcachefs/journal_reclaim.c
fs/bcachefs/journal_reclaim.c
+1
-1
fs/bcachefs/migrate.c
fs/bcachefs/migrate.c
+1
-2
fs/bcachefs/movinggc.c
fs/bcachefs/movinggc.c
+3
-4
fs/bcachefs/rebalance.c
fs/bcachefs/rebalance.c
+1
-1
fs/bcachefs/replicas.c
fs/bcachefs/replicas.c
+1
-1
fs/bcachefs/snapshot.c
fs/bcachefs/snapshot.c
+3
-3
fs/bcachefs/subvolume.c
fs/bcachefs/subvolume.c
+2
-3
fs/bcachefs/super.c
fs/bcachefs/super.c
+21
-22
No files found.
fs/bcachefs/alloc_background.c
View file @
e46c181a
...
...
@@ -1931,7 +1931,7 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca,
bch2_trans_exit
(
&
trans
);
if
(
ret
<
0
)
{
bch_err
(
ca
,
"error initializing free space: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
ca
,
ret
,
"initializing free space"
);
return
ret
;
}
...
...
fs/bcachefs/btree_gc.c
View file @
e46c181a
...
...
@@ -1483,7 +1483,7 @@ static int bch2_gc_alloc_done(struct bch_fs *c, bool metadata_only)
bch2_alloc_write_key
(
&
trans
,
&
iter
,
k
,
metadata_only
));
if
(
ret
<
0
)
{
bch_err
(
c
,
"error writing alloc info: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
percpu_ref_put
(
&
ca
->
ref
);
break
;
}
...
...
@@ -1548,7 +1548,7 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only)
bch2_trans_exit
(
&
trans
);
if
(
ret
)
bch_err
(
c
,
"error reading alloc info at gc start: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
return
ret
;
}
...
...
@@ -1998,7 +1998,7 @@ int bch2_gc_gens(struct bch_fs *c)
BTREE_INSERT_NOFAIL
,
gc_btree_gens_key
(
&
trans
,
&
iter
,
k
));
if
(
ret
&&
!
bch2_err_matches
(
ret
,
EROFS
))
bch_err
(
c
,
"error recalculating oldest_gen: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
if
(
ret
)
goto
err
;
}
...
...
@@ -2011,7 +2011,7 @@ int bch2_gc_gens(struct bch_fs *c)
BTREE_INSERT_NOFAIL
,
bch2_alloc_write_oldest_gen
(
&
trans
,
&
iter
,
k
));
if
(
ret
&&
!
bch2_err_matches
(
ret
,
EROFS
))
bch_err
(
c
,
"error writing oldest_gen: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
if
(
ret
)
goto
err
;
...
...
@@ -2083,7 +2083,7 @@ static int bch2_gc_thread(void *arg)
ret
=
bch2_gc_gens
(
c
);
#endif
if
(
ret
<
0
)
bch_err
(
c
,
"btree gc failed: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
debug_check_no_locks_held
();
}
...
...
@@ -2113,7 +2113,7 @@ int bch2_gc_thread_start(struct bch_fs *c)
p
=
kthread_create
(
bch2_gc_thread
,
c
,
"bch-gc/%s"
,
c
->
name
);
if
(
IS_ERR
(
p
))
{
bch_err
(
c
,
"error creating gc thread: %s"
,
bch2_err_str
(
PTR_ERR
(
p
)
));
bch_err
_fn
(
c
,
PTR_ERR
(
p
));
return
PTR_ERR
(
p
);
}
...
...
fs/bcachefs/btree_update_interior.c
View file @
e46c181a
...
...
@@ -2057,7 +2057,7 @@ static void async_btree_node_rewrite_work(struct work_struct *work)
ret
=
bch2_trans_do
(
c
,
NULL
,
NULL
,
0
,
async_btree_node_rewrite_trans
(
&
trans
,
a
));
if
(
ret
)
bch_err
(
c
,
"%s: error %s"
,
__func__
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
bch2_write_ref_put
(
c
,
BCH_WRITE_REF_node_rewrite
);
kfree
(
a
);
}
...
...
@@ -2096,8 +2096,7 @@ void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b)
ret
=
bch2_fs_read_write_early
(
c
);
if
(
ret
)
{
bch_err
(
c
,
"%s: error going read-write: %s"
,
__func__
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"going read-write"
);
kfree
(
a
);
return
;
}
...
...
fs/bcachefs/ec.c
View file @
e46c181a
...
...
@@ -1133,8 +1133,7 @@ static void ec_stripe_create(struct ec_stripe_new *s)
ret
=
ec_stripe_update_extents
(
c
,
&
s
->
new_stripe
);
if
(
ret
)
{
bch_err
(
c
,
"error creating stripe: error updating pointers: %s"
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"creating stripe: error updating pointers"
);
goto
err
;
}
err:
...
...
fs/bcachefs/fs.c
View file @
e46c181a
...
...
@@ -1890,7 +1890,7 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,
vinode
=
bch2_vfs_inode_get
(
c
,
BCACHEFS_ROOT_SUBVOL_INUM
);
ret
=
PTR_ERR_OR_ZERO
(
vinode
);
if
(
ret
)
{
bch_err
(
c
,
"error mounting: error getting root inode: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"mounting: error getting root inode"
);
goto
err_put_super
;
}
...
...
fs/bcachefs/fsck.c
View file @
e46c181a
...
...
@@ -80,7 +80,7 @@ static int __snapshot_lookup_subvol(struct btree_trans *trans, u32 snapshot,
if
(
!
ret
)
*
subvol
=
le32_to_cpu
(
s
.
subvol
);
else
if
(
bch2_err_matches
(
ret
,
ENOENT
))
bch_err
(
trans
->
c
,
"snapshot %u not fo
nu
d"
,
snapshot
);
bch_err
(
trans
->
c
,
"snapshot %u not fo
un
d"
,
snapshot
);
return
ret
;
}
...
...
@@ -127,8 +127,7 @@ static int lookup_first_inode(struct btree_trans *trans, u64 inode_nr,
ret
=
bch2_inode_unpack
(
k
,
inode
);
err:
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
trans
->
c
,
"error fetching inode %llu: %s"
,
inode_nr
,
bch2_err_str
(
ret
));
bch_err_msg
(
trans
->
c
,
ret
,
"fetching inode %llu"
,
inode_nr
);
bch2_trans_iter_exit
(
trans
,
&
iter
);
return
ret
;
}
...
...
@@ -154,8 +153,7 @@ static int __lookup_inode(struct btree_trans *trans, u64 inode_nr,
*
snapshot
=
iter
.
pos
.
snapshot
;
err:
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
trans
->
c
,
"error fetching inode %llu:%u: %s"
,
inode_nr
,
*
snapshot
,
bch2_err_str
(
ret
));
bch_err_msg
(
trans
->
c
,
ret
,
"fetching inode %llu:%u"
,
inode_nr
,
*
snapshot
);
bch2_trans_iter_exit
(
trans
,
&
iter
);
return
ret
;
}
...
...
@@ -206,17 +204,16 @@ static int __write_inode(struct btree_trans *trans,
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE
);
}
static
int
write_inode
(
struct
btree_trans
*
trans
,
struct
bch_inode_unpacked
*
inode
,
u32
snapshot
)
static
int
fsck_
write_inode
(
struct
btree_trans
*
trans
,
struct
bch_inode_unpacked
*
inode
,
u32
snapshot
)
{
int
ret
=
commit_do
(
trans
,
NULL
,
NULL
,
BTREE_INSERT_NOFAIL
|
BTREE_INSERT_LAZY_RW
,
__write_inode
(
trans
,
inode
,
snapshot
));
if
(
ret
)
bch_err
(
trans
->
c
,
"error in fsck: error updating inode: %s"
,
bch2_err_str
(
ret
));
bch_err_fn
(
trans
->
c
,
ret
);
return
ret
;
}
...
...
@@ -278,7 +275,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 subvol,
}
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
c
,
"error looking up lost+found: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
if
(
ret
)
return
ret
;
...
...
@@ -301,7 +298,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 subvol,
0
,
0
,
S_IFDIR
|
0700
,
0
,
NULL
,
NULL
,
(
subvol_inum
)
{
},
0
);
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
c
,
"error creating lost+found: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"creating lost+found"
);
return
ret
;
}
...
...
@@ -365,8 +362,7 @@ static int reattach_inode(struct btree_trans *trans,
BTREE_INSERT_NOFAIL
,
__reattach_inode
(
trans
,
inode
,
inode_snapshot
));
if
(
ret
)
{
bch_err
(
trans
->
c
,
"error reattaching inode %llu: %s"
,
inode
->
bi_inum
,
bch2_err_str
(
ret
));
bch_err_msg
(
trans
->
c
,
ret
,
"reattaching inode %llu"
,
inode
->
bi_inum
);
return
ret
;
}
...
...
@@ -819,7 +815,7 @@ static int hash_check_key(struct btree_trans *trans,
bch2_bkey_val_to_text
(
&
buf
,
c
,
hash_k
),
buf
.
buf
)))
{
ret
=
hash_redo_key
(
trans
,
desc
,
hash_info
,
k_iter
,
hash_k
);
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
c
,
"hash_redo_key err %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
if
(
ret
)
return
ret
;
ret
=
-
BCH_ERR_transaction_restart_nested
;
...
...
@@ -883,7 +879,8 @@ static int check_inode(struct btree_trans *trans,
ret
=
__write_inode
(
trans
,
&
u
,
iter
->
pos
.
snapshot
);
if
(
ret
)
{
bch_err_msg
(
c
,
ret
,
"in fsck: error updating inode"
);
if
(
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err_msg
(
c
,
ret
,
"in fsck updating inode"
);
return
ret
;
}
...
...
@@ -901,8 +898,7 @@ static int check_inode(struct btree_trans *trans,
ret
=
bch2_inode_rm_snapshot
(
trans
,
u
.
bi_inum
,
iter
->
pos
.
snapshot
);
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
c
,
"error in fsck: error while deleting inode: %s"
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"in fsck deleting inode"
);
return
ret
;
}
...
...
@@ -925,8 +921,7 @@ static int check_inode(struct btree_trans *trans,
POS
(
u
.
bi_inum
,
U64_MAX
),
0
,
NULL
);
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
bch_err
(
c
,
"error in fsck: error truncating inode: %s"
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"in fsck truncating inode"
);
if
(
ret
)
return
ret
;
...
...
@@ -951,8 +946,7 @@ static int check_inode(struct btree_trans *trans,
sectors
=
bch2_count_inode_sectors
(
trans
,
u
.
bi_inum
,
iter
->
pos
.
snapshot
);
if
(
sectors
<
0
)
{
bch_err
(
c
,
"error in fsck: error recounting inode sectors: %s"
,
bch2_err_str
(
sectors
));
bch_err_msg
(
c
,
sectors
,
"fsck recounting inode sectors"
);
return
sectors
;
}
...
...
@@ -971,13 +965,13 @@ static int check_inode(struct btree_trans *trans,
if
(
do_update
)
{
ret
=
__write_inode
(
trans
,
&
u
,
iter
->
pos
.
snapshot
);
if
(
ret
)
{
bch_err_msg
(
c
,
ret
,
"in fsck
: error
updating inode"
);
bch_err_msg
(
c
,
ret
,
"in fsck updating inode"
);
return
ret
;
}
}
err:
fsck_err:
if
(
ret
)
if
(
ret
&&
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
)
)
bch_err_fn
(
c
,
ret
);
return
ret
;
}
...
...
@@ -1078,7 +1072,7 @@ static int check_i_sectors(struct btree_trans *trans, struct inode_walker *w)
w
->
last_pos
.
inode
,
i
->
snapshot
,
i
->
inode
.
bi_sectors
,
i
->
count
))
{
i
->
inode
.
bi_sectors
=
i
->
count
;
ret
=
write_inode
(
trans
,
&
i
->
inode
,
i
->
snapshot
);
ret
=
fsck_
write_inode
(
trans
,
&
i
->
inode
,
i
->
snapshot
);
if
(
ret
)
break
;
}
...
...
@@ -1496,7 +1490,7 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w)
"directory %llu:%u with wrong i_nlink: got %u, should be %llu"
,
w
->
last_pos
.
inode
,
i
->
snapshot
,
i
->
inode
.
bi_nlink
,
i
->
count
))
{
i
->
inode
.
bi_nlink
=
i
->
count
;
ret
=
write_inode
(
trans
,
&
i
->
inode
,
i
->
snapshot
);
ret
=
fsck_
write_inode
(
trans
,
&
i
->
inode
,
i
->
snapshot
);
if
(
ret
)
break
;
}
...
...
@@ -1923,7 +1917,7 @@ static int check_root_trans(struct btree_trans *trans)
__bch2_btree_insert
(
trans
,
BTREE_ID_subvolumes
,
&
root_subvol
.
k_i
,
0
));
if
(
ret
)
{
bch_err
(
c
,
"error writing root subvol: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"writing root subvol"
);
goto
err
;
}
...
...
@@ -1942,7 +1936,7 @@ static int check_root_trans(struct btree_trans *trans)
ret
=
__write_inode
(
trans
,
&
root_inode
,
snapshot
);
if
(
ret
)
bch_err
(
c
,
"error writing root inode: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"writing root inode"
);
}
err:
fsck_err:
...
...
fs/bcachefs/journal.c
View file @
e46c181a
...
...
@@ -834,7 +834,7 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr,
ca
->
mi
.
bucket_size
));
if
(
ret
)
{
bch2_open_bucket_put
(
c
,
ob
[
nr_got
]);
bch_err
(
c
,
"error marking new journal buckets: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"marking new journal buckets"
);
break
;
}
...
...
fs/bcachefs/journal_reclaim.c
View file @
e46c181a
...
...
@@ -758,7 +758,7 @@ int bch2_journal_reclaim_start(struct journal *j)
"bch-reclaim/%s"
,
c
->
name
);
ret
=
PTR_ERR_OR_ZERO
(
p
);
if
(
ret
)
{
bch_err
(
c
,
"error creating journal reclaim thread: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"creating journal reclaim thread"
);
return
ret
;
}
...
...
fs/bcachefs/migrate.c
View file @
e46c181a
...
...
@@ -148,8 +148,7 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags)
}
if
(
ret
)
{
bch_err
(
c
,
"Error updating btree node key: %s"
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"updating btree node key"
);
break
;
}
next:
...
...
fs/bcachefs/movinggc.c
View file @
e46c181a
...
...
@@ -242,7 +242,7 @@ static int bch2_copygc(struct btree_trans *trans,
ret
=
0
;
if
(
ret
<
0
&&
!
bch2_err_matches
(
ret
,
EROFS
))
bch_err
(
c
,
"error from bch2_move_data() in copygc: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"from bch2_move_data()"
);
moved
=
atomic64_read
(
&
ctxt
->
stats
->
sectors_moved
)
-
moved
;
trace_and_count
(
c
,
copygc
,
c
,
moved
,
0
,
0
,
0
);
...
...
@@ -320,8 +320,7 @@ static int bch2_copygc_thread(void *arg)
ret
=
rhashtable_init
(
&
move_buckets
.
table
,
&
bch_move_bucket_params
);
if
(
ret
)
{
bch_err
(
c
,
"error allocating copygc buckets in flight: %s"
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"allocating copygc buckets in flight"
);
return
ret
;
}
...
...
@@ -404,7 +403,7 @@ int bch2_copygc_start(struct bch_fs *c)
t
=
kthread_create
(
bch2_copygc_thread
,
c
,
"bch-copygc/%s"
,
c
->
name
);
ret
=
PTR_ERR_OR_ZERO
(
t
);
if
(
ret
)
{
bch_err
(
c
,
"error creating copygc thread: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"creating copygc thread"
);
return
ret
;
}
...
...
fs/bcachefs/rebalance.c
View file @
e46c181a
...
...
@@ -350,7 +350,7 @@ int bch2_rebalance_start(struct bch_fs *c)
p
=
kthread_create
(
bch2_rebalance_thread
,
c
,
"bch-rebalance/%s"
,
c
->
name
);
ret
=
PTR_ERR_OR_ZERO
(
p
);
if
(
ret
)
{
bch_err
(
c
,
"error creating rebalance thread: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"creating rebalance thread"
);
return
ret
;
}
...
...
fs/bcachefs/replicas.c
View file @
e46c181a
...
...
@@ -429,7 +429,7 @@ static int bch2_mark_replicas_slowpath(struct bch_fs *c,
return
ret
;
err:
bch_err
(
c
,
"error adding replicas entry: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"adding replicas entry"
);
goto
out
;
}
...
...
fs/bcachefs/snapshot.c
View file @
e46c181a
...
...
@@ -1385,7 +1385,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
if
(
!
test_bit
(
BCH_FS_STARTED
,
&
c
->
flags
))
{
ret
=
bch2_fs_read_write_early
(
c
);
if
(
ret
)
{
bch_err
(
c
,
"error deleleting dead snapshots: error going rw: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"error deleleting dead snapshots: error going rw"
);
return
ret
;
}
}
...
...
@@ -1401,7 +1401,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
NULL
,
NULL
,
0
,
bch2_delete_redundant_snapshot
(
&
trans
,
&
iter
,
k
));
if
(
ret
)
{
bch_err
(
c
,
"error deleting redundant snapshots: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"deleting redundant snapshots"
);
goto
err
;
}
...
...
@@ -1409,7 +1409,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
POS_MIN
,
0
,
k
,
bch2_snapshot_set_equiv
(
&
trans
,
k
));
if
(
ret
)
{
bch_err
(
c
,
"error in bch2_snapshots_set_equiv: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"in bch2_snapshots_set_equiv"
);
goto
err
;
}
...
...
fs/bcachefs/subvolume.c
View file @
e46c181a
...
...
@@ -41,8 +41,7 @@ static int check_subvol(struct btree_trans *trans,
ret
=
bch2_subvolume_delete
(
trans
,
iter
->
pos
.
offset
);
if
(
ret
)
bch_err
(
c
,
"error deleting subvolume %llu: %s"
,
iter
->
pos
.
offset
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"deleting subvolume %llu"
,
iter
->
pos
.
offset
);
return
ret
?:
-
BCH_ERR_transaction_restart_nested
;
}
...
...
@@ -296,7 +295,7 @@ static void bch2_subvolume_wait_for_pagecache_and_delete(struct work_struct *wor
for
(
id
=
s
.
data
;
id
<
s
.
data
+
s
.
nr
;
id
++
)
{
ret
=
bch2_trans_run
(
c
,
bch2_subvolume_delete
(
&
trans
,
*
id
));
if
(
ret
)
{
bch_err
(
c
,
"error deleting subvolume %u: %s"
,
*
id
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"deleting subvolume %u"
,
*
id
);
break
;
}
}
...
...
fs/bcachefs/super.c
View file @
e46c181a
...
...
@@ -994,7 +994,7 @@ int bch2_fs_start(struct bch_fs *c)
up_write
(
&
c
->
state_lock
);
return
ret
;
err:
bch_err
(
c
,
"error starting filesystem: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"starting filesystem"
);
goto
out
;
}
...
...
@@ -1459,7 +1459,7 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)
bch2_btree_delete_range
(
c
,
BTREE_ID_bucket_gens
,
start
,
end
,
BTREE_TRIGGER_NORUN
,
NULL
);
if
(
ret
)
bch_err
(
c
,
"error removing dev alloc info: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"removing dev alloc info"
);
return
ret
;
}
...
...
@@ -1488,31 +1488,31 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
ret
=
bch2_dev_data_drop
(
c
,
ca
->
dev_idx
,
flags
);
if
(
ret
)
{
bch_err
(
ca
,
"Remove failed: error dropping data: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
ca
,
ret
,
"dropping data"
);
goto
err
;
}
ret
=
bch2_dev_remove_alloc
(
c
,
ca
);
if
(
ret
)
{
bch_err
(
ca
,
"Remove failed, error
deleting alloc info"
);
bch_err
_msg
(
ca
,
ret
,
"
deleting alloc info"
);
goto
err
;
}
ret
=
bch2_journal_flush_device_pins
(
&
c
->
journal
,
ca
->
dev_idx
);
if
(
ret
)
{
bch_err
(
ca
,
"Remove failed: error flushing journal: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
ca
,
ret
,
"flushing journal"
);
goto
err
;
}
ret
=
bch2_journal_flush
(
&
c
->
journal
);
if
(
ret
)
{
bch_err
(
ca
,
"
Remove failed,
journal error"
);
bch_err
(
ca
,
"journal error"
);
goto
err
;
}
ret
=
bch2_replicas_gc2
(
c
);
if
(
ret
)
{
bch_err
(
ca
,
"Remove failed: error from replicas gc: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
ca
,
ret
,
"in replicas_gc2()"
);
goto
err
;
}
...
...
@@ -1587,7 +1587,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret
=
bch2_read_super
(
path
,
&
opts
,
&
sb
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: error reading super: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"reading super"
);
goto
err
;
}
...
...
@@ -1603,7 +1603,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret
=
bch2_dev_may_add
(
sb
.
sb
,
c
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_fn
(
c
,
ret
);
goto
err
;
}
...
...
@@ -1624,7 +1624,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret
=
bch2_dev_journal_alloc
(
ca
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: journal alloc failed
"
);
bch_err
_msg
(
c
,
ret
,
"allocating journal
"
);
goto
err
;
}
...
...
@@ -1633,7 +1633,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret
=
bch2_sb_from_fs
(
c
,
ca
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: new device superblock too small
"
);
bch_err
_msg
(
c
,
ret
,
"setting up new superblock
"
);
goto
err_unlock
;
}
...
...
@@ -1642,8 +1642,8 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
if
(
!
bch2_sb_resize_members
(
&
ca
->
disk_sb
,
le32_to_cpu
(
mi
->
field
.
u64s
)
+
sizeof
(
dev_mi
)
/
sizeof
(
u64
)))
{
bch_err
(
c
,
"device add error: new device superblock too small"
);
ret
=
-
BCH_ERR_ENOSPC_sb_members
;
bch_err_msg
(
c
,
ret
,
"setting up new superblock"
);
goto
err_unlock
;
}
...
...
@@ -1655,8 +1655,8 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
if
(
!
bch2_dev_exists
(
c
->
disk_sb
.
sb
,
mi
,
dev_idx
))
goto
have_slot
;
no_slot:
bch_err
(
c
,
"device add error: already have maximum number of devices"
);
ret
=
-
BCH_ERR_ENOSPC_sb_members
;
bch_err_msg
(
c
,
ret
,
"setting up new superblock"
);
goto
err_unlock
;
have_slot:
...
...
@@ -1666,8 +1666,8 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
mi
=
bch2_sb_resize_members
(
&
c
->
disk_sb
,
u64s
);
if
(
!
mi
)
{
bch_err
(
c
,
"device add error: no room in superblock for member info"
);
ret
=
-
BCH_ERR_ENOSPC_sb_members
;
bch_err_msg
(
c
,
ret
,
"setting up new superblock"
);
goto
err_unlock
;
}
...
...
@@ -1683,7 +1683,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
if
(
BCH_MEMBER_GROUP
(
&
dev_mi
))
{
ret
=
__bch2_dev_group_set
(
c
,
ca
,
label
.
buf
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: error setting
label"
);
bch_err
_msg
(
c
,
ret
,
"creating new
label"
);
goto
err_unlock
;
}
}
...
...
@@ -1695,13 +1695,13 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
ret
=
bch2_trans_mark_dev_sb
(
c
,
ca
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: error marking new superblock: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"marking new superblock"
);
goto
err_late
;
}
ret
=
bch2_fs_freespace_init
(
c
);
if
(
ret
)
{
bch_err
(
c
,
"device add error: error initializing free space: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"initializing free space"
);
goto
err_late
;
}
...
...
@@ -1751,7 +1751,7 @@ int bch2_dev_online(struct bch_fs *c, const char *path)
ret
=
bch2_dev_in_fs
(
c
->
disk_sb
.
sb
,
sb
.
sb
);
if
(
ret
)
{
bch_err
(
c
,
"error bringing %s online: %s"
,
path
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"bringing %s online"
,
path
);
goto
err
;
}
...
...
@@ -1763,8 +1763,7 @@ int bch2_dev_online(struct bch_fs *c, const char *path)
ret
=
bch2_trans_mark_dev_sb
(
c
,
ca
);
if
(
ret
)
{
bch_err
(
c
,
"error bringing %s online: error from bch2_trans_mark_dev_sb: %s"
,
path
,
bch2_err_str
(
ret
));
bch_err_msg
(
c
,
ret
,
"bringing %s online: error from bch2_trans_mark_dev_sb"
,
path
);
goto
err
;
}
...
...
@@ -1782,7 +1781,7 @@ int bch2_dev_online(struct bch_fs *c, const char *path)
ret
=
bch2_fs_freespace_init
(
c
);
if
(
ret
)
bch_err
(
c
,
"device add error: error initializing free space: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
c
,
ret
,
"initializing free space"
);
up_write
(
&
c
->
state_lock
);
return
0
;
...
...
@@ -1837,7 +1836,7 @@ int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets)
ret
=
bch2_dev_buckets_resize
(
c
,
ca
,
nbuckets
);
if
(
ret
)
{
bch_err
(
ca
,
"Resize error: %s"
,
bch2_err_str
(
ret
)
);
bch_err
_msg
(
ca
,
ret
,
"resizing buckets"
);
goto
err
;
}
...
...
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