From patchwork Tue Oct 22 18:48:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11205095 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B5A913BD for ; Tue, 22 Oct 2019 18:48:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A09D218AE for ; Tue, 22 Oct 2019 18:48:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dhEjon9m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732790AbfJVSsQ (ORCPT ); Tue, 22 Oct 2019 14:48:16 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:45204 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729696AbfJVSsP (ORCPT ); Tue, 22 Oct 2019 14:48:15 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiAOK109486; Tue, 22 Oct 2019 18:48:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=wvagb+Gs3gehSKyUZuM4DWdCt2GXmK8sP0sJDlViVaU=; b=dhEjon9maihPeeI07CE4J3pWhB5M5LNUEu7QKgliRW/uIoqKPHSjy3PBl9A6X6ntgvjE hnVn2JxrQ2ZRNqBd3SEHWchJSOxWqp+icSir/LdNn1NBMNIYIrT6hZlEUFZsZHOIQs3s Da+MfzFNlsz69Uwkqlwn9CxaPRHJFdnprvmBVglp8EqQFI1p9PLGkI6GE0vOcn64DD84 fxe+QSn2S6h8r0ywwVKvxkRKKjxfbeDOOHHA4uh5ZkOaFy11WHlT3ErTJIII7ps2AYoX kKVIE4w7RlaOsaYksr5qvEXLScRHr8lT+xEbzPBialwMcq/4h/bMIxZYszMi1JBDIsYK Iw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2vqswtguuu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:13 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiOws070581; Tue, 22 Oct 2019 18:48:13 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2vsx2rkg2m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:13 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9MImC6Z026031; Tue, 22 Oct 2019 18:48:12 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Oct 2019 11:48:12 -0700 Subject: [PATCH 1/4] libfrog: clean up platform_nproc From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 22 Oct 2019 11:48:11 -0700 Message-ID: <157177009113.1460186.17260250829884616599.stgit@magnolia> In-Reply-To: <157177008495.1460186.12329293699422541895.stgit@magnolia> References: <157177008495.1460186.12329293699422541895.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=9 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=9 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The platform_nproc function should check for error returns and obviously garbage values and deal with them appropriately. Fix the header declaration since it's part of the libfrog platform support code, not libxfs. xfs_scrub will make use of it in the next patch. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- include/libxfs.h | 1 - include/platform_defs.h.in | 2 ++ libfrog/linux.c | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index 63696df5..227084ae 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -135,7 +135,6 @@ extern void libxfs_device_close (dev_t); extern int libxfs_device_alignment (void); extern void libxfs_report(FILE *); extern void platform_findsizes(char *path, int fd, long long *sz, int *bsz); -extern int platform_nproc(void); /* check or write log footer: specify device, log size in blocks & uuid */ typedef char *(libxfs_get_block_t)(char *, int, void *); diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index d111ec6d..adb00181 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -77,4 +77,6 @@ typedef unsigned short umode_t; # define ASSERT(EX) ((void) 0) #endif +extern int platform_nproc(void); + #endif /* __XFS_PLATFORM_DEFS_H__ */ diff --git a/libfrog/linux.c b/libfrog/linux.c index b6c24879..79bd79eb 100644 --- a/libfrog/linux.c +++ b/libfrog/linux.c @@ -242,10 +242,17 @@ platform_align_blockdev(void) return max_block_alignment; } +/* How many CPUs are online? */ int platform_nproc(void) { - return sysconf(_SC_NPROCESSORS_ONLN); + long nproc = sysconf(_SC_NPROCESSORS_ONLN); + + if (nproc < 1) + return 1; + if (nproc >= INT_MAX) + return INT_MAX; + return nproc; } unsigned long From patchwork Tue Oct 22 18:48:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11205097 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34BCC13BD for ; Tue, 22 Oct 2019 18:48:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1392C218AE for ; Tue, 22 Oct 2019 18:48:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kmAh5iGp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732792AbfJVSsW (ORCPT ); Tue, 22 Oct 2019 14:48:22 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48570 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729696AbfJVSsW (ORCPT ); Tue, 22 Oct 2019 14:48:22 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiBux089154; Tue, 22 Oct 2019 18:48:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=u9yZelFhmdywhRDlY8rt4prtk4UKoipm0zee2Yj1TnY=; b=kmAh5iGpjUJ8cf9LiKHqUy4Iymvll0Eo55UikMu5Wx7rhrFQ48Rw8ytpv6+C+gRYm5nz WqxvEMfs/WUUc8AcygiROKeF+pYgB4CcSA5V+AnyIYkPTE+Qi/gWuf9Fz2/aRZx4uBqe RvwQKtBoWMAR5hixY/U+eq3s4H8/B/LC+OrpRE0ZxrCuprRtfIHWo4lNQlzsocvZxK8i KOfQknY3dUJslvrQBCdPctTGav0nABP9iJmyH5ORgRsw3r+pmcAPIiBy2Wmm2I2ObN17 cWvRad53B9gP6eBQRoSlPCRNDG/Co1tx2NSLvYtae563ZygXm7jhsptpqvLrfDA9IBZ6 Gw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2vqu4qrk4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:19 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiOx1070581; Tue, 22 Oct 2019 18:48:19 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2vsx2rkgap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:19 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9MImIh5003079; Tue, 22 Oct 2019 18:48:18 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Oct 2019 11:48:18 -0700 Subject: [PATCH 2/4] libxfs: remove libxfs_nproc From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 22 Oct 2019 11:48:17 -0700 Message-ID: <157177009727.1460186.2780524441344390421.stgit@magnolia> In-Reply-To: <157177008495.1460186.12329293699422541895.stgit@magnolia> References: <157177008495.1460186.12329293699422541895.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Remove libxfs_nproc since it's a wrapper around a libfrog function. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- include/libxfs.h | 1 - libxfs/init.c | 11 ----------- repair/phase4.c | 6 +++--- repair/prefetch.c | 2 +- repair/slab.c | 2 +- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index 227084ae..405572ee 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -161,7 +161,6 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; #endif -extern int libxfs_nproc(void); extern unsigned long libxfs_physmem(void); /* in kilobytes */ #include "xfs_ialloc.h" diff --git a/libxfs/init.c b/libxfs/init.c index 4446a62a..9e762435 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -853,17 +853,6 @@ libxfs_report(FILE *fp) fprintf(fp, "%s", c); } -int -libxfs_nproc(void) -{ - int nr; - - nr = platform_nproc(); - if (nr < 1) - nr = 1; - return nr; -} - unsigned long libxfs_physmem(void) { diff --git a/repair/phase4.c b/repair/phase4.c index 66e69db7..e1ba778f 100644 --- a/repair/phase4.c +++ b/repair/phase4.c @@ -235,7 +235,7 @@ process_rmap_data( if (!rmap_needs_work(mp)) return; - create_work_queue(&wq, mp, libxfs_nproc()); + create_work_queue(&wq, mp, platform_nproc()); for (i = 0; i < mp->m_sb.sb_agcount; i++) queue_work(&wq, check_rmap_btrees, i, NULL); destroy_work_queue(&wq); @@ -243,12 +243,12 @@ process_rmap_data( if (!xfs_sb_version_hasreflink(&mp->m_sb)) return; - create_work_queue(&wq, mp, libxfs_nproc()); + create_work_queue(&wq, mp, platform_nproc()); for (i = 0; i < mp->m_sb.sb_agcount; i++) queue_work(&wq, compute_ag_refcounts, i, NULL); destroy_work_queue(&wq); - create_work_queue(&wq, mp, libxfs_nproc()); + create_work_queue(&wq, mp, platform_nproc()); for (i = 0; i < mp->m_sb.sb_agcount; i++) { queue_work(&wq, process_inode_reflink_flags, i, NULL); queue_work(&wq, check_refcount_btrees, i, NULL); diff --git a/repair/prefetch.c b/repair/prefetch.c index beb36cd6..8e3772ed 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -1015,7 +1015,7 @@ do_inode_prefetch( */ if (check_cache && !libxfs_bcache_overflowed()) { queue.wq_ctx = mp; - create_work_queue(&queue, mp, libxfs_nproc()); + create_work_queue(&queue, mp, platform_nproc()); for (i = 0; i < mp->m_sb.sb_agcount; i++) queue_work(&queue, func, i, NULL); destroy_work_queue(&queue); diff --git a/repair/slab.c b/repair/slab.c index ba5c2327..f075ee5b 100644 --- a/repair/slab.c +++ b/repair/slab.c @@ -234,7 +234,7 @@ qsort_slab( return; } - create_work_queue(&wq, NULL, libxfs_nproc()); + create_work_queue(&wq, NULL, platform_nproc()); hdr = slab->s_first; while (hdr) { qs = malloc(sizeof(struct qsort_slab)); From patchwork Tue Oct 22 18:48:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11205099 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C50B112C for ; Tue, 22 Oct 2019 18:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B0F1218AE for ; Tue, 22 Oct 2019 18:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="KyBohv8y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732436AbfJVSs3 (ORCPT ); Tue, 22 Oct 2019 14:48:29 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:50838 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729696AbfJVSs3 (ORCPT ); Tue, 22 Oct 2019 14:48:29 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiPhj091085; Tue, 22 Oct 2019 18:48:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=XjBTGtH7HhP8Px6M6CMjaigpS5S0b3mD+VjOI9Kpbl4=; b=KyBohv8yCCanghmFdW+mte0M/gbwkOTO6Yu0FayQ9/pL8I0sYVa3eFCc6VdhkvkgZx7P D3VdRFoHRTWQrVk3oDL5q/3MRmO23b3XHuVywOsJulMnoUuGb1VTdFBAV5UVg4Ju9DX/ uchwHbE+reimFGupckmXQyDHL5stlgIzJxZLoaTNTE3Y9PVzwdERjadWvjiv8l84OsMv v1VvQTSa7Ksln0gQ0HI8qt02P7ahc6LEQKe4li6eNkFk7+SslDwqru3Im9HBX0J0WYDc CVYx8/aBS644+472k8hLPes1XWizdYQkWO9oEA2xnG62I3YFLdwzLS65poQrsmX787yN Ww== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2vqteprr51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:27 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiONG064374; Tue, 22 Oct 2019 18:48:27 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2vt2hdkdrg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:27 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9MImQ1m029796; Tue, 22 Oct 2019 18:48:26 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Oct 2019 18:48:26 +0000 Subject: [PATCH 3/4] libxfs: remove libxfs_physmem From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 22 Oct 2019 11:48:23 -0700 Message-ID: <157177010343.1460186.15100646078363671205.stgit@magnolia> In-Reply-To: <157177008495.1460186.12329293699422541895.stgit@magnolia> References: <157177008495.1460186.12329293699422541895.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Remove this thin wrapper too. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- include/libxfs.h | 3 --- libxfs/init.c | 6 ------ repair/xfs_repair.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index 405572ee..0cc0820b 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -160,9 +160,6 @@ extern void cmn_err(int, char *, ...); enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; #endif - -extern unsigned long libxfs_physmem(void); /* in kilobytes */ - #include "xfs_ialloc.h" #include "xfs_attr_leaf.h" diff --git a/libxfs/init.c b/libxfs/init.c index 9e762435..537b73bd 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -852,9 +852,3 @@ libxfs_report(FILE *fp) c = asctime(localtime(&t)); fprintf(fp, "%s", c); } - -unsigned long -libxfs_physmem(void) -{ - return platform_physmem(); -} diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 7e810ef4..df65b6c5 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -852,7 +852,7 @@ main(int argc, char **argv) (mp->m_sb.sb_dblocks >> (10 + 1)) + 50000; /* rough estimate of 50MB overhead */ max_mem = max_mem_specified ? max_mem_specified * 1024 : - libxfs_physmem() * 3 / 4; + platform_physmem() * 3 / 4; if (getrlimit(RLIMIT_AS, &rlim) != -1 && rlim.rlim_cur != RLIM_INFINITY) { From patchwork Tue Oct 22 18:48:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11205101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AC9D112C for ; Tue, 22 Oct 2019 18:48:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5840421872 for ; Tue, 22 Oct 2019 18:48:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ND9t3Hxm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732542AbfJVSsh (ORCPT ); Tue, 22 Oct 2019 14:48:37 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48864 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729696AbfJVSsg (ORCPT ); Tue, 22 Oct 2019 14:48:36 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiEpt089167; Tue, 22 Oct 2019 18:48:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=d/gUV+Ntgf+Y3KPdvO2ATREAJpJxBTubkbpwG13rrS8=; b=ND9t3Hxms3ehiDS4yVK753Dwb05+xjh4dLVoTl+P1ys8yra9FtE+YmltTBs0z/hICkR6 QatamXyAI7QIGRIHbrLCmgYlxO35/J5cLH6vNmL8Z/jgIfJC5Zzd78aEJXRt3V6mbDKY se0ANv9eMY+zZHnfksaLwd37eaKa3WE1owBFfJM6tytip7oEPZl87Q8RVjYDMpbr2kI8 9mTjKskjLwaWmMJ+we2EmBaMmYaH+O94tWEG6UqtqrxAAbxHk+P+uNOzHZtZDKqsSBjf OltkKaMrJ3ljnZoBv/oSqcI0R1DL8pFbdVnswe/3l8vmd5v/xNgtW/hisUvQgvAyhnH8 EA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2vqu4qrk62-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:34 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9MIiOBp064377; Tue, 22 Oct 2019 18:48:33 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2vt2hdke2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Oct 2019 18:48:33 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9MImX6H029817; Tue, 22 Oct 2019 18:48:33 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Oct 2019 11:48:33 -0700 Subject: [PATCH 4/4] libfrog: take over platform headers From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 22 Oct 2019 11:48:31 -0700 Message-ID: <157177011182.1460186.9452615454342854032.stgit@magnolia> In-Reply-To: <157177008495.1460186.12329293699422541895.stgit@magnolia> References: <157177008495.1460186.12329293699422541895.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9418 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910220156 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Move all the declarations for platform-specific functions into libfrog/platform.h, since they're a part of libfrog now. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- include/libxfs.h | 1 - libfrog/platform.h | 26 ++++++++++++++++++++++++++ libfrog/topology.c | 1 + libxfs/init.c | 1 + libxfs/init.h | 14 -------------- repair/xfs_repair.c | 1 + 6 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 libfrog/platform.h diff --git a/include/libxfs.h b/include/libxfs.h index 0cc0820b..85ced52a 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -134,7 +134,6 @@ extern dev_t libxfs_device_open (char *, int, int, int); extern void libxfs_device_close (dev_t); extern int libxfs_device_alignment (void); extern void libxfs_report(FILE *); -extern void platform_findsizes(char *path, int fd, long long *sz, int *bsz); /* check or write log footer: specify device, log size in blocks & uuid */ typedef char *(libxfs_get_block_t)(char *, int, void *); diff --git a/libfrog/platform.h b/libfrog/platform.h new file mode 100644 index 00000000..76887e5e --- /dev/null +++ b/libfrog/platform.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2000-2006 Silicon Graphics, Inc. + * All Rights Reserved. + */ + +#ifndef __LIBFROG_PLATFORM_H__ +#define __LIBFROG_PLATFORM_H__ + +int platform_check_ismounted(char *path, char *block, struct stat *sptr, + int verbose); +int platform_check_iswritable(char *path, char *block, struct stat *sptr); +int platform_set_blocksize(int fd, char *path, dev_t device, int bsz, + int fatal); +void platform_flush_device(int fd, dev_t device); +char *platform_findrawpath(char *path); +char *platform_findblockpath(char *path); +int platform_direct_blockdev(void); +int platform_align_blockdev(void); +unsigned long platform_physmem(void); /* in kilobytes */ +void platform_findsizes(char *path, int fd, long long *sz, int *bsz); +int platform_nproc(void); + +void platform_findsizes(char *path, int fd, long long *sz, int *bsz); + +#endif /* __LIBFROG_PLATFORM_H__ */ diff --git a/libfrog/topology.c b/libfrog/topology.c index e2f87415..b1b470c9 100644 --- a/libfrog/topology.c +++ b/libfrog/topology.c @@ -11,6 +11,7 @@ #endif /* ENABLE_BLKID */ #include "xfs_multidisk.h" #include "topology.h" +#include "platform.h" #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog))) diff --git a/libxfs/init.c b/libxfs/init.c index 537b73bd..a0d4b7f4 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -21,6 +21,7 @@ #include "xfs_trans.h" #include "xfs_rmap_btree.h" #include "xfs_refcount_btree.h" +#include "libfrog/platform.h" #include "libxfs.h" /* for now */ diff --git a/libxfs/init.h b/libxfs/init.h index b23e493c..df49a99a 100644 --- a/libxfs/init.h +++ b/libxfs/init.h @@ -9,18 +9,4 @@ struct stat; extern int use_xfs_buf_lock; -extern int platform_check_ismounted (char *path, char *block, - struct stat *sptr, int verbose); -extern int platform_check_iswritable (char *path, char *block, struct stat *sptr); -extern int platform_set_blocksize (int fd, char *path, dev_t device, int bsz, int fatal); -extern void platform_flush_device (int fd, dev_t device); -extern char *platform_findrawpath(char *path); -extern char *platform_findrawpath (char *path); -extern char *platform_findblockpath (char *path); -extern int platform_direct_blockdev (void); -extern int platform_align_blockdev (void); -extern unsigned long platform_physmem(void); /* in kilobytes */ -extern void platform_findsizes(char *path, int fd, long long *sz, int *bsz); -extern int platform_nproc(void); - #endif /* LIBXFS_INIT_H */ diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index df65b6c5..3338a7b8 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -23,6 +23,7 @@ #include "slab.h" #include "rmap.h" #include "libfrog/fsgeom.h" +#include "libfrog/platform.h" /* * option tables for getsubopt calls