From patchwork Fri Oct 16 21:47:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7421081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B75E9BEEA4 for ; Fri, 16 Oct 2015 21:49:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B959520661 for ; Fri, 16 Oct 2015 21:49:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6B3520652 for ; Fri, 16 Oct 2015 21:49:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZnCrD-0005AC-Pw; Fri, 16 Oct 2015 21:48:11 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZnCrB-00057n-2W for linux-arm-kernel@lists.infradead.org; Fri, 16 Oct 2015 21:48:09 +0000 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0M7bux-1ajpwR2KRD-00xIHt; Fri, 16 Oct 2015 23:47:40 +0200 From: Arnd Bergmann To: Dave Chinner , xfs@oss.sgi.com Subject: [PATCH] xfs: fix build without xfsstats Date: Fri, 16 Oct 2015 23:47:37 +0200 Message-ID: <5578984.gxbqPUmtuT@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:9smykgClinoXW68k2Nuopafvt1O2ot0/ds8+WcLNRxNRqNgWPLm BBys2rXAhB6DDYPeGdkq/zY+0AA6ZiGzE1/WfKz0zz9VYCph0r2i6d8YGm1kPuFXt8bAkWb L0/PcfrFNlv+AEmS513aU+zh9EFaTIgEl9a63Al/mj3urFEpYFoUCbYxszKr36nfjPkVwUm Q8vDBK/CdtlIIk9FxyQGA== X-UI-Out-Filterresults: notjunk:1; V01:K0:mQf1XmBglFY=:DDEnM5W1WtGzb8jljoi+0m fHdQ7nwQpj3jbmc85hmvDQH+dxv63auCbM16fH7mkMlQdVKdubrDaEanYPl2vtQhDiUnzJlYV QMOq3SvzT1vOJceAmN3gbpcRzA2CCa0XFm+P8AYEN0igMKWoUyfFhjYj+mLxiK4Tae7+khcQp yAuuuQePcKuCgb1ElWklrdzNHmtQ7JnnD4IwDo8CDsnGF8oPU4BY6R0WhvhlpNTtaitOnWu2X sycPWUrSX7iR27XL4NTAN31OcWqXWGDNHuu6nM7CdR65RPnUrL6Cg57hu09CCbazfk4PIJKo1 QCfODqoRq9DKDMTINKoM2q49VBhV6ruZn5Jstws4T7V4Swk2vWN9WN7s3OPWB4O3iJAX54GV1 JDSr4U7Gk2qkCKrp10j/CxWbFBfGF30HLomjq6orsWPS+obKd7/SKIQ3ACpTW58utr5IJsJp2 T/xpGkDQXQls2VN/Q3xGhTART9P9c2vDf6OubxopmDuL3TmXPYKkp9Vu0b1adai0JqWg09x4o v+9ub4MmHiIgewTOjQywcOg4k+oxBHJFZeG/Bg/HLCTdQZP0Br0aggXSxxDttIKyl/qqr3H8/ vWZ3QngFD3ehmbXjeFyPO9+0ImLf+tDa4mlN4l5ub+CBGUIFggefXavpVmlzHRoAlEaIaJkt0 n9l7pfenVrGIHUmhvZzdGCttrqXt2GojjMk7Lc/hin5JDf8PzGS4jsZvx5aLT1FUanDyCS/QH P40lBgY2UJGj0R3y X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151016_144809_310546_3A5E4412 X-CRM114-Status: GOOD ( 19.28 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Sandeen , Bill O'Donnell , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A recent rework of the xfsstats interface introduced a compile error for the procfs-disabled case: fs/built-in.o: In function `xfs_free_ag_extent': fs/xfs/libxfs/xfs_alloc.c:1725: undefined reference to `xfsstats' fs/built-in.o: In function `xfs_alloc_ag_vextent': fs/xfs/libxfs/xfs_alloc.c:645: undefined reference to `xfsstats' fs/built-in.o: In function `xfs_attr_set': fs/xfs/libxfs/xfs_attr.c:353: undefined reference to `xfsstats' fs/built-in.o: In function `xfs_attr_remove': fs/xfs/libxfs/xfs_attr.c:483: undefined reference to `xfsstats' fs/built-in.o: In function `xfs_attr_get': fs/xfs/libxfs/xfs_attr.c:131: undefined reference to `xfsstats' fs/built-in.o:fs/xfs/libxfs/xfs_bmap.c:1461: more undefined references to `xfsstats' follow This adds conditional compilation to each reference of the xfsstats global variable to get it to link again. An alternative approach would be to always build the statistics implementation even when CONFIG_PROC_FS is disabled. Signed-off-by: Arnd Bergmann Fixes: 80529c45ab66 ("xfs: pass xfsstats structures to handlers and macros") Fixes: ff6d6af2351c ("xfs: per-filesystem stats counter implementation") --- Found with ARM randconfig builds. You seem to have intentionally removed the XFS_STATS_INC etc macros and #ifdefs in ff6d6af2351c, so I suspect this is not what you had in mind then, but it's not clear what you want instead. Please regard this as a bug report if it looks wrong to you ;-) Arnd diff --git a/fs/xfs/xfs_stats.h b/fs/xfs/xfs_stats.h index 483b0eff1988..f87ad9d12f4a 100644 --- a/fs/xfs/xfs_stats.h +++ b/fs/xfs/xfs_stats.h @@ -213,9 +213,12 @@ struct xfsstats { __uint64_t xs_read_bytes; }; +extern struct xstats xfsstats; + +#ifdef CONFIG_PROC_FS + int xfs_stats_format(struct xfsstats __percpu *stats, char *buf); void xfs_stats_clearall(struct xfsstats __percpu *stats); -extern struct xstats xfsstats; #define XFS_STATS_INC(mp, v) \ do { \ @@ -235,14 +238,23 @@ do { \ per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v += (inc); \ } while (0) -#if defined(CONFIG_PROC_FS) - extern int xfs_init_procfs(void); extern void xfs_cleanup_procfs(void); - #else /* !CONFIG_PROC_FS */ +static inline int xfs_stats_format(struct xfsstats __percpu *stats, char *buf) +{ + return 0; +} +static inline void xfs_stats_clearall(struct xfsstats __percpu *stats) +{ +} + +#define XFS_STATS_INC(mp, v) do { } while (0) +#define XFS_STATS_DEC(mp, v) do { } while (0) +#define XFS_STATS_ADD(mp, v, inc) do { } while (0) + static inline int xfs_init_procfs(void) { return 0; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 368c55adee9d..58a372898857 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1475,10 +1475,12 @@ xfs_fs_fill_super( goto out_destroy_workqueues; /* Allocate stats memory before we do operations that might use it */ - mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); - if (!mp->m_stats.xs_stats) { - error = PTR_ERR(mp->m_stats.xs_stats); - goto out_destroy_counters; + if (IS_ENABLED(CONFIG_PROC_FS)) { + mp->m_stats.xs_stats = alloc_percpu(struct xfsstats); + if (!mp->m_stats.xs_stats) { + error = PTR_ERR(mp->m_stats.xs_stats); + goto out_destroy_counters; + } } error = xfs_readsb(mp, flags); @@ -1851,16 +1853,18 @@ init_xfs_fs(void) goto out_sysctl_unregister; } - xfsstats.xs_kobj.kobject.kset = xfs_kset; + if (IS_ENABLED(CONFIG_PROC_FS)) { + xfsstats.xs_kobj.kobject.kset = xfs_kset; - xfsstats.xs_stats = alloc_percpu(struct xfsstats); - if (!xfsstats.xs_stats) { - error = -ENOMEM; - goto out_kset_unregister; + xfsstats.xs_stats = alloc_percpu(struct xfsstats); + if (!xfsstats.xs_stats) { + error = -ENOMEM; + goto out_kset_unregister; + } + error = xfs_sysfs_init(&xfsstats.xs_kobj, &xfs_stats_ktype, + NULL, "stats"); } - error = xfs_sysfs_init(&xfsstats.xs_kobj, &xfs_stats_ktype, NULL, - "stats"); if (error) goto out_free_stats; @@ -1887,9 +1891,11 @@ init_xfs_fs(void) xfs_sysfs_del(&xfs_dbg_kobj); out_remove_stats_kobj: #endif - xfs_sysfs_del(&xfsstats.xs_kobj); + if (IS_ENABLED(CONFIG_PROC_FS)) + xfs_sysfs_del(&xfsstats.xs_kobj); out_free_stats: - free_percpu(xfsstats.xs_stats); + if (IS_ENABLED(CONFIG_PROC_FS)) + free_percpu(xfsstats.xs_stats); out_kset_unregister: kset_unregister(xfs_kset); out_sysctl_unregister: @@ -1916,8 +1922,10 @@ exit_xfs_fs(void) #ifdef DEBUG xfs_sysfs_del(&xfs_dbg_kobj); #endif - xfs_sysfs_del(&xfsstats.xs_kobj); - free_percpu(xfsstats.xs_stats); + if (IS_ENABLED(CONFIG_PROC_FS)) { + xfs_sysfs_del(&xfsstats.xs_kobj); + free_percpu(xfsstats.xs_stats); + } kset_unregister(xfs_kset); xfs_sysctl_unregister(); xfs_cleanup_procfs();