From patchwork Thu Jun 16 08:08:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 12883691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63B0DC433EF for ; Thu, 16 Jun 2022 10:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231612AbiFPKcs (ORCPT ); Thu, 16 Jun 2022 06:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiFPKcr (ORCPT ); Thu, 16 Jun 2022 06:32:47 -0400 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96AD115833 for ; Thu, 16 Jun 2022 03:32:44 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed30:5439:2bcc:4a70:48e8]) by michel.telenet-ops.be with bizsmtp id jmYi270064lJ8fu06mYioK; Thu, 16 Jun 2022 12:32:42 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o1mRv-004AbF-4n; Thu, 16 Jun 2022 12:10:03 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1o1kY2-007ZgO-8u; Thu, 16 Jun 2022 10:08:14 +0200 From: Geert Uytterhoeven To: Ioannis Angelakopoulos , Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] btrfs: Fix 64-bit divisions in btrfs_commit_stats_show() on 32-bit Date: Thu, 16 Jun 2022 10:08:14 +0200 Message-Id: <20220616080814.1805417-1-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 --- 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 #include #include +#include #include #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,