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
76640280
Commit
76640280
authored
Nov 24, 2018
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: New blockcount field for bch_stripe
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
8eb7f3ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+21
-10
No files found.
fs/bcachefs/ec.c
View file @
76640280
...
@@ -105,22 +105,32 @@ static unsigned stripe_csums_per_device(const struct bch_stripe *s)
...
@@ -105,22 +105,32 @@ static unsigned stripe_csums_per_device(const struct bch_stripe *s)
1
<<
s
->
csum_granularity_bits
);
1
<<
s
->
csum_granularity_bits
);
}
}
static
unsigned
stripe_val_u64s
(
const
struct
bch_stripe
*
s
)
static
unsigned
stripe_csum_offset
(
const
struct
bch_stripe
*
s
,
unsigned
dev
,
unsigned
csum_idx
)
{
{
unsigned
bytes
=
sizeof
(
struct
bch_stripe
)
+
unsigned
csum_bytes
=
bch_crc_bytes
[
s
->
csum_type
];
return
sizeof
(
struct
bch_stripe
)
+
sizeof
(
struct
bch_extent_ptr
)
*
s
->
nr_blocks
+
sizeof
(
struct
bch_extent_ptr
)
*
s
->
nr_blocks
+
bch_crc_bytes
[
s
->
csum_type
]
*
s
->
nr_blocks
*
stripe_csums_per_device
(
s
);
(
dev
*
stripe_csums_per_device
(
s
)
+
csum_idx
)
*
csum_bytes
;
return
DIV_ROUND_UP
(
bytes
,
sizeof
(
u64
));
}
}
static
void
*
stripe_csum
(
struct
bch_stripe
*
s
,
unsigned
dev
,
unsigned
csum_idx
)
static
unsigned
stripe_blockcount_offset
(
const
struct
bch_stripe
*
s
,
unsigned
idx
)
{
{
unsigned
csum_bytes
=
bch_crc_bytes
[
s
->
csum_type
];
return
stripe_csum_offset
(
s
,
s
->
nr_blocks
,
0
)
+
void
*
csums
=
s
->
ptrs
+
s
->
nr_blocks
;
sizeof
(
16
)
*
idx
;
}
BUG_ON
(
!
csum_bytes
);
static
unsigned
stripe_val_u64s
(
const
struct
bch_stripe
*
s
)
{
return
DIV_ROUND_UP
(
stripe_blockcount_offset
(
s
,
s
->
nr_blocks
),
sizeof
(
u64
));
}
return
csums
+
(
dev
*
stripe_csums_per_device
(
s
)
+
csum_idx
)
*
csum_bytes
;
static
void
*
stripe_csum
(
struct
bch_stripe
*
s
,
unsigned
dev
,
unsigned
csum_idx
)
{
return
(
void
*
)
s
+
stripe_csum_offset
(
s
,
dev
,
csum_idx
);
}
}
const
char
*
bch2_stripe_invalid
(
const
struct
bch_fs
*
c
,
struct
bkey_s_c
k
)
const
char
*
bch2_stripe_invalid
(
const
struct
bch_fs
*
c
,
struct
bkey_s_c
k
)
...
@@ -133,7 +143,8 @@ const char *bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k)
...
@@ -133,7 +143,8 @@ const char *bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k)
if
(
bkey_val_bytes
(
k
.
k
)
<
sizeof
(
*
s
))
if
(
bkey_val_bytes
(
k
.
k
)
<
sizeof
(
*
s
))
return
"incorrect value size"
;
return
"incorrect value size"
;
if
(
bkey_val_u64s
(
k
.
k
)
!=
stripe_val_u64s
(
s
))
if
(
bkey_val_bytes
(
k
.
k
)
<
sizeof
(
*
s
)
||
bkey_val_u64s
(
k
.
k
)
<
stripe_val_u64s
(
s
))
return
"incorrect value size"
;
return
"incorrect value size"
;
return
NULL
;
return
NULL
;
...
...
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