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
0acf2169
Commit
0acf2169
authored
Apr 30, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: __mark_stripe_bucket() now takes bch_alloc_v4
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
be11ae16
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
63 deletions
+38
-63
fs/bcachefs/buckets.c
fs/bcachefs/buckets.c
+0
-1
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+38
-62
No files found.
fs/bcachefs/buckets.c
View file @
0acf2169
...
@@ -1001,7 +1001,6 @@ static int bch2_trigger_pointer(struct btree_trans *trans,
...
@@ -1001,7 +1001,6 @@ static int bch2_trigger_pointer(struct btree_trans *trans,
struct
bucket
*
g
=
gc_bucket
(
ca
,
bucket
.
offset
);
struct
bucket
*
g
=
gc_bucket
(
ca
,
bucket
.
offset
);
bucket_lock
(
g
);
bucket_lock
(
g
);
struct
bch_alloc_v4
old
=
bucket_m_to_alloc
(
*
g
),
new
=
old
;
struct
bch_alloc_v4
old
=
bucket_m_to_alloc
(
*
g
),
new
=
old
;
int
ret
=
__mark_pointer
(
trans
,
k
,
&
p
.
ptr
,
*
sectors
,
bp
.
data_type
,
&
new
);
int
ret
=
__mark_pointer
(
trans
,
k
,
&
p
.
ptr
,
*
sectors
,
bp
.
data_type
,
&
new
);
if
(
!
ret
)
{
if
(
!
ret
)
{
alloc_to_bucket
(
g
,
new
);
alloc_to_bucket
(
g
,
new
);
...
...
fs/bcachefs/ec.c
View file @
0acf2169
...
@@ -167,12 +167,7 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
...
@@ -167,12 +167,7 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
struct
bkey_s_c_stripe
s
,
struct
bkey_s_c_stripe
s
,
unsigned
ptr_idx
,
bool
deleting
,
unsigned
ptr_idx
,
bool
deleting
,
struct
bpos
bucket
,
struct
bpos
bucket
,
u8
bucket_gen
,
struct
bch_alloc_v4
*
a
)
u8
*
bucket_data_type
,
u32
*
bucket_dirty_sectors
,
u32
*
bucket_cached_sectors
,
u32
*
bucket_stripe
,
u8
*
bucket_stripe_redundancy
)
{
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
bch_fs
*
c
=
trans
->
c
;
const
struct
bch_extent_ptr
*
ptr
=
s
.
v
->
ptrs
+
ptr_idx
;
const
struct
bch_extent_ptr
*
ptr
=
s
.
v
->
ptrs
+
ptr_idx
;
...
@@ -187,43 +182,43 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
...
@@ -187,43 +182,43 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
sectors
=
-
sectors
;
sectors
=
-
sectors
;
if
(
!
deleting
)
{
if
(
!
deleting
)
{
if
(
bch2_trans_inconsistent_on
(
*
bucket_
stripe
||
if
(
bch2_trans_inconsistent_on
(
a
->
stripe
||
*
bucket_
stripe_redundancy
,
trans
,
a
->
stripe_redundancy
,
trans
,
"bucket %llu:%llu gen %u data type %s dirty_sectors %u: multiple stripes using same bucket (%u, %llu)
\n
%s"
,
"bucket %llu:%llu gen %u data type %s dirty_sectors %u: multiple stripes using same bucket (%u, %llu)
\n
%s"
,
bucket
.
inode
,
bucket
.
offset
,
bucket_
gen
,
bucket
.
inode
,
bucket
.
offset
,
a
->
gen
,
bch2_data_type_str
(
*
bucket_
data_type
),
bch2_data_type_str
(
a
->
data_type
),
*
bucket_
dirty_sectors
,
a
->
dirty_sectors
,
*
bucket_
stripe
,
s
.
k
->
p
.
offset
,
a
->
stripe
,
s
.
k
->
p
.
offset
,
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
goto
err
;
goto
err
;
}
}
if
(
bch2_trans_inconsistent_on
(
parity
&&
(
*
bucket_dirty_sectors
||
*
bucket_cached_sectors
),
trans
,
if
(
bch2_trans_inconsistent_on
(
parity
&&
bch2_bucket_sectors_total
(
*
a
),
trans
,
"bucket %llu:%llu gen %u data type %s dirty_sectors %u cached_sectors %u: data already in parity bucket
\n
%s"
,
"bucket %llu:%llu gen %u data type %s dirty_sectors %u cached_sectors %u: data already in parity bucket
\n
%s"
,
bucket
.
inode
,
bucket
.
offset
,
bucket_
gen
,
bucket
.
inode
,
bucket
.
offset
,
a
->
gen
,
bch2_data_type_str
(
*
bucket_
data_type
),
bch2_data_type_str
(
a
->
data_type
),
*
bucket_
dirty_sectors
,
a
->
dirty_sectors
,
*
bucket_
cached_sectors
,
a
->
cached_sectors
,
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
goto
err
;
goto
err
;
}
}
}
else
{
}
else
{
if
(
bch2_trans_inconsistent_on
(
*
bucket_
stripe
!=
s
.
k
->
p
.
offset
||
if
(
bch2_trans_inconsistent_on
(
a
->
stripe
!=
s
.
k
->
p
.
offset
||
*
bucket_
stripe_redundancy
!=
s
.
v
->
nr_redundant
,
trans
,
a
->
stripe_redundancy
!=
s
.
v
->
nr_redundant
,
trans
,
"bucket %llu:%llu gen %u: not marked as stripe when deleting stripe (got %u)
\n
%s"
,
"bucket %llu:%llu gen %u: not marked as stripe when deleting stripe (got %u)
\n
%s"
,
bucket
.
inode
,
bucket
.
offset
,
bucket_
gen
,
bucket
.
inode
,
bucket
.
offset
,
a
->
gen
,
*
bucket_
stripe
,
a
->
stripe
,
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
goto
err
;
goto
err
;
}
}
if
(
bch2_trans_inconsistent_on
(
*
bucket_
data_type
!=
data_type
,
trans
,
if
(
bch2_trans_inconsistent_on
(
a
->
data_type
!=
data_type
,
trans
,
"bucket %llu:%llu gen %u data type %s: wrong data type when stripe, should be %s
\n
%s"
,
"bucket %llu:%llu gen %u data type %s: wrong data type when stripe, should be %s
\n
%s"
,
bucket
.
inode
,
bucket
.
offset
,
bucket_
gen
,
bucket
.
inode
,
bucket
.
offset
,
a
->
gen
,
bch2_data_type_str
(
*
bucket_
data_type
),
bch2_data_type_str
(
a
->
data_type
),
bch2_data_type_str
(
data_type
),
bch2_data_type_str
(
data_type
),
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
...
@@ -231,12 +226,12 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
...
@@ -231,12 +226,12 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
}
}
if
(
bch2_trans_inconsistent_on
(
parity
&&
if
(
bch2_trans_inconsistent_on
(
parity
&&
(
*
bucket_
dirty_sectors
!=
-
sectors
||
(
a
->
dirty_sectors
!=
-
sectors
||
*
bucket_
cached_sectors
),
trans
,
a
->
cached_sectors
),
trans
,
"bucket %llu:%llu gen %u dirty_sectors %u cached_sectors %u: wrong sectors when deleting parity block of stripe
\n
%s"
,
"bucket %llu:%llu gen %u dirty_sectors %u cached_sectors %u: wrong sectors when deleting parity block of stripe
\n
%s"
,
bucket
.
inode
,
bucket
.
offset
,
bucket_
gen
,
bucket
.
inode
,
bucket
.
offset
,
a
->
gen
,
*
bucket_
dirty_sectors
,
a
->
dirty_sectors
,
*
bucket_
cached_sectors
,
a
->
cached_sectors
,
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
s
.
s_c
),
buf
.
buf
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
goto
err
;
goto
err
;
...
@@ -245,21 +240,20 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
...
@@ -245,21 +240,20 @@ static int __mark_stripe_bucket(struct btree_trans *trans,
if
(
sectors
)
{
if
(
sectors
)
{
ret
=
bch2_bucket_ref_update
(
trans
,
s
.
s_c
,
ptr
,
sectors
,
data_type
,
ret
=
bch2_bucket_ref_update
(
trans
,
s
.
s_c
,
ptr
,
sectors
,
data_type
,
bucket_gen
,
*
bucket_data_type
,
a
->
gen
,
a
->
data_type
,
&
a
->
dirty_sectors
);
bucket_dirty_sectors
);
if
(
ret
)
if
(
ret
)
goto
err
;
goto
err
;
}
}
if
(
!
deleting
)
{
if
(
!
deleting
)
{
*
bucket_stripe
=
s
.
k
->
p
.
offset
;
a
->
stripe
=
s
.
k
->
p
.
offset
;
*
bucket_stripe_redundancy
=
s
.
v
->
nr_redundant
;
a
->
stripe_redundancy
=
s
.
v
->
nr_redundant
;
*
bucket_data_type
=
data_type
;
}
else
{
}
else
{
*
bucket_stripe
=
0
;
a
->
stripe
=
0
;
*
bucket_stripe_redundancy
=
0
;
a
->
stripe_redundancy
=
0
;
*
bucket_data_type
=
BCH_DATA_free
;
}
}
alloc_data_type_set
(
a
,
data_type
);
err:
err:
printbuf_exit
(
&
buf
);
printbuf_exit
(
&
buf
);
return
ret
;
return
ret
;
...
@@ -279,19 +273,10 @@ static int mark_stripe_bucket(struct btree_trans *trans,
...
@@ -279,19 +273,10 @@ static int mark_stripe_bucket(struct btree_trans *trans,
struct
bkey_i_alloc_v4
*
a
=
struct
bkey_i_alloc_v4
*
a
=
bch2_trans_start_alloc_update
(
trans
,
&
iter
,
bucket
);
bch2_trans_start_alloc_update
(
trans
,
&
iter
,
bucket
);
int
ret
=
PTR_ERR_OR_ZERO
(
a
)
?:
int
ret
=
PTR_ERR_OR_ZERO
(
a
)
?:
__mark_stripe_bucket
(
trans
,
s
,
ptr_idx
,
deleting
,
iter
.
pos
,
__mark_stripe_bucket
(
trans
,
s
,
ptr_idx
,
deleting
,
iter
.
pos
,
&
a
->
v
);
a
->
v
.
gen
,
&
a
->
v
.
data_type
,
&
a
->
v
.
dirty_sectors
,
&
a
->
v
.
cached_sectors
,
&
a
->
v
.
stripe
,
&
a
->
v
.
stripe_redundancy
);
if
(
ret
)
if
(
ret
)
goto
err
;
goto
err
;
if
(
deleting
)
alloc_data_type_set
(
&
a
->
v
,
BCH_DATA_user
);
ret
=
bch2_trans_update
(
trans
,
&
iter
,
&
a
->
k_i
,
0
);
ret
=
bch2_trans_update
(
trans
,
&
iter
,
&
a
->
k_i
,
0
);
if
(
ret
)
if
(
ret
)
goto
err
;
goto
err
;
...
@@ -305,23 +290,14 @@ static int mark_stripe_bucket(struct btree_trans *trans,
...
@@ -305,23 +290,14 @@ static int mark_stripe_bucket(struct btree_trans *trans,
percpu_down_read
(
&
c
->
mark_lock
);
percpu_down_read
(
&
c
->
mark_lock
);
struct
bucket
*
g
=
gc_bucket
(
ca
,
bucket
.
offset
);
struct
bucket
*
g
=
gc_bucket
(
ca
,
bucket
.
offset
);
bucket_lock
(
g
);
bucket_lock
(
g
);
struct
bch_alloc_v4
old
=
bucket_m_to_alloc
(
*
g
);
struct
bch_alloc_v4
old
=
bucket_m_to_alloc
(
*
g
),
new
=
old
;
u8
data_type
=
g
->
data_type
;
int
ret
=
__mark_stripe_bucket
(
trans
,
s
,
ptr_idx
,
deleting
,
bucket
,
&
new
);
if
(
!
ret
)
{
int
ret
=
__mark_stripe_bucket
(
trans
,
s
,
ptr_idx
,
deleting
,
bucket
,
alloc_to_bucket
(
g
,
new
);
g
->
gen
,
&
data_type
,
&
g
->
dirty_sectors
,
&
g
->
cached_sectors
,
&
g
->
stripe
,
&
g
->
stripe_redundancy
);
g
->
data_type
=
data_type
;
struct
bch_alloc_v4
new
=
bucket_m_to_alloc
(
*
g
);
bucket_unlock
(
g
);
if
(
!
ret
)
bch2_dev_usage_update
(
c
,
ca
,
&
old
,
&
new
,
0
,
true
);
bch2_dev_usage_update
(
c
,
ca
,
&
old
,
&
new
,
0
,
true
);
}
bucket_unlock
(
g
);
percpu_up_read
(
&
c
->
mark_lock
);
percpu_up_read
(
&
c
->
mark_lock
);
return
ret
;
return
ret
;
}
}
...
...
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