Commit 972d7219 authored by Liu Bo's avatar Liu Bo Committed by David Sterba

Btrfs: update scrub_parity to use u64 stripe_len

Commit 3d8da678 ("Btrfs: fix divide error upon chunk's stripe_len")
changed stripe_len in struct map_lookup to u64, but didn't update
stripe_len in struct scrub_parity.

This updates the type and switches to div64_u64_rem to match u64 divisor.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c725328c
...@@ -140,7 +140,7 @@ struct scrub_parity { ...@@ -140,7 +140,7 @@ struct scrub_parity {
int nsectors; int nsectors;
int stripe_len; u64 stripe_len;
refcount_t refs; refcount_t refs;
...@@ -2396,7 +2396,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity, ...@@ -2396,7 +2396,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
unsigned long *bitmap, unsigned long *bitmap,
u64 start, u64 len) u64 start, u64 len)
{ {
u32 offset; u64 offset;
int nsectors; int nsectors;
int sectorsize = sparity->sctx->fs_info->sectorsize; int sectorsize = sparity->sctx->fs_info->sectorsize;
...@@ -2406,8 +2406,8 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity, ...@@ -2406,8 +2406,8 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
} }
start -= sparity->logic_start; start -= sparity->logic_start;
start = div_u64_rem(start, sparity->stripe_len, &offset); start = div64_u64_rem(start, sparity->stripe_len, &offset);
offset /= sectorsize; offset = div_u64(offset, sectorsize);
nsectors = (int)len / sectorsize; nsectors = (int)len / sectorsize;
if (offset + nsectors <= sparity->nsectors) { if (offset + nsectors <= sparity->nsectors) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment