From patchwork Tue Aug 20 20:31: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: 11104647 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 34166174A for ; Tue, 20 Aug 2019 20:31:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1257E22DD3 for ; Tue, 20 Aug 2019 20:31:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Z9JhSGFF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730638AbfHTUbW (ORCPT ); Tue, 20 Aug 2019 16:31:22 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:42768 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730704AbfHTUbW (ORCPT ); Tue, 20 Aug 2019 16:31: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 x7KKTJL1166356; Tue, 20 Aug 2019 20:31: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=a4Ae/ui4mUzj5LTuy5Kzv3nR5vwNUiZsRpdH/6w0om4=; b=Z9JhSGFFvqS8vbDCXIvwFlxRPYh5t6L4Hqc3Y9umLZXGwqQiwfXMsM05+wX+Rmm4JRSf TvHVlhrI/OwuQs3TfA9APwCCBn35WqU3TcD6QsDHoxIuEb4Cc57NIoS4hi9HO9kp/3mm PZYm3wtBUDs8SZyFA77f7IsyyhHJvSTuSQRwLUF7RDbbK/OKJ6e2nCwmsCdNWZex7Ruj Jv9bJxz4uJ3vpHXXy4+kmfhRNYWQjHNLUMjtGm3k5Clg48HKdkqzxX/Nnkx/3q4K1j5y Zp3yOBAJ8y7CK3mOVcCffGTJ2upY4hYyXBlQWhCvmdPJEesTMH0DYN7s6bkzDYt5Plqh qw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2uea7qs0d3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:20 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7KKTCW4071301; Tue, 20 Aug 2019 20:31:19 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2ugj7pnekg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:19 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7KKVJUl019752; Tue, 20 Aug 2019 20:31:19 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:18 -0700 Subject: [PATCH 01/12] libxfs-diff: try harder to find the kernel equivalent libxfs files From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:17 -0700 Message-ID: <156633307795.1215978.8644291951311062567.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Now that we're syncing userspace libxfs/ files with kernel fs/xfs/ files, teach the diff tool to try fs/xfs/xfs_foo.c if fs/xfs/libxfs/xfs_foo.c doesn't exist. Signed-off-by: Darrick J. Wong --- tools/libxfs-diff | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libxfs-diff b/tools/libxfs-diff index fa57c004..c18ad487 100755 --- a/tools/libxfs-diff +++ b/tools/libxfs-diff @@ -22,5 +22,6 @@ dir="$(readlink -m "${dir}/..")" for i in libxfs/xfs*.[ch]; do kfile="${dir}/$i" + test -f "${kfile}" || kfile="$(echo "${kfile}" | sed -e 's|libxfs/||g')" diff -Naurpw --label "$i" <(sed -e '/#include/d' "$i") --label "${kfile}" <(sed -e '/#include/d' "${kfile}") done From patchwork Tue Aug 20 20:31:24 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: 11104649 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 18F14174A for ; Tue, 20 Aug 2019 20:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB09522DD3 for ; Tue, 20 Aug 2019 20:31:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TnJPCnJA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730466AbfHTUb2 (ORCPT ); Tue, 20 Aug 2019 16:31:28 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:45766 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730092AbfHTUb2 (ORCPT ); Tue, 20 Aug 2019 16:31:28 -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 x7KKSw0m151484; Tue, 20 Aug 2019 20:31:26 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=u3BETOqj/MIWmZ7VhcfIEaAgXDWaQH0oW/CF101gXX8=; b=TnJPCnJAlYT7yM/bJBmB3ltLjmydZZeAkdLV9BUO9KfMf4xvq6GcqQo9SdNkwhrnbMVU yWGOg1YAYLVc7l+kWSaQPGdoMs4CRDECFg7nH2xKWAIO3UzQyit3aJoAUv9Tut5BpGqh 8sNogac1jCS+BiagqbC1ORrbZKEoKzRLeVGZsgbTsOxJjpQoC/K0G51DtVrX+gBY0r8g D2N4+Pcqijq5zRh25RM15XWCagW2w/y7klXQ6rkb3DtLedzXkcrvmKa2+QfgB4jLbCNd p7aZRPXfSiApzaIDVyrhgWS6dsg6gNLF8z5LnwzMXh3tCu+k36TMgTwCTCN92eh0Sza7 5g== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2ue90th5tf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:26 +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 x7KKSo07160309; Tue, 20 Aug 2019 20:31:25 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2ug1g9rk6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:25 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7KKVPgk028281; Tue, 20 Aug 2019 20:31:25 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:24 -0700 Subject: [PATCH 02/12] libxfs: move topology declarations into separate header From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:24 -0700 Message-ID: <156633308405.1215978.11329921136072672886.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The topology functions live in libfrog now, which means their declarations don't belong in libxcmd.h. Create new header file for them. Signed-off-by: Darrick J. Wong --- include/libxcmd.h | 31 ------------------------------- include/topology.h | 39 +++++++++++++++++++++++++++++++++++++++ libfrog/topology.c | 1 + mkfs/xfs_mkfs.c | 2 +- repair/sb.c | 1 + 5 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 include/topology.h diff --git a/include/libxcmd.h b/include/libxcmd.h index 20e5d834..7b889b0a 100644 --- a/include/libxcmd.h +++ b/include/libxcmd.h @@ -10,35 +10,4 @@ #include "libxfs.h" #include -/* - * Device topology information. - */ -typedef struct fs_topology { - int dsunit; /* stripe unit - data subvolume */ - int dswidth; /* stripe width - data subvolume */ - int rtswidth; /* stripe width - rt subvolume */ - int lsectorsize; /* logical sector size &*/ - int psectorsize; /* physical sector size */ -} fs_topology_t; - -extern void -get_topology( - libxfs_init_t *xi, - struct fs_topology *ft, - int force_overwrite); - -extern void -calc_default_ag_geometry( - int blocklog, - uint64_t dblocks, - int multidisk, - uint64_t *agsize, - uint64_t *agcount); - -extern int -check_overwrite( - const char *device); - - - #endif /* __LIBXCMD_H__ */ diff --git a/include/topology.h b/include/topology.h new file mode 100644 index 00000000..61ede23a --- /dev/null +++ b/include/topology.h @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2000-2005 Silicon Graphics, Inc. + * All Rights Reserved. + */ + +#ifndef __TOPOLOGY_H__ +#define __TOPOLOGY_H__ + +/* + * Device topology information. + */ +typedef struct fs_topology { + int dsunit; /* stripe unit - data subvolume */ + int dswidth; /* stripe width - data subvolume */ + int rtswidth; /* stripe width - rt subvolume */ + int lsectorsize; /* logical sector size &*/ + int psectorsize; /* physical sector size */ +} fs_topology_t; + +extern void +get_topology( + libxfs_init_t *xi, + struct fs_topology *ft, + int force_overwrite); + +extern void +calc_default_ag_geometry( + int blocklog, + uint64_t dblocks, + int multidisk, + uint64_t *agsize, + uint64_t *agcount); + +extern int +check_overwrite( + const char *device); + +#endif /* __TOPOLOGY_H__ */ diff --git a/libfrog/topology.c b/libfrog/topology.c index cac164f3..e2f87415 100644 --- a/libfrog/topology.c +++ b/libfrog/topology.c @@ -10,6 +10,7 @@ # include #endif /* ENABLE_BLKID */ #include "xfs_multidisk.h" +#include "topology.h" #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog))) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 0bdf6ec3..d05a6898 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -9,7 +9,7 @@ #include "xfs_multidisk.h" #include "libxcmd.h" #include "fsgeom.h" - +#include "topology.h" #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog))) diff --git a/repair/sb.c b/repair/sb.c index 119bf219..547969f7 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -12,6 +12,7 @@ #include "protos.h" #include "err_protos.h" #include "xfs_multidisk.h" +#include "topology.h" #define BSIZE (1024 * 1024) From patchwork Tue Aug 20 20:31:30 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: 11104651 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 0951A174A for ; Tue, 20 Aug 2019 20:31:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB7DC22DD3 for ; Tue, 20 Aug 2019 20:31:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ezeBlgxE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730092AbfHTUbe (ORCPT ); Tue, 20 Aug 2019 16:31:34 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58484 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730704AbfHTUbe (ORCPT ); Tue, 20 Aug 2019 16:31:34 -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 x7KKT8pE180653; Tue, 20 Aug 2019 20:31:32 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=+9WDTLV+gac7m4St+PU/rBrD+ojEklTwhN7Ik+ZgRs4=; b=ezeBlgxELkY5Sv2afQpaokUcASZ6Yr49kPhDgKEKMW8WJfsjEwUBJWwGbnezV8FNuvmd UqUFykNaIu8OT4V8CNnWP9bsYGjMkpGeyes41ERtt63ekPGvWeWkuVwlI59OvDgfK8hJ jVw7C+edjUO8NXfS6o7vCdF9MiC6zc/K5s+o6VYiDk1RYhG1e8UCPFE3HBxYRivlLv9q S9rZKjVafIVBHiaIhDkR30M0w/AT4NO9oFb8yDco95CGNBgihAXNlNMCv14o/xHu2Vx3 /pFiyMEnoWWxoT11z6KrjfsSxq7eXwBodwIYhOOFUq+BbbtfaMvZvGOllMZ1L6iaihJX Ag== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2ue9hph0mx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:32 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7KKTBvC071243; Tue, 20 Aug 2019 20:31:32 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2ugj7pners-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:32 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7KKVVfY028308; Tue, 20 Aug 2019 20:31:31 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:30 -0700 Subject: [PATCH 03/12] libfrog: try the v4 fs geometry ioctl after failing the v5 ioctl From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:30 -0700 Message-ID: <156633309007.1215978.12240756059931527276.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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=941 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong If a v5 fs geometry query fails, try the v4 interface before falling back to the v1 interface. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- libfrog/fsgeom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c index a3b748f8..06e4e663 100644 --- a/libfrog/fsgeom.c +++ b/libfrog/fsgeom.c @@ -84,6 +84,10 @@ xfrog_geometry( if (!ret) return 0; + ret = ioctl(fd, XFS_IOC_FSGEOMETRY_V4, fsgeo); + if (!ret) + return 0; + return ioctl(fd, XFS_IOC_FSGEOMETRY_V1, fsgeo); } From patchwork Tue Aug 20 20:31:36 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: 11104653 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 0028A174A for ; Tue, 20 Aug 2019 20:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D241D2332B for ; Tue, 20 Aug 2019 20:31:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="c2+WZkxx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730704AbfHTUbl (ORCPT ); Tue, 20 Aug 2019 16:31:41 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58596 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730501AbfHTUbl (ORCPT ); Tue, 20 Aug 2019 16:31:41 -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 x7KKT1T1180561; Tue, 20 Aug 2019 20:31:39 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=Nhoyq0hSsWomEjuVdr0hdt0xlGkkvMYvCHw2uB/sHFw=; b=c2+WZkxxVGy+JROPksnOsjHtvs4pLhM7kVWla0ygLe3gaZxawNC/t1NOYI0lE9uxMLcQ iP5213dHq2ZG9roYO3grTpLoqNXgOyZR01LqH1HAM8HJNj79qCiHl+IJ6ZBmWcdz1ldr o+d+G6qqnuJsp8qzSYAZyfHcQNC6PB1aLNRDTC4/dUbX/IfBwY3xc/uyq/12K37Wt0YN 6tUcFgA3aW+XQ3dqfSyLacdIPSoJATo2W8S6zoK5+EymlWdnxBFa66FpGbET1RENPtfx tiKmy1JkBumsGgl4bv+ufishzgRbNbHcZJWN93gXMj6h/tPh7DiLtC1i5SenxC1yAAvo qg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2ue9hph0nw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:39 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7KKTCdi071337; Tue, 20 Aug 2019 20:31:38 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2ugj7pneup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:38 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7KKVbMg028427; Tue, 20 Aug 2019 20:31:37 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:37 -0700 Subject: [PATCH 04/12] man: document the new v5 fs geometry ioctl structures From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:36 -0700 Message-ID: <156633309613.1215978.13281783388020912868.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Amend the fs geometry ioctl documentation to cover the new v5 structure. Signed-off-by: Darrick J. Wong --- libfrog/fsgeom.c | 4 ++++ man/man2/ioctl_xfs_fsop_geometry.2 | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c index 06e4e663..159738c5 100644 --- a/libfrog/fsgeom.c +++ b/libfrog/fsgeom.c @@ -88,6 +88,10 @@ xfrog_geometry( if (!ret) return 0; + ret = ioctl(fd, XFS_IOC_FSGEOMETRY_V4, fsgeo); + if (!ret) + return 0; + return ioctl(fd, XFS_IOC_FSGEOMETRY_V1, fsgeo); } diff --git a/man/man2/ioctl_xfs_fsop_geometry.2 b/man/man2/ioctl_xfs_fsop_geometry.2 index 68e3387d..365bda8b 100644 --- a/man/man2/ioctl_xfs_fsop_geometry.2 +++ b/man/man2/ioctl_xfs_fsop_geometry.2 @@ -12,6 +12,8 @@ ioctl_xfs_fsop_geometry \- report XFS filesystem layout and features .PP .BI "int ioctl(int " fd ", XFS_IOC_FSOP_GEOMETRY, struct xfs_fsop_geom*" arg ); .br +.BI "int ioctl(int " fd ", XFS_IOC_FSOP_GEOMETRY_V4, struct xfs_fsop_geom_v4 *" arg ); +.br .BI "int ioctl(int " fd ", XFS_IOC_FSOP_GEOMETRY_V1, struct xfs_fsop_geom_v1 *" arg ); .SH DESCRIPTION Report the details of an XFS filesystem layout, features, and other descriptive items. @@ -43,6 +45,9 @@ struct xfs_fsop_geom { /* struct xfs_fsop_geom_v1 stops here. */ __u32 logsunit; + /* struct xfs_fsop_geom_v4 stops here. */ + + __u64 reserved[18]; }; .fi .in @@ -124,6 +129,9 @@ underlying log device, in filesystem blocks. This field is meaningful only if the flag .B XFS_FSOP_GEOM_FLAGS_LOGV2 is set. +.PP +.I reserved +is set to zero. .SH FILESYSTEM FEATURE FLAGS Filesystem features are reported to userspace as a combination the following flags: From patchwork Tue Aug 20 20:31:42 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: 11104655 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 46B8B1395 for ; Tue, 20 Aug 2019 20:31:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 248D62332B for ; Tue, 20 Aug 2019 20:31:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="q70x+abs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730764AbfHTUbq (ORCPT ); Tue, 20 Aug 2019 16:31:46 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58750 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730501AbfHTUbq (ORCPT ); Tue, 20 Aug 2019 16:31:46 -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 x7KKT8pI180653; Tue, 20 Aug 2019 20:31:45 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=aECdyCrdhmzMzNt2PJeBVAUnUM2FIBONN6usX+Yq0ro=; b=q70x+absm3xSNlXXMii1A2uKoGaFlhSMJfUPTCiFzR/XNhhIV7BBD/0kEYl0dISVRhdM WzingiIEPbxlP257qFtksYoi31AlLFFTxtUgc0b7ZhOa9c5XT6qTF3TNCwe2E/VQnAdA VuU9P+Km1/ReBMc7CYI+9YN277IK5qPm8CU/Exajh7c3Cl6eirZGKCK/o1VHuq/ocDaP wq3OEJ8AeWrzPiSrPdlooNcDdoTU78c9G335ZZFrNVcE6S55P4pqYEf/TBtSzi4sVsVr sJgWby1cXjomc6UEJOVB1Bq21enHOI9mGJL4b7LtN4JUuwYMgCE9Nrr64NpfQPLi7VDV pQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2ue9hph0pn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:44 +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 x7KKTLUr191157; Tue, 20 Aug 2019 20:31:44 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2ugj7p4sn3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:44 +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 x7KKVhQW021563; Tue, 20 Aug 2019 20:31:43 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:43 -0700 Subject: [PATCH 05/12] man: document new fs summary counter scrub command From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:42 -0700 Message-ID: <156633310223.1215978.8971659233241451267.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Update the scrub ioctl documentation to include the new fs summary counter scrubber. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- man/man2/ioctl_xfs_scrub_metadata.2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/man/man2/ioctl_xfs_scrub_metadata.2 b/man/man2/ioctl_xfs_scrub_metadata.2 index 1e80ee71..046e3e36 100644 --- a/man/man2/ioctl_xfs_scrub_metadata.2 +++ b/man/man2/ioctl_xfs_scrub_metadata.2 @@ -159,6 +159,11 @@ corruption. .TP .B XFS_SCRUB_TYPE_PQUOTA Examine all user, group, or project quota records for corruption. + +.TP +.B XFS_SCRUB_TYPE_FSCOUNTERS +Examine all filesystem summary counters (free blocks, inode count, free inode +count) for errors. .RE .PD 1 From patchwork Tue Aug 20 20:31:48 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: 11104657 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 84BD6174A for ; Tue, 20 Aug 2019 20:31:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62C2E2332A for ; Tue, 20 Aug 2019 20:31:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LodEkLO5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730619AbfHTUbx (ORCPT ); Tue, 20 Aug 2019 16:31:53 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:43378 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730501AbfHTUbw (ORCPT ); Tue, 20 Aug 2019 16:31:52 -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 x7KKSvwi165915; Tue, 20 Aug 2019 20:31:50 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=oFSuHYvWrbt90dE0qxE+iaFJdENw72o334nkDq6mwSw=; b=LodEkLO5eNnsz9L8mTcAvIXuQe45K5QPjn8T2kkkKVlOVJ6rcboC2Qm65wpAZuoWSThV 80PD9QrcbewTrvrG674YMwnD5hhYeHN2PInfrNuHRqj1s7JxlEmQC0HJkQRUV1GlTMuq xLB2D91uHzg8+LQFOKPiSYHNX8eI8e3TGcqwdZsbRgfabUrljro5j9Mwop5eR0Ehq6Cx 8S3xwt8q+b/G9Ixcmb15dfZVm8600RP0H2bodwGIBpsutSs8qvE0jSS/CfrQoOyx19z/ sVC4XZPw4Sf+ZukCkURwwYMoMhxcDDm5SZV7z/QGevtyvYYcfeb6j2c4L4waOee4SOyq DA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2uea7qs0j8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:50 +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 x7KKTLWA191139; Tue, 20 Aug 2019 20:31:49 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2ugj7p4sqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:49 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7KKVn9M019982; Tue, 20 Aug 2019 20:31:49 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:49 -0700 Subject: [PATCH 06/12] man: document the new allocation group geometry ioctl From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:48 -0700 Message-ID: <156633310832.1215978.10494838202211430225.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Document the new ioctl to describe an allocation group's geometry. Signed-off-by: Darrick J. Wong --- man/man2/ioctl_xfs_ag_geometry.2 | 74 ++++++++++++++++++++++++++++++++++++++ man/man3/xfsctl.3 | 6 +++ 2 files changed, 80 insertions(+) create mode 100644 man/man2/ioctl_xfs_ag_geometry.2 diff --git a/man/man2/ioctl_xfs_ag_geometry.2 b/man/man2/ioctl_xfs_ag_geometry.2 new file mode 100644 index 00000000..5dfe0d08 --- /dev/null +++ b/man/man2/ioctl_xfs_ag_geometry.2 @@ -0,0 +1,74 @@ +.\" Copyright (c) 2019, Oracle. All rights reserved. +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" SPDX-License-Identifier: GPL-2.0+ +.\" %%%LICENSE_END +.TH IOCTL-XFS-AG-GEOMETRY 2 2019-04-11 "XFS" +.SH NAME +ioctl_xfs_ag_geometry \- query XFS allocation group geometry information +.SH SYNOPSIS +.br +.B #include +.PP +.BI "int ioctl(int " fd ", XFS_IOC_AG_GEOMETRY, struct xfs_ag_geometry *" arg ); +.SH DESCRIPTION +This XFS ioctl retrieves the geometry information for a given allocation group. +The geometry information is conveyed in a structure of the following form: +.PP +.in +4n +.nf +struct xfs_ag_geometry { + uint32_t ag_number; + uint32_t ag_length; + uint32_t ag_freeblks; + uint32_t ag_icount; + uint32_t ag_ifree; + uint32_t ag_sick; + uint32_t ag_checked; + uint32_t ag_reserved32; + uint64_t ag_reserved[12]; +}; +.fi +.in +.TP +.I ag_number +The number of allocation group that the caller wishes to learn about. +.TP +.I ag_length +Length of the allocation group, in units of filesystem blocks. +.TP +.I ag_freeblks +Number of free blocks in the allocation group, in units of filesystem blocks. +.TP +.I ag_icount +Number of inode records allocated in this allocation group. +.TP +.I ag_ifree +Number of unused inode records (of the space allocated) in this allocation +group. +.TP +.IR ag_reserved " and " ag_reserved32 +Will be set to zero. +.SH RETURN VALUE +On error, \-1 is returned, and +.I errno +is set to indicate the error. +.PP +.SH ERRORS +Error codes can be one of, but are not limited to, the following: +.TP +.B EFSBADCRC +Metadata checksum validation failed while performing the query. +.TP +.B EFSCORRUPTED +Metadata corruption was encountered while performing the query. +.TP +.B EINVAL +The specified allocation group number is not valid for this filesystem. +.TP +.B EIO +An I/O error was encountered while performing the query. +.SH CONFORMING TO +This API is specific to XFS filesystem on the Linux kernel. +.SH SEE ALSO +.BR ioctl (2) diff --git a/man/man3/xfsctl.3 b/man/man3/xfsctl.3 index 7e6588b8..dfebd12d 100644 --- a/man/man3/xfsctl.3 +++ b/man/man3/xfsctl.3 @@ -336,6 +336,12 @@ See .BR ioctl_xfs_fsop_geometry (2) for more information. +.TP +.B XFS_IOC_AG_GEOMETRY +See +.BR ioctl_xfs_ag_geometry (2) +for more information. + .TP .BR XFS_IOC_FSBULKSTAT " or " XFS_IOC_FSBULKSTAT_SINGLE See From patchwork Tue Aug 20 20:31:54 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: 11104659 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 131E3174A for ; Tue, 20 Aug 2019 20:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBCC42332B for ; Tue, 20 Aug 2019 20:31:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jHuY6sEQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730681AbfHTUb7 (ORCPT ); Tue, 20 Aug 2019 16:31:59 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:43506 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730501AbfHTUb7 (ORCPT ); Tue, 20 Aug 2019 16:31:59 -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 x7KKT1Ib165933; Tue, 20 Aug 2019 20:31:57 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=4uKhtbd+qizFfa6vZxLzkxuZlnU1dqqYB5ij1qL4O3Y=; b=jHuY6sEQK8Zn7QaXr9l81lsxpr9RS2/A9l2HSRn4sIeNBbc5CodcSMjQsfAdgFQ5sGWZ e4py3VzAiLbO6k9XhdUsqzf58xTUadhBTDCT3DtRX7wfPhSuNSGOeAC8Ha1NFav1Ckp1 iY0Em47ScW6jcq0OQMavHm+RsxdvyWPkA0AoWX5xlo8GadlEnnXihKnoaTSsPX/4K30z hxiHYVwOwk6dEiZuvVDolqlxAltBrqnGx4/y2JUkr/b+KGCVPzYi2+cCtP+23o2ofdsl CboOzPReJzuo3161yabZwdMn7GmyOfQ3Am8YNophDi+O8p3S7qdQdl4Mg2PACfkrE2t/ dw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2uea7qs0jw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:56 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7KKTSYt104732; Tue, 20 Aug 2019 20:31:56 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2ug269648r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:31:56 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7KKVtRx020009; Tue, 20 Aug 2019 20:31:55 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:31:55 -0700 Subject: [PATCH 07/12] man: document the new health reporting fields in various ioctls From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:31:54 -0700 Message-ID: <156633311435.1215978.5608220966246380465.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Update the manpages to conver the new health reporting fields in the fs geometry, ag geometry, and bulkstat ioctls. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- man/man2/ioctl_xfs_ag_geometry.2 | 48 +++++++++++++++++++++++++++++++ man/man2/ioctl_xfs_fsbulkstat.2 | 52 +++++++++++++++++++++++++++++++++ man/man2/ioctl_xfs_fsop_geometry.2 | 56 +++++++++++++++++++++++++++++++++++- 3 files changed, 154 insertions(+), 2 deletions(-) diff --git a/man/man2/ioctl_xfs_ag_geometry.2 b/man/man2/ioctl_xfs_ag_geometry.2 index 5dfe0d08..cf6aec1d 100644 --- a/man/man2/ioctl_xfs_ag_geometry.2 +++ b/man/man2/ioctl_xfs_ag_geometry.2 @@ -49,6 +49,54 @@ group. .TP .IR ag_reserved " and " ag_reserved32 Will be set to zero. +.PP +The fields +.IR ag_sick " and " ag_checked +indicate the relative health of various allocation group metadata: +.IP \[bu] 2 +If a given sick flag is set in +.IR ag_sick , +then that piece of metadata has been observed to be damaged. +The same bit will be set in +.IR ag_checked . +.IP \[bu] +If a given sick flag is set in +.I ag_checked +and is not set in +.IR ag_sick , +then that piece of metadata has been checked and is not faulty. +.IP \[bu] +If a given sick flag is not set in +.IR ag_checked , +then no conclusion can be made. +.PP +The following flags apply to these fields: +.RS 0.4i +.TP +.B XFS_AG_GEOM_SICK_SB +Allocation group superblock. +.TP +.B XFS_AG_GEOM_SICK_AGF +Free space header. +.TP +.B XFS_AG_GEOM_SICK_AGFL +Free space reserve list. +.TP +.B XFS_AG_GEOM_SICK_AGI +Inode header. +.TP +.BR XFS_AG_GEOM_SICK_BNOBT " or " XFS_AG_GEOM_SICK_CNTBT +Free space btrees. +.TP +.BR XFS_AG_GEOM_SICK_INOBT " or " XFS_AG_GEOM_SICK_FINOBT +Inode btrees. +.TP +.B XFS_AG_GEOM_SICK_RMAPBT +Reverse mapping btree. +.TP +.B XFS_AG_GEOM_SICK_REFCNTBT +Reference count btree. +.RE .SH RETURN VALUE On error, \-1 is returned, and .I errno diff --git a/man/man2/ioctl_xfs_fsbulkstat.2 b/man/man2/ioctl_xfs_fsbulkstat.2 index a8b22dc4..3e13cfa8 100644 --- a/man/man2/ioctl_xfs_fsbulkstat.2 +++ b/man/man2/ioctl_xfs_fsbulkstat.2 @@ -94,7 +94,9 @@ struct xfs_bstat { __u16 bs_projid_lo; __u16 bs_forkoff; __u16 bs_projid_hi; - unsigned char bs_pad[6]; + uint16_t bs_sick; + uint16_t bs_checked; + unsigned char bs_pad[2]; __u32 bs_cowextsize; __u32 bs_dmevmask; __u16 bs_dmstate; @@ -184,6 +186,54 @@ is unused on Linux. .I bs_aextents is the number of storage mappings associated with this file's extended attributes. +.PP +The fields +.IR bs_sick " and " bs_checked +indicate the relative health of various allocation group metadata: +.IP \[bu] 2 +If a given sick flag is set in +.IR bs_sick , +then that piece of metadata has been observed to be damaged. +The same bit should be set in +.IR bs_checked . +.IP \[bu] +If a given sick flag is set in +.I bs_checked +but is not set in +.IR bs_sick , +then that piece of metadata has been checked and is not faulty. +.IP \[bu] +If a given sick flag is not set in +.IR bs_checked , +then no conclusion can be made. +.PP +The following flags apply to these fields: +.RS 0.4i +.TP +.B XFS_BS_SICK_INODE +The inode's record itself. +.TP +.B XFS_BS_SICK_BMBTD +File data extent mappings. +.TP +.B XFS_BS_SICK_BMBTA +Extended attribute extent mappings. +.TP +.B XFS_BS_SICK_BMBTC +Copy on Write staging extent mappings. +.TP +.B XFS_BS_SICK_DIR +Directory information. +.TP +.B XFS_BS_SICK_XATTR +Extended attribute data. +.TP +.B XFS_BS_SICK_SYMLINK +Symbolic link target. +.TP +.B XFS_BS_SICK_PARENT +Parent pointers. +.RE .SH RETURN VALUE On error, \-1 is returned, and .I errno diff --git a/man/man2/ioctl_xfs_fsop_geometry.2 b/man/man2/ioctl_xfs_fsop_geometry.2 index 365bda8b..a35bbaeb 100644 --- a/man/man2/ioctl_xfs_fsop_geometry.2 +++ b/man/man2/ioctl_xfs_fsop_geometry.2 @@ -47,7 +47,9 @@ struct xfs_fsop_geom { __u32 logsunit; /* struct xfs_fsop_geom_v4 stops here. */ - __u64 reserved[18]; + __u32 sick; + __u32 checked; + __u64 reserved[17]; }; .fi .in @@ -130,6 +132,13 @@ This field is meaningful only if the flag .B XFS_FSOP_GEOM_FLAGS_LOGV2 is set. .PP +The fields +.IR sick " and " checked +indicate the relative health of various whole-filesystem metadata. +Please see the section +.B XFS METADATA HEALTH REPORTING +for more details. +.PP .I reserved is set to zero. .SH FILESYSTEM FEATURE FLAGS @@ -203,6 +212,51 @@ Filesystem stores reverse mappings of blocks to owners. .B XFS_FSOP_GEOM_FLAGS_REFLINK Filesystem supports sharing blocks between files. .RE +.SH XFS METADATA HEALTH REPORTING +.PP +The online filesystem checking utility scans metadata and records what it +finds in the kernel incore state. +The following scheme is used for userspace to read the incore health status +of the filesystem: + +.IP \[bu] 2 +If a given sick flag is set in +.IR sick , +then that piece of metadata has been observed to be damaged. +The same bit should be set in +.IR checked . +.IP \[bu] +If a given sick flag is set in +.I checked +but is not set in +.IR sick , +then that piece of metadata has been checked and is not faulty. +.IP \[bu] +If a given sick flag is not set in +.IR checked , +then no conclusion can be made. +.PP +The following flags apply to these fields: +.RS 0.4i +.TP +.B XFS_FSOP_GEOM_SICK_COUNTERS +Inode and space summary counters. +.TP +.B XFS_FSOP_GEOM_SICK_UQUOTA +User quota information. +.TP +.B XFS_FSOP_GEOM_SICK_GQUOTA +Group quota information. +.TP +.B XFS_FSOP_GEOM_SICK_PQUOTA +Project quota information. +.TP +.B XFS_FSOP_GEOM_SICK_RT_BITMAP +Free space bitmap for the realtime device. +.TP +.B XFS_FSOP_GEOM_SICK_RT_SUMMARY +Free space summary for the realtime device. +.RE .SH RETURN VALUE On error, \-1 is returned, and From patchwork Tue Aug 20 20:32:00 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: 11104661 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 2E14B1805 for ; Tue, 20 Aug 2019 20:32:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BFE322DD3 for ; Tue, 20 Aug 2019 20:32:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="aieiT1Te" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730501AbfHTUcK (ORCPT ); Tue, 20 Aug 2019 16:32:10 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46602 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730728AbfHTUcJ (ORCPT ); Tue, 20 Aug 2019 16:32:09 -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 x7KKSwWq151487; Tue, 20 Aug 2019 20:32:08 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=M0cHfUb71N8ECjgb3Km3UFRTxw3bWthiqzd/BgJUMtU=; b=aieiT1TeDjPwlAx023KouzoycDpJ79PtMyp04w/JDKgFLFzPwljy7Zfjmk0LCwrX/2wf 76Jbe6MswoT7UWCmRwyc88PQgi1NEpmSmFrdNLp5fPadTbWrCyEcBhMDgCjpUe1Umid7 Xv4xHW0JcPueb27b7hJS8rEg5/ssQ1v9loxlAB7mPyGQ9Ned9INE4xqg0P0yeZX5NQtG VLZ+HW792MVDqIJfCF+lScK+0r6PsjwpKqW4M3puRvDVlG/K4OjV4fUd8dHvr75Azg4m kXTAsyaHCCScpO5eXCNz/IAihrFfVPxLop8TsHAH5QoGd1Zze+JofY7/rAgakrh1GWRR nw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2ue90th611-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:08 +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 x7KKTM1T191285; Tue, 20 Aug 2019 20:32:07 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2ugj7p4swt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:07 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7KKW5GH021765; Tue, 20 Aug 2019 20:32:05 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:32:05 -0700 Subject: [PATCH 08/12] xfs_db: remove db/convert.h From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:32:00 -0700 Message-ID: <156633312041.1215978.17289300639793819044.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong db/convert.h conflicts with include/convert.h and since the former only has one declaration in it anyway, just get rid of it. We'll need this in the next patch to avoid an ugly include mess. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- db/Makefile | 4 ++-- db/command.c | 1 - db/command.h | 1 + db/convert.c | 1 - db/convert.h | 7 ------- 5 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 db/convert.h diff --git a/db/Makefile b/db/Makefile index 8fecfc1c..0941b32e 100644 --- a/db/Makefile +++ b/db/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/include/builddefs LTCOMMAND = xfs_db HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \ - btblock.h bmroot.h check.h command.h convert.h crc.h debug.h \ + btblock.h bmroot.h check.h command.h crc.h debug.h \ dir2.h dir2sf.h dquot.h echo.h faddr.h field.h \ flist.h fprint.h frag.h freesp.h hash.h help.h init.h inode.h input.h \ io.h logformat.h malloc.h metadump.h output.h print.h quit.h sb.h \ sig.h strvec.h text.h type.h write.h attrset.h symlink.h fsmap.h \ fuzz.h -CFILES = $(HFILES:.h=.c) btdump.c info.c +CFILES = $(HFILES:.h=.c) btdump.c convert.c info.c LSRCFILES = xfs_admin.sh xfs_ncheck.sh xfs_metadump.sh LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) diff --git a/db/command.c b/db/command.c index c7c52342..89a78f03 100644 --- a/db/command.c +++ b/db/command.c @@ -11,7 +11,6 @@ #include "bmap.h" #include "check.h" #include "command.h" -#include "convert.h" #include "debug.h" #include "type.h" #include "echo.h" diff --git a/db/command.h b/db/command.h index eacfd465..2f9a7e16 100644 --- a/db/command.h +++ b/db/command.h @@ -28,5 +28,6 @@ extern int command(int argc, char **argv); extern const cmdinfo_t *find_command(const char *cmd); extern void init_commands(void); +extern void convert_init(void); extern void btdump_init(void); extern void info_init(void); diff --git a/db/convert.c b/db/convert.c index 01a08823..e1466057 100644 --- a/db/convert.c +++ b/db/convert.c @@ -6,7 +6,6 @@ #include "libxfs.h" #include "command.h" -#include "convert.h" #include "output.h" #include "init.h" diff --git a/db/convert.h b/db/convert.h deleted file mode 100644 index 3660cabe..00000000 --- a/db/convert.h +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. - * All Rights Reserved. - */ - -extern void convert_init(void); From patchwork Tue Aug 20 20:32:10 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: 11104663 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 791A9174A for ; Tue, 20 Aug 2019 20:32:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D6442332A for ; Tue, 20 Aug 2019 20:32:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="i5WgADSz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729156AbfHTUcQ (ORCPT ); Tue, 20 Aug 2019 16:32:16 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46714 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730728AbfHTUcP (ORCPT ); Tue, 20 Aug 2019 16:32: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 x7KKSric151457; Tue, 20 Aug 2019 20:32: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=wog+cFbL5oKh4niuE7bSQbTc7XNeTbxBJ2Xeuq71UA0=; b=i5WgADSzGH/B67B4j5xpqUMcGkeuHjkUmdsoOitjBcBB4Mrf+5ypoAkGvX5B/TWjY6hC kroAq9nlE0XLyk9i5Zvpd/c7F/G+avAFS8TOmgvPJHzpAf62tfOUsSsrSjrPvdbml5LE Go3RmJbqwbYHQ/9ecQxZQQWNkBDkoby0/zPIALZgjqsudfs1e6W58Z4RVzBBztqkx4CY ts/c1mrcN5ay0Z9B5HrGT2HL/6eyWscjayQPDv3bSEgY1RqBH+wqcKCdelufAJjz/vzz WECJMqLnakvSS181RVvfxHmrSbmZ47YVJSQuWK62wWRaOadBj/WX3wI9pbKhNV/NvuaK Gw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2ue90th61r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:13 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7KKTTwO104777; Tue, 20 Aug 2019 20:32:12 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2ug26964h1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:12 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7KKWC0C028737; Tue, 20 Aug 2019 20:32:12 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:32:11 -0700 Subject: [PATCH 09/12] xfs_db: add a function to compute btree geometry From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:32:10 -0700 Message-ID: <156633313068.1215978.9122974606185866859.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Add a new command to xfs_db that uses a btree type and a record count to report the best and worst case height and level size. This can be used to estimate how overhead a metadata index will add to a filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- db/Makefile | 2 db/btheight.c | 308 ++++++++++++++++++++++++++++++++++++++++++++++ db/command.c | 1 db/command.h | 1 libxfs/libxfs_api_defs.h | 2 5 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 db/btheight.c diff --git a/db/Makefile b/db/Makefile index 0941b32e..ed9f56c2 100644 --- a/db/Makefile +++ b/db/Makefile @@ -14,7 +14,7 @@ HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \ io.h logformat.h malloc.h metadump.h output.h print.h quit.h sb.h \ sig.h strvec.h text.h type.h write.h attrset.h symlink.h fsmap.h \ fuzz.h -CFILES = $(HFILES:.h=.c) btdump.c convert.c info.c +CFILES = $(HFILES:.h=.c) btdump.c btheight.c convert.c info.c LSRCFILES = xfs_admin.sh xfs_ncheck.sh xfs_metadump.sh LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) diff --git a/db/btheight.c b/db/btheight.c new file mode 100644 index 00000000..1b53bf61 --- /dev/null +++ b/db/btheight.c @@ -0,0 +1,308 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Oracle. All Rights Reserved. + * Author: Darrick J. Wong + */ +#include "libxfs.h" +#include "command.h" +#include "output.h" +#include "init.h" +#include "io.h" +#include "type.h" +#include "input.h" +#include "convert.h" + +static int refc_maxrecs(struct xfs_mount *mp, int blocklen, int leaf) +{ + return libxfs_refcountbt_maxrecs(blocklen, leaf != 0); +} + +static int rmap_maxrecs(struct xfs_mount *mp, int blocklen, int leaf) +{ + return libxfs_rmapbt_maxrecs(blocklen, leaf); +} + +struct btmap { + const char *tag; + int (*maxrecs)(struct xfs_mount *mp, int blocklen, + int leaf); +} maps[] = { + {"bnobt", libxfs_allocbt_maxrecs}, + {"cntbt", libxfs_allocbt_maxrecs}, + {"inobt", libxfs_inobt_maxrecs}, + {"finobt", libxfs_inobt_maxrecs}, + {"bmapbt", libxfs_bmbt_maxrecs}, + {"refcountbt", refc_maxrecs}, + {"rmapbt", rmap_maxrecs}, +}; + +static void +btheight_help(void) +{ + struct btmap *m; + int i; + + dbprintf(_( +"\n" +" For a given number of btree records and a btree type, report the number of\n" +" records and blocks for each level of the btree, and the total btree size.\n" +" The btree type must be given after the options. A raw btree geometry can\n" +" be provided in the format \"record_bytes:key_bytes:ptr_bytes:header_type\"\n" +" where header_type is one of \"short\", \"long\", \"shortcrc\", or \"longcrc\".\n" +"\n" +" Options:\n" +" -b -- Override the btree block size.\n" +" -n -- Number of records we want to store.\n" +" -w max -- Show only the best case scenario.\n" +" -w min -- Show only the worst case scenario.\n" +"\n" +" Supported btree types:\n" +" " +)); + for (i = 0, m = maps; i < ARRAY_SIZE(maps); i++, m++) + printf("%s ", m->tag); + printf("\n"); +} + +static void +calc_height( + unsigned long long nr_records, + uint *records_per_block) +{ + unsigned int level = 0; + unsigned long long total_blocks = 0; + unsigned long long blocks; + char *levels_suffix = "s"; + char *totblocks_suffix = "s"; + + while (nr_records) { + unsigned int level_rpb = records_per_block[level != 0]; + char *recs_suffix = "s"; + char *blocks_suffix = "s"; + + blocks = (nr_records + level_rpb - 1) / level_rpb; + + if (nr_records == 1) + recs_suffix = ""; + if (blocks == 1) + blocks_suffix = ""; + + printf(_("level %u: %llu record%s, %llu block%s\n"), + level, nr_records, recs_suffix, blocks, + blocks_suffix); + + total_blocks += blocks; + nr_records = blocks == 1 ? 0 : blocks; + level++; + } + + if (level == 1) + levels_suffix = ""; + if (total_blocks == 1) + totblocks_suffix = ""; + + printf(_("%u level%s, %llu block%s total\n"), level, levels_suffix, + total_blocks, totblocks_suffix); +} + +static int +construct_records_per_block( + char *tag, + int blocksize, + unsigned int *records_per_block) +{ + char *toktag; + struct btmap *m; + unsigned int record_size, key_size, ptr_size; + char *p; + int i, ret; + + for (i = 0, m = maps; i < ARRAY_SIZE(maps); i++, m++) { + if (!strcmp(m->tag, tag)) { + records_per_block[0] = m->maxrecs(mp, blocksize, 1); + records_per_block[1] = m->maxrecs(mp, blocksize, 0); + return 0; + } + } + + toktag = strdup(tag); + ret = -1; + + p = strtok(toktag, ":"); + if (!p) { + fprintf(stderr, _("%s: record size not found.\n"), tag); + goto out; + } + record_size = cvt_u16(p, 0); + if (errno) { + perror(p); + goto out; + } + + p = strtok(NULL, ":"); + if (!p) { + fprintf(stderr, _("%s: key size not found.\n"), tag); + goto out; + } + key_size = cvt_u16(p, 0); + if (errno) { + perror(p); + goto out; + } + + p = strtok(NULL, ":"); + if (!p) { + fprintf(stderr, _("%s: pointer size not found.\n"), tag); + goto out; + } + ptr_size = cvt_u16(p, 0); + if (errno) { + perror(p); + goto out; + } + + p = strtok(NULL, ":"); + if (!p) { + fprintf(stderr, _("%s: header type not found.\n"), tag); + goto out; + } + if (!strcmp(p, "short")) + blocksize -= XFS_BTREE_SBLOCK_LEN; + else if (!strcmp(p, "shortcrc")) + blocksize -= XFS_BTREE_SBLOCK_CRC_LEN; + else if (!strcmp(p, "long")) + blocksize -= XFS_BTREE_LBLOCK_LEN; + else if (!strcmp(p, "longcrc")) + blocksize -= XFS_BTREE_LBLOCK_CRC_LEN; + else { + fprintf(stderr, _("%s: unrecognized btree header type."), + p); + goto out; + } + + p = strtok(NULL, ":"); + if (p) { + fprintf(stderr, + _("%s: unrecognized raw btree geometry."), + tag); + goto out; + } + + records_per_block[0] = blocksize / record_size; + records_per_block[1] = blocksize / (key_size + ptr_size); + ret = 0; +out: + free(toktag); + return ret; +} + +#define REPORT_DEFAULT (-1U) +#define REPORT_MAX (1 << 0) +#define REPORT_MIN (1 << 1) + +static void +report( + char *tag, + unsigned int report_what, + unsigned long long nr_records, + unsigned int blocksize) +{ + unsigned int records_per_block[2]; + int ret; + + ret = construct_records_per_block(tag, blocksize, records_per_block); + if (ret) { + printf(_("%s: Unable to determine records per block.\n"), + tag); + return; + } + + if (report_what & REPORT_MAX) { + printf( +_("%s: best case per %u-byte block: %u records (leaf) / %u keyptrs (node)\n"), + tag, blocksize, records_per_block[0], + records_per_block[1]); + + calc_height(nr_records, records_per_block); + } + + if (report_what & REPORT_MIN) { + records_per_block[0] /= 2; + records_per_block[1] /= 2; + + printf( +_("%s: worst case per %u-byte block: %u records (leaf) / %u keyptrs (node)\n"), + tag, blocksize, records_per_block[0], + records_per_block[1]); + + calc_height(nr_records, records_per_block); + } +} + +static int +btheight_f( + int argc, + char **argv) +{ + long long blocksize = mp->m_sb.sb_blocksize; + uint64_t nr_records = 0; + int report_what = REPORT_DEFAULT; + int i, c; + + while ((c = getopt(argc, argv, "b:n:w:")) != -1) { + switch (c) { + case 'b': + errno = 0; + blocksize = cvtnum(mp->m_sb.sb_blocksize, + mp->m_sb.sb_sectsize, + optarg); + if (errno) { + perror(optarg); + return 0; + } + break; + case 'n': + nr_records = cvt_u64(optarg, 0); + if (errno) { + perror(optarg); + return 0; + } + break; + case 'w': + if (!strcmp(optarg, "min")) + report_what = REPORT_MIN; + else if (!strcmp(optarg, "max")) + report_what = REPORT_MAX; + else { + btheight_help(); + return 0; + } + break; + default: + btheight_help(); + return 0; + } + } + + if (argc == optind || blocksize <= 0 || blocksize > INT_MAX || + nr_records == 0) { + btheight_help(); + return 0; + } + + for (i = optind; i < argc; i++) + report(argv[i], report_what, nr_records, blocksize); + + return 0; +} + +static const cmdinfo_t btheight_cmd = + { "btheight", "b", btheight_f, 1, -1, 0, + "[-b blksz] [-n recs] [-w max|-w min] btree types...", + N_("compute btree heights"), btheight_help }; + +void +btheight_init(void) +{ + add_command(&btheight_cmd); +} diff --git a/db/command.c b/db/command.c index 89a78f03..0fb44efa 100644 --- a/db/command.c +++ b/db/command.c @@ -113,6 +113,7 @@ init_commands(void) block_init(); bmap_init(); btdump_init(); + btheight_init(); check_init(); convert_init(); crc_init(); diff --git a/db/command.h b/db/command.h index 2f9a7e16..b8499de0 100644 --- a/db/command.h +++ b/db/command.h @@ -31,3 +31,4 @@ extern void init_commands(void); extern void convert_init(void); extern void btdump_init(void); extern void info_init(void); +extern void btheight_init(void); diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 7bd373f7..0ae21318 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -125,6 +125,8 @@ #define xfs_dir_ino_validate libxfs_dir_ino_validate #define xfs_initialize_perag_data libxfs_initialize_perag_data #define xfs_inobt_maxrecs libxfs_inobt_maxrecs +#define xfs_rmapbt_maxrecs libxfs_rmapbt_maxrecs +#define xfs_refcountbt_maxrecs libxfs_refcountbt_maxrecs #define xfs_iread_extents libxfs_iread_extents #define xfs_log_calc_minimum_size libxfs_log_calc_minimum_size #define xfs_perag_get libxfs_perag_get From patchwork Tue Aug 20 20:32: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: 11104665 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 368B9174A for ; Tue, 20 Aug 2019 20:32:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 145DF2332A for ; Tue, 20 Aug 2019 20:32:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="FwUZYNgB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730865AbfHTUcV (ORCPT ); Tue, 20 Aug 2019 16:32:21 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:43994 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730863AbfHTUcV (ORCPT ); Tue, 20 Aug 2019 16:32:21 -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 x7KKTM8C166384; Tue, 20 Aug 2019 20:32:19 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=W+eyDiduH01AuRlKvJoDJWjH3iqVWD+QgIZFQD+V264=; b=FwUZYNgB3satGwFu4iGNtx5GJlaLyH3v6cg35H+vNcLp94t+AUkQ8PrgfBOxyNpwLgqv WaApDGZT3RPCcUkw5wC5aqngPgv5YmwsRcW+oVk7EGTxWBkByLibQi4Z/+pDJw2/6xYW FSJJuXBlK5Q4np0xz3TrMCJWhSqDLkzJn1xLkKjip1V+c+OZnhqEU9G91TM5l1eb40IR 43AZamecqBwgNSNRilFKSGj6oRMeNk03OLKzprSxGhLx4VqWp3KdtJGaQYAgPzU0lZjs H8C4Ii6j3LWEx3DtSTWThe16kjBadoUaQhs9RtQxvf4ZATxGtKSDYhoGWbxfteRzKC7K TQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2uea7qs0pb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32: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 x7KKSpiT160338; Tue, 20 Aug 2019 20:32:18 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2ug1g9rkxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:18 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7KKWIgS021953; Tue, 20 Aug 2019 20:32:18 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:32:17 -0700 Subject: [PATCH 10/12] xfs_db: use precomputed inode geometry values From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:32:17 -0700 Message-ID: <156633313698.1215978.12801273719077418862.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Use the precomputed inode geometry values instead of open-coding them. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- db/inode.c | 8 +++----- repair/dinode.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/db/inode.c b/db/inode.c index 73dd118d..d8d69ffb 100644 --- a/db/inode.c +++ b/db/inode.c @@ -657,16 +657,14 @@ set_cur_inode( igeo->inoalign_mask) { xfs_agblock_t chunk_agbno; xfs_agblock_t offset_agbno; - int blks_per_cluster; - blks_per_cluster = igeo->inode_cluster_size >> - mp->m_sb.sb_blocklog; offset_agbno = agbno & igeo->inoalign_mask; chunk_agbno = agbno - offset_agbno; cluster_agbno = chunk_agbno + - ((offset_agbno / blks_per_cluster) * blks_per_cluster); + ((offset_agbno / M_IGEO(mp)->blocks_per_cluster) * + M_IGEO(mp)->blocks_per_cluster); offset += ((agbno - cluster_agbno) * mp->m_sb.sb_inopblock); - numblks = XFS_FSB_TO_BB(mp, blks_per_cluster); + numblks = XFS_FSB_TO_BB(mp, M_IGEO(mp)->blocks_per_cluster); } else cluster_agbno = agbno; diff --git a/repair/dinode.c b/repair/dinode.c index 56992dd2..f5e88cc3 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -768,7 +768,7 @@ get_agino_buf( * we must find the buffer for its cluster, add the appropriate * offset, and return that. */ - cluster_size = max(igeo->inode_cluster_size, mp->m_sb.sb_blocksize); + cluster_size = igeo->inode_cluster_size; ino_per_cluster = cluster_size / mp->m_sb.sb_inodesize; cluster_agino = agino & ~(ino_per_cluster - 1); cluster_blks = XFS_FSB_TO_DADDR(mp, max(1, From patchwork Tue Aug 20 20:32: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: 11104667 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 439251395 for ; Tue, 20 Aug 2019 20:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 172602332A for ; Tue, 20 Aug 2019 20:32:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TmYjBxuG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730866AbfHTUc2 (ORCPT ); Tue, 20 Aug 2019 16:32:28 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:44128 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730863AbfHTUc2 (ORCPT ); Tue, 20 Aug 2019 16:32:28 -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 x7KKT3na166002; Tue, 20 Aug 2019 20:32:26 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=SHEoy7oPgn6ddDFcx8nhGHAFDMTQratD9PLk8yIwi2U=; b=TmYjBxuGVSfZVClnuqN3erkb5+YnWsZhxjEBLSkViNrt7awwudLL09gj0/11wkB9pRG+ On95avMaK3czHvHh2QyV1eiNCm3gyp097T1piT2wbptAd99Tcw7xD7aGMomPCRhK9sLj O2OJpsZPIQ4+e77WCS8m/akoGFjSIBCFGZAQIPTNQ45xU433R32DOa+/vtfY9OTAHNHS krDXdCu7fjdqCUpmbqP5mbVnDn+ALSGzoIPPd2XKA/qIOcat05y5in97TqjSXNg/s2Zi nEBfivRim5UIZ/XlgwnPVOQ0p5jRmL4xwh4wQelqhkxHKCeYoFmEUfsMQ0YiMQA2s6lM 6g== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2uea7qs0qe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:26 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7KKTBBU071245; Tue, 20 Aug 2019 20:32:25 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2ugj7pnfgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:25 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x7KKWOaT021984; Tue, 20 Aug 2019 20:32:24 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:32:23 -0700 Subject: [PATCH 11/12] xfs_repair: use precomputed inode geometry values From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:32:23 -0700 Message-ID: <156633314305.1215978.18190917724979571824.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Use the precomputed inode geometry values instead of open-coding them. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- repair/dino_chunks.c | 22 +++++++++++----------- repair/dinode.c | 13 ++++--------- repair/globals.c | 1 - repair/globals.h | 1 - repair/prefetch.c | 21 ++++++++------------- repair/xfs_repair.c | 2 -- 6 files changed, 23 insertions(+), 37 deletions(-) diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c index 323a355e..00b67468 100644 --- a/repair/dino_chunks.c +++ b/repair/dino_chunks.c @@ -608,7 +608,6 @@ process_inode_chunk( xfs_ino_t ino; int dirty = 0; int isa_dir = 0; - int blks_per_cluster; int cluster_count; int bp_index; int cluster_offset; @@ -620,10 +619,7 @@ process_inode_chunk( *bogus = 0; ASSERT(igeo->ialloc_blks > 0); - blks_per_cluster = M_IGEO(mp)->inode_cluster_size >> mp->m_sb.sb_blocklog; - if (blks_per_cluster == 0) - blks_per_cluster = 1; - cluster_count = XFS_INODES_PER_CHUNK / inodes_per_cluster; + cluster_count = XFS_INODES_PER_CHUNK / M_IGEO(mp)->inodes_per_cluster; if (cluster_count == 0) cluster_count = 1; @@ -662,13 +658,16 @@ process_inode_chunk( bplist[bp_index] = libxfs_readbuf(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), - XFS_FSB_TO_BB(mp, blks_per_cluster), 0, + XFS_FSB_TO_BB(mp, + M_IGEO(mp)->blocks_per_cluster), + 0, &xfs_inode_buf_ops); if (!bplist[bp_index]) { do_warn(_("cannot read inode %" PRIu64 ", disk block %" PRId64 ", cnt %d\n"), XFS_AGINO_TO_INO(mp, agno, first_irec->ino_startnum), XFS_AGB_TO_DADDR(mp, agno, agbno), - XFS_FSB_TO_BB(mp, blks_per_cluster)); + XFS_FSB_TO_BB(mp, + M_IGEO(mp)->blocks_per_cluster)); while (bp_index > 0) { bp_index--; libxfs_putbuf(bplist[bp_index]); @@ -684,8 +683,9 @@ process_inode_chunk( bplist[bp_index]->b_ops = &xfs_inode_buf_ops; next_readbuf: - irec_offset += mp->m_sb.sb_inopblock * blks_per_cluster; - agbno += blks_per_cluster; + irec_offset += mp->m_sb.sb_inopblock * + M_IGEO(mp)->blocks_per_cluster; + agbno += M_IGEO(mp)->blocks_per_cluster; } agbno = XFS_AGINO_TO_AGBNO(mp, first_irec->ino_startnum); @@ -745,7 +745,7 @@ process_inode_chunk( ASSERT(ino_rec->ino_startnum == agino + 1); irec_offset = 0; } - if (cluster_offset == inodes_per_cluster) { + if (cluster_offset == M_IGEO(mp)->inodes_per_cluster) { bp_index++; cluster_offset = 0; } @@ -964,7 +964,7 @@ process_inode_chunk( ASSERT(ino_rec->ino_startnum == agino + 1); irec_offset = 0; } - if (cluster_offset == inodes_per_cluster) { + if (cluster_offset == M_IGEO(mp)->inodes_per_cluster) { bp_index++; cluster_offset = 0; } diff --git a/repair/dinode.c b/repair/dinode.c index f5e88cc3..8af2cb25 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -755,8 +755,6 @@ get_agino_buf( struct xfs_dinode **dipp) { struct xfs_buf *bp; - int cluster_size; - int ino_per_cluster; xfs_agino_t cluster_agino; xfs_daddr_t cluster_daddr; xfs_daddr_t cluster_blks; @@ -768,18 +766,15 @@ get_agino_buf( * we must find the buffer for its cluster, add the appropriate * offset, and return that. */ - cluster_size = igeo->inode_cluster_size; - ino_per_cluster = cluster_size / mp->m_sb.sb_inodesize; - cluster_agino = agino & ~(ino_per_cluster - 1); - cluster_blks = XFS_FSB_TO_DADDR(mp, max(1, - igeo->inode_cluster_size >> mp->m_sb.sb_blocklog)); + cluster_agino = agino & ~(igeo->inodes_per_cluster - 1); + cluster_blks = XFS_FSB_TO_DADDR(mp, igeo->blocks_per_cluster); cluster_daddr = XFS_AGB_TO_DADDR(mp, agno, XFS_AGINO_TO_AGBNO(mp, cluster_agino)); #ifdef XR_INODE_TRACE printf("cluster_size %d ipc %d clusagino %d daddr %lld sectors %lld\n", - cluster_size, ino_per_cluster, cluster_agino, cluster_daddr, - cluster_blks); + M_IGEO(mp)->inode_cluster_size, M_IGEO(mp)->inodes_per_cluster, + cluster_agino, cluster_daddr, cluster_blks); #endif bp = libxfs_readbuf(mp->m_dev, cluster_daddr, cluster_blks, diff --git a/repair/globals.c b/repair/globals.c index ae9d55b4..dcd79ea4 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -81,7 +81,6 @@ xfs_agblock_t inobt_root; /* configuration vars -- fs geometry dependent */ int inodes_per_block; -int inodes_per_cluster; unsigned int glob_agcount; int chunks_pblock; /* # of 64-ino chunks per allocation */ int max_symlink_blocks; diff --git a/repair/globals.h b/repair/globals.h index 05121d4f..008bdd90 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -122,7 +122,6 @@ extern xfs_agblock_t inobt_root; /* configuration vars -- fs geometry dependent */ extern int inodes_per_block; -extern int inodes_per_cluster; extern unsigned int glob_agcount; extern int chunks_pblock; /* # of 64-ino chunks per allocation */ extern int max_symlink_blocks; diff --git a/repair/prefetch.c b/repair/prefetch.c index 2fecfd68..5a725a51 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -710,17 +710,12 @@ pf_queuing_worker( int num_inos; ino_tree_node_t *irec; ino_tree_node_t *cur_irec; - int blks_per_cluster; xfs_agblock_t bno; int i; int err; uint64_t sparse; struct xfs_ino_geometry *igeo = M_IGEO(mp); - blks_per_cluster = igeo->inode_cluster_size >> mp->m_sb.sb_blocklog; - if (blks_per_cluster == 0) - blks_per_cluster = 1; - for (i = 0; i < PF_THREAD_COUNT; i++) { err = pthread_create(&args->io_threads[i], NULL, pf_io_worker, args); @@ -786,21 +781,22 @@ pf_queuing_worker( struct xfs_buf_map map; map.bm_bn = XFS_AGB_TO_DADDR(mp, args->agno, bno); - map.bm_len = XFS_FSB_TO_BB(mp, blks_per_cluster); + map.bm_len = XFS_FSB_TO_BB(mp, + M_IGEO(mp)->blocks_per_cluster); /* * Queue I/O for each non-sparse cluster. We can check * sparse state in cluster sized chunks as cluster size * is the min. granularity of sparse irec regions. */ - if ((sparse & ((1ULL << inodes_per_cluster) - 1)) == 0) + if ((sparse & ((1ULL << M_IGEO(mp)->inodes_per_cluster) - 1)) == 0) pf_queue_io(args, &map, 1, (cur_irec->ino_isa_dir != 0) ? B_DIR_INODE : B_INODE); - bno += blks_per_cluster; - num_inos += inodes_per_cluster; - sparse >>= inodes_per_cluster; + bno += igeo->blocks_per_cluster; + num_inos += igeo->inodes_per_cluster; + sparse >>= igeo->inodes_per_cluster; } while (num_inos < igeo->ialloc_inos); } @@ -903,9 +899,8 @@ start_inode_prefetch( max_queue = libxfs_bcache->c_maxcount / thread_count / 8; if (igeo->inode_cluster_size > mp->m_sb.sb_blocksize) - max_queue = max_queue * - (igeo->inode_cluster_size >> mp->m_sb.sb_blocklog) / - igeo->ialloc_blks; + max_queue = max_queue * igeo->blocks_per_cluster / + igeo->ialloc_blks; sem_init(&args->ra_count, 0, max_queue); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 9f4f2611..c7f3bfbc 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -762,8 +762,6 @@ main(int argc, char **argv) chunks_pblock = mp->m_sb.sb_inopblock / XFS_INODES_PER_CHUNK; max_symlink_blocks = libxfs_symlink_blocks(mp, XFS_SYMLINK_MAXLEN); - inodes_per_cluster = max(mp->m_sb.sb_inopblock, - igeo->inode_cluster_size >> mp->m_sb.sb_inodelog); /* * Automatic striding for high agcount filesystems. From patchwork Tue Aug 20 20:32:29 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: 11104669 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 A2617174A for ; Tue, 20 Aug 2019 20:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 806C62339D for ; Tue, 20 Aug 2019 20:32:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="nTDjNckD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729887AbfHTUcg (ORCPT ); Tue, 20 Aug 2019 16:32:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47154 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730515AbfHTUcg (ORCPT ); Tue, 20 Aug 2019 16:32:36 -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 x7KKSxph151519; Tue, 20 Aug 2019 20:32:33 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=MLs7H2u33k8VmQo9Y5sKrHWtGbqSBXkQPe/govj4MiM=; b=nTDjNckDBv9tYLji02wFHvYIDNHOtbb+EoS/eDRXHhbbVgiHNVZNGTR0cPeBsVU/57jN URIEPY3XROekePxgxSL0mC43s5hzN39oi5Ne/RbEKrenYB4C1+IsjOeg20ks/z1vmLJo cmytokB9mfNaap+seVIM4Tt7OgPzSkzBDEy+O1bihTWHvggIiQ/Rqaq6IcsWLrLXdcXb Pa/6SIGEBuaHaIZufKsgt6HCVNPrr/rErNyHujrfodU7F9vIaWWRTlkeGWJsFS38lht6 Y8bwxgpSSFpvlymddoGunGMTkb3bEGpwuP1MpnErhVNKMw1ZzTQ4FMZxDTIf2yr2a0yJ qA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2ue90th64e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:33 +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 x7KKTLtc191234; Tue, 20 Aug 2019 20:32:33 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2ugj7p4t8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2019 20:32:32 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7KKWVgZ028840; Tue, 20 Aug 2019 20:32:31 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Aug 2019 13:32:31 -0700 Subject: [PATCH 12/12] xfs_repair: reduce the amount of "clearing reflink flag" messages From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 20 Aug 2019 13:32:29 -0700 Message-ID: <156633314915.1215978.1191691824699956900.stgit@magnolia> In-Reply-To: <156633307176.1215978.17394956977918540525.stgit@magnolia> References: <156633307176.1215978.17394956977918540525.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 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-1906280000 definitions=main-1908200183 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Clearing the reflink flag on files that don't share blocks is an optimization, not a repair, so it's not critical to log a message every single time we clear a flag. Only log one message that we're clearing these flags unless verbose mode is enabled. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner --- repair/rmap.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/repair/rmap.c b/repair/rmap.c index 47828a06..24251e9f 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -1170,6 +1170,36 @@ record_inode_reflink_flag( (unsigned long long)lino, (unsigned long long)irec->ino_was_rl); } +/* + * Inform the user that we're clearing the reflink flag on an inode that + * doesn't actually share any blocks. This is an optimization (the kernel + * skips refcount checks for non-reflink files) and not a corruption repair, + * so we don't need to log every time we clear a flag unless verbose mode is + * enabled. + */ +static void +warn_clearing_reflink( + xfs_ino_t ino) +{ + static bool warned = false; + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + if (verbose) { + do_warn( _("clearing reflink flag on inode %"PRIu64"\n"), ino); + return; + } + + if (warned) + return; + + pthread_mutex_lock(&lock); + if (!warned) { + do_warn( _("clearing reflink flag on inodes when possible\n")); + warned = true; + } + pthread_mutex_unlock(&lock); +} + /* * Fix an inode's reflink flag. */ @@ -1188,9 +1218,7 @@ fix_inode_reflink_flag( _("setting reflink flag on inode %"PRIu64"\n"), XFS_AGINO_TO_INO(mp, agno, agino)); else if (!no_modify) /* && !set */ - do_warn( -_("clearing reflink flag on inode %"PRIu64"\n"), - XFS_AGINO_TO_INO(mp, agno, agino)); + warn_clearing_reflink(XFS_AGINO_TO_INO(mp, agno, agino)); if (no_modify) return 0;