* [PATCH] btrfs: Fix 64-bit divisions in btrfs_commit_stats_show() on 32-bit
@ 2022-06-16 8:08 Geert Uytterhoeven
2022-06-16 19:33 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2022-06-16 8:08 UTC (permalink / raw)
To: Ioannis Angelakopoulos, Chris Mason, Josef Bacik, David Sterba
Cc: linux-btrfs, linux-kernel, Geert Uytterhoeven
On 32-bit (e.g. m68k):
ERROR: modpost: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
Fix this by using div_u64() instead.
Reported-by: noreply@ellerman.id.au
Fixes: e665ec2ab6e1ae36 ("btrfs: Expose the BTRFS commit stats through sysfs")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
fs/btrfs/sysfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index bce2573b02861149..a24cf7e0900a23cb 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -9,6 +9,7 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/bug.h>
+#include <linux/math64.h>
#include <crypto/hash.h>
#include "ctree.h"
@@ -1002,9 +1003,9 @@ static ssize_t btrfs_commit_stats_show(struct kobject *kobj,
"max_commit_ms %llu\n"
"total_commit_ms %llu\n",
fs_info->commit_stats.commit_count,
- fs_info->commit_stats.last_commit_dur / NSEC_PER_MSEC,
- fs_info->commit_stats.max_commit_dur / NSEC_PER_MSEC,
- fs_info->commit_stats.total_commit_dur / NSEC_PER_MSEC);
+ div_u64(fs_info->commit_stats.last_commit_dur, NSEC_PER_MSEC),
+ div_u64(fs_info->commit_stats.max_commit_dur, NSEC_PER_MSEC),
+ div_u64(fs_info->commit_stats.total_commit_dur, NSEC_PER_MSEC));
}
static ssize_t btrfs_commit_stats_store(struct kobject *kobj,
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: Fix 64-bit divisions in btrfs_commit_stats_show() on 32-bit
2022-06-16 8:08 [PATCH] btrfs: Fix 64-bit divisions in btrfs_commit_stats_show() on 32-bit Geert Uytterhoeven
@ 2022-06-16 19:33 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-06-16 19:33 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Ioannis Angelakopoulos, Chris Mason, Josef Bacik, David Sterba,
linux-btrfs, linux-kernel
On Thu, Jun 16, 2022 at 10:08:14AM +0200, Geert Uytterhoeven wrote:
> On 32-bit (e.g. m68k):
>
> ERROR: modpost: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
>
> Fix this by using div_u64() instead.
>
> Reported-by: noreply@ellerman.id.au
> Fixes: e665ec2ab6e1ae36 ("btrfs: Expose the BTRFS commit stats through sysfs")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Folded to the patch, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-16 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 8:08 [PATCH] btrfs: Fix 64-bit divisions in btrfs_commit_stats_show() on 32-bit Geert Uytterhoeven
2022-06-16 19:33 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).