* [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
@ 2017-04-08 21:07 ` Adam Borowski
0 siblings, 0 replies; 20+ messages in thread
From: Adam Borowski @ 2017-04-08 21:07 UTC (permalink / raw)
To: linux-arm-kernel
Unbreaks ARM and possibly other 32-bit architectures.
Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
Reported-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
You'd probably want to squash this with Liu's commit, to be nice to future
bisects.
Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
sometimes works, but, like most operations, randomly dies with some badness
that doesn't look related: io_schedule, kunmap_high. That badness wasn't
there in 4.11-rc5, needs investigating, but since it's not connected to our
issue at hand, I consider this patch sort-of tested.
fs/btrfs/scrub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index b6fe1cd08048..95372e3679f3 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
start -= sparity->logic_start;
start = div64_u64_rem(start, sparity->stripe_len, &offset);
- offset /= sectorsize;
+ do_div(offset, sectorsize);
nsectors = (int)len / sectorsize;
if (offset + nsectors <= sparity->nsectors) {
--
2.11.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
2017-04-08 21:07 ` Adam Borowski
@ 2017-04-09 3:58 ` Adam Borowski
-1 siblings, 0 replies; 20+ messages in thread
From: Adam Borowski @ 2017-04-09 3:58 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba, linux-arm-kernel,
linux-kernel, linux-btrfs, Icenowy Zheng, Fabio Estevam
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
Turns out those "other 32-bit architectures" happen to include i386.
A modular build:
ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
With the patch, i386 builds fine.
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
Looks like current -next is pretty broken: while amd64 is ok, on an i386 box
(non-NX Pentium 4) it hangs very early during boot, way before filesystem
modules would be loaded. Qemu boots but has random hangs.
So it looks like it's compile only for now...
--
⢀⣴⠾⠻⢶⣦⠀ Meow!
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Collisions shmolisions, let's see them find a collision or second
⠈⠳⣄⠀⠀⠀⠀ preimage for double rot13!
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
@ 2017-04-09 3:58 ` Adam Borowski
0 siblings, 0 replies; 20+ messages in thread
From: Adam Borowski @ 2017-04-09 3:58 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
Turns out those "other 32-bit architectures" happen to include i386.
A modular build:
ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
With the patch, i386 builds fine.
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
Looks like current -next is pretty broken: while amd64 is ok, on an i386 box
(non-NX Pentium 4) it hangs very early during boot, way before filesystem
modules would be loaded. Qemu boots but has random hangs.
So it looks like it's compile only for now...
--
??????? Meow!
???????
??????? Collisions shmolisions, let's see them find a collision or second
??????? preimage for double rot13!
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
2017-04-09 3:58 ` Adam Borowski
@ 2017-04-10 1:13 ` Adam Borowski
-1 siblings, 0 replies; 20+ messages in thread
From: Adam Borowski @ 2017-04-10 1:13 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba, linux-arm-kernel,
linux-kernel, linux-btrfs, Icenowy Zheng, Fabio Estevam
[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]
On Sun, Apr 09, 2017 at 05:58:54AM +0200, Adam Borowski wrote:
> On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> > Unbreaks ARM and possibly other 32-bit architectures.
>
> Turns out those "other 32-bit architectures" happen to include i386.
>
> A modular build:
> ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
> With the patch, i386 builds fine.
>
> > Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> > sometimes works, but, like most operations, randomly dies with some badness
> > that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> > there in 4.11-rc5, needs investigating, but since it's not connected to our
> > issue at hand, I consider this patch sort-of tested.
>
> Looks like current -next is pretty broken: while amd64 is ok, on an i386 box
> (non-NX Pentium 4) it hangs very early during boot, way before filesystem
> modules would be loaded. Qemu boots but has random hangs.
A non-modular i386_defconfig + btrfs of -next is ok; whatever the problem
is, it's not relevant to our division build failure in scrub.
But, it looks like parity scrub is ${EXPLETIVE}ed on 32-bit. Not just on
-next, also on 4.11-rc5 and 4.9. Test script I used is attached, although
it's enough to just scrub a kosher filesystem without even damaging it.
On 64-bit it mostly works, but still warns about bogus unrecoverable errors
when in fact it succeeded.
Thus, I'd recommend:
* applying this patch to at least make it compile
* taking steps to warn outside people about RAID5/6
Let's discuss the rest in another thread, it's no longer interesting to ARM
people, they just want no build failures.
--
⢀⣴⠾⠻⢶⣦⠀ Meow!
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Collisions shmolisions, let's see them find a collision or second
⠈⠳⣄⠀⠀⠀⠀ preimage for double rot13!
[-- Attachment #2: scrubtest --]
[-- Type: text/plain, Size: 1299 bytes --]
#!/bin/sh
set -x
DATA=/usr/bin # use whole /usr on non-bloated VMs
mkdir -p /mnt/vol1
umount /mnt/vol1; losetup -D # clean up after repeats
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=ra
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=rb
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=rc
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=rd
mkfs.btrfs -draid10 -mraid1 ra rb rc rd
losetup -D
losetup -f ra
losetup -f rb
losetup -f rc
losetup -f rd
sleep 2 # race with fsid detection
mount -onoatime /dev/loop0 /mnt/vol1 || exit $?
cp -pr "$DATA" /mnt/vol1
btrfs fi sync /mnt/vol1
btrfs fi us /mnt/vol1
btrfs balance start -dconvert=raid5 -mconvert=raid6 /mnt/vol1
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
umount /mnt/vol1
dd if=/dev/urandom of=rd bs=1048576 seek=96 count=4000
mount -onoatime /dev/loop0 /mnt/vol1 || exit $?
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
btrfs balance start -dconvert=raid10 -mconvert=raid1 /mnt/vol1
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
umount /mnt/vol1
dd if=/dev/urandom of=rd bs=1048576 seek=96 count=4000
mount -onoatime /dev/loop0 /mnt/vol1 || exit $?
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
diff -urd --no-dereference "$DATA" /mnt/vol1/*
umount /mnt/vol1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
@ 2017-04-10 1:13 ` Adam Borowski
0 siblings, 0 replies; 20+ messages in thread
From: Adam Borowski @ 2017-04-10 1:13 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Apr 09, 2017 at 05:58:54AM +0200, Adam Borowski wrote:
> On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> > Unbreaks ARM and possibly other 32-bit architectures.
>
> Turns out those "other 32-bit architectures" happen to include i386.
>
> A modular build:
> ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
> With the patch, i386 builds fine.
>
> > Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> > sometimes works, but, like most operations, randomly dies with some badness
> > that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> > there in 4.11-rc5, needs investigating, but since it's not connected to our
> > issue at hand, I consider this patch sort-of tested.
>
> Looks like current -next is pretty broken: while amd64 is ok, on an i386 box
> (non-NX Pentium 4) it hangs very early during boot, way before filesystem
> modules would be loaded. Qemu boots but has random hangs.
A non-modular i386_defconfig + btrfs of -next is ok; whatever the problem
is, it's not relevant to our division build failure in scrub.
But, it looks like parity scrub is ${EXPLETIVE}ed on 32-bit. Not just on
-next, also on 4.11-rc5 and 4.9. Test script I used is attached, although
it's enough to just scrub a kosher filesystem without even damaging it.
On 64-bit it mostly works, but still warns about bogus unrecoverable errors
when in fact it succeeded.
Thus, I'd recommend:
* applying this patch to at least make it compile
* taking steps to warn outside people about RAID5/6
Let's discuss the rest in another thread, it's no longer interesting to ARM
people, they just want no build failures.
--
??????? Meow!
???????
??????? Collisions shmolisions, let's see them find a collision or second
??????? preimage for double rot13!
-------------- next part --------------
#!/bin/sh
set -x
DATA=/usr/bin # use whole /usr on non-bloated VMs
mkdir -p /mnt/vol1
umount /mnt/vol1; losetup -D # clean up after repeats
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=ra
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=rb
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=rc
dd if=/dev/zero bs=1048576 count=1 seek=4095 of=rd
mkfs.btrfs -draid10 -mraid1 ra rb rc rd
losetup -D
losetup -f ra
losetup -f rb
losetup -f rc
losetup -f rd
sleep 2 # race with fsid detection
mount -onoatime /dev/loop0 /mnt/vol1 || exit $?
cp -pr "$DATA" /mnt/vol1
btrfs fi sync /mnt/vol1
btrfs fi us /mnt/vol1
btrfs balance start -dconvert=raid5 -mconvert=raid6 /mnt/vol1
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
umount /mnt/vol1
dd if=/dev/urandom of=rd bs=1048576 seek=96 count=4000
mount -onoatime /dev/loop0 /mnt/vol1 || exit $?
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
btrfs balance start -dconvert=raid10 -mconvert=raid1 /mnt/vol1
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
umount /mnt/vol1
dd if=/dev/urandom of=rd bs=1048576 seek=96 count=4000
mount -onoatime /dev/loop0 /mnt/vol1 || exit $?
btrfs scrub start -B /mnt/vol1
btrfs scrub start -B /mnt/vol1
diff -urd --no-dereference "$DATA" /mnt/vol1/*
umount /mnt/vol1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
2017-04-08 21:07 ` Adam Borowski
@ 2017-04-10 11:13 ` David Sterba
-1 siblings, 0 replies; 20+ messages in thread
From: David Sterba @ 2017-04-10 11:13 UTC (permalink / raw)
To: Adam Borowski
Cc: Icenowy Zheng, Chris Mason, Josef Bacik, Fabio Estevam,
linux-arm-kernel, linux-btrfs, linux-kernel
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
Thanks for finding it!
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
> fs/btrfs/scrub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
> start -= sparity->logic_start;
> start = div64_u64_rem(start, sparity->stripe_len, &offset);
> - offset /= sectorsize;
> + do_div(offset, sectorsize);
I'll use the div_u64 helper instead, I don't want to reintroduce do_div
to fs/btrfs , for-next will be updated in a minute.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
@ 2017-04-10 11:13 ` David Sterba
0 siblings, 0 replies; 20+ messages in thread
From: David Sterba @ 2017-04-10 11:13 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
Thanks for finding it!
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
> fs/btrfs/scrub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
> start -= sparity->logic_start;
> start = div64_u64_rem(start, sparity->stripe_len, &offset);
> - offset /= sectorsize;
> + do_div(offset, sectorsize);
I'll use the div_u64 helper instead, I don't want to reintroduce do_div
to fs/btrfs , for-next will be updated in a minute.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
2017-04-08 21:07 ` Adam Borowski
@ 2017-04-10 12:50 ` Austin S. Hemmelgarn
-1 siblings, 0 replies; 20+ messages in thread
From: Austin S. Hemmelgarn @ 2017-04-10 12:50 UTC (permalink / raw)
To: Adam Borowski, Chris Mason, Josef Bacik, David Sterba,
linux-arm-kernel, linux-kernel, linux-btrfs, Icenowy Zheng,
Fabio Estevam
On 2017-04-08 17:07, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
>
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
> fs/btrfs/scrub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
> start -= sparity->logic_start;
> start = div64_u64_rem(start, sparity->stripe_len, &offset);
> - offset /= sectorsize;
> + do_div(offset, sectorsize);
> nsectors = (int)len / sectorsize;
>
> if (offset + nsectors <= sparity->nsectors) {
>
Also fixes things on:
32-bit MIPS (eb and el variants)
32-bit SPARC
32-bit PPC
You can add my Tested-by if you want.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
@ 2017-04-10 12:50 ` Austin S. Hemmelgarn
0 siblings, 0 replies; 20+ messages in thread
From: Austin S. Hemmelgarn @ 2017-04-10 12:50 UTC (permalink / raw)
To: linux-arm-kernel
On 2017-04-08 17:07, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
>
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
> fs/btrfs/scrub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
> start -= sparity->logic_start;
> start = div64_u64_rem(start, sparity->stripe_len, &offset);
> - offset /= sectorsize;
> + do_div(offset, sectorsize);
> nsectors = (int)len / sectorsize;
>
> if (offset + nsectors <= sparity->nsectors) {
>
Also fixes things on:
32-bit MIPS (eb and el variants)
32-bit SPARC
32-bit PPC
You can add my Tested-by if you want.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
2017-04-08 21:07 ` Adam Borowski
@ 2017-04-10 18:41 ` Liu Bo
-1 siblings, 0 replies; 20+ messages in thread
From: Liu Bo @ 2017-04-10 18:41 UTC (permalink / raw)
To: Adam Borowski
Cc: Chris Mason, Josef Bacik, David Sterba, linux-arm-kernel,
linux-kernel, linux-btrfs, Icenowy Zheng, Fabio Estevam
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
Thanks a lot for the fix.
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Thanks,
-liubo
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
>
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
> fs/btrfs/scrub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
> start -= sparity->logic_start;
> start = div64_u64_rem(start, sparity->stripe_len, &offset);
> - offset /= sectorsize;
> + do_div(offset, sectorsize);
> nsectors = (int)len / sectorsize;
>
> if (offset + nsectors <= sparity->nsectors) {
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
@ 2017-04-10 18:41 ` Liu Bo
0 siblings, 0 replies; 20+ messages in thread
From: Liu Bo @ 2017-04-10 18:41 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
Thanks a lot for the fix.
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Thanks,
-liubo
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
>
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high. That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
> fs/btrfs/scrub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
> start -= sparity->logic_start;
> start = div64_u64_rem(start, sparity->stripe_len, &offset);
> - offset /= sectorsize;
> + do_div(offset, sectorsize);
> nsectors = (int)len / sectorsize;
>
> if (offset + nsectors <= sparity->nsectors) {
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 20+ messages in thread