From patchwork Thu Feb 20 01:42:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392927 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 790B892A for ; Thu, 20 Feb 2020 01:42:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 595A124671 for ; Thu, 20 Feb 2020 01:42:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="gM19Jn/r" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbgBTBmq (ORCPT ); Wed, 19 Feb 2020 20:42:46 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:48590 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgBTBmp (ORCPT ); Wed, 19 Feb 2020 20:42:45 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1c5F1039404; Thu, 20 Feb 2020 01:42:43 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-2020-01-29; bh=/EpHgLS7RqecaAx8f2BriDufl6jhoTbKwQnwmeZQQDk=; b=gM19Jn/r352OdJGzeXSt9/IXvVnqwefCxyBPK/cUKqjvFlBCpMDx5+xyhgodBwLdXI7l 2RoDt6Vwn3jNmwG60Zjb49LGq2u467hXfDCjsuizOKI/ivSd3jcVDDH2LXQKJDHB9izp GoCE4SgtMrTSh3ptaOXQBL2po2SBJEoQqqtg84UO2sI35vbz+D039vJtHu5gzeIF6PnM kVMQfVWfkJkqLayxZtxk5CCA5lDknyd5RTdKbJRvMeHFBmcJq1h3YdHCNUAZdWzJ5Ui9 i+6lciD+Ggsr+FRjAitlaJ2eg9YCOuOBLxQqjQr+GSivl2HMzSKYQgBbxlpR1VTt7Kf9 9w== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2y8ud16sa0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:42:43 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1ftpA188483; Thu, 20 Feb 2020 01:42:42 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2y8ud96yjy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:42:42 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1gfpc005971; Thu, 20 Feb 2020 01:42:41 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:42:41 -0800 Subject: [PATCH 01/18] libxfs: clean up readbuf flags From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:42:40 -0800 Message-ID: <158216296035.602314.7876331402312462299.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=952 phishscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Create a separate namespace for libxfs_readbuf() flags so that it's a little more obvious when we're trying to use the "read or die" logic. Signed-off-by: Darrick J. Wong --- libxfs/init.c | 11 ++++++++--- libxfs/libxfs_io.h | 3 +++ libxfs/rdwr.c | 4 ++-- mkfs/xfs_mkfs.c | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libxfs/init.c b/libxfs/init.c index d1d3f4df..428497f0 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -640,6 +640,7 @@ libxfs_mount( xfs_buf_t *bp; xfs_sb_t *sbp; int error; + int readflags = 0; libxfs_buftarg_init(mp, dev, logdev, rtdev); @@ -716,9 +717,13 @@ libxfs_mount( if (dev == 0) /* maxtrres, we have no device so leave now */ return mp; + /* device size checks must pass unless we're a debugger. */ + if (!(flags & LIBXFS_MOUNT_DEBUGGER)) + readflags |= LIBXFS_READBUF_FAIL_EXIT; + bp = libxfs_readbuf(mp->m_dev, d - XFS_FSS_TO_BB(mp, 1), XFS_FSS_TO_BB(mp, 1), - !(flags & LIBXFS_MOUNT_DEBUGGER), NULL); + readflags, NULL); if (!bp) { fprintf(stderr, _("%s: data size check failed\n"), progname); if (!(flags & LIBXFS_MOUNT_DEBUGGER)) @@ -733,7 +738,7 @@ libxfs_mount( (!(bp = libxfs_readbuf(mp->m_logdev_targp, d - XFS_FSB_TO_BB(mp, 1), XFS_FSB_TO_BB(mp, 1), - !(flags & LIBXFS_MOUNT_DEBUGGER), NULL))) ) { + readflags, NULL))) ) { fprintf(stderr, _("%s: log size checks failed\n"), progname); if (!(flags & LIBXFS_MOUNT_DEBUGGER)) @@ -760,7 +765,7 @@ libxfs_mount( if (sbp->sb_agcount > 1000000) { bp = libxfs_readbuf(mp->m_dev, XFS_AG_DADDR(mp, sbp->sb_agcount - 1, 0), 1, - !(flags & LIBXFS_MOUNT_DEBUGGER), NULL); + readflags, NULL); if (bp->b_error) { fprintf(stderr, _("%s: read of AG %u failed\n"), progname, sbp->sb_agcount); diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index fc0fd060..b294e659 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -124,6 +124,9 @@ extern struct cache_operations libxfs_bcache_operations; #define LIBXFS_GETBUF_TRYLOCK (1 << 0) +/* Exit on buffer read error */ +#define LIBXFS_READBUF_FAIL_EXIT (1 << 0) + #ifdef XFS_BUF_TRACING #define libxfs_readbuf(dev, daddr, len, flags, ops) \ diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 92e497f9..32619a8d 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -911,13 +911,13 @@ __read_buf(int fd, void *buf, int len, off64_t offset, int flags) int error = errno; fprintf(stderr, _("%s: read failed: %s\n"), progname, strerror(error)); - if (flags & LIBXFS_EXIT_ON_FAILURE) + if (flags & LIBXFS_READBUF_FAIL_EXIT) exit(1); return -error; } else if (sts != len) { fprintf(stderr, _("%s: error - read only %d of %d bytes\n"), progname, sts, len); - if (flags & LIBXFS_EXIT_ON_FAILURE) + if (flags & LIBXFS_READBUF_FAIL_EXIT) exit(1); return -EIO; } diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 6b182264..a57046f1 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3577,7 +3577,7 @@ rewrite_secondary_superblocks( XFS_AGB_TO_DADDR(mp, mp->m_sb.sb_agcount - 1, XFS_SB_DADDR), XFS_FSS_TO_BB(mp, 1), - LIBXFS_EXIT_ON_FAILURE, &xfs_sb_buf_ops); + LIBXFS_READBUF_FAIL_EXIT, &xfs_sb_buf_ops); XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); @@ -3589,7 +3589,7 @@ rewrite_secondary_superblocks( XFS_AGB_TO_DADDR(mp, (mp->m_sb.sb_agcount - 1) / 2, XFS_SB_DADDR), XFS_FSS_TO_BB(mp, 1), - LIBXFS_EXIT_ON_FAILURE, &xfs_sb_buf_ops); + LIBXFS_READBUF_FAIL_EXIT, &xfs_sb_buf_ops); XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); } From patchwork Thu Feb 20 01:42:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392929 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 E522392A for ; Thu, 20 Feb 2020 01:42:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD72824670 for ; Thu, 20 Feb 2020 01:42:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="v6ybztyQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgBTBmy (ORCPT ); Wed, 19 Feb 2020 20:42:54 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:44430 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgBTBmy (ORCPT ); Wed, 19 Feb 2020 20:42:54 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gqRx092773; Thu, 20 Feb 2020 01:42:52 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-2020-01-29; bh=Raedmf3cqOUyPXMftldQraaXm4KWCTPyMp8W9x/n9Hs=; b=v6ybztyQaobrTKhPtOOFiqZFhyky9mxYfcXe3Car5A2qoJEOatgenGKE6vzVBJ2phwpk TlBMglKFxyFFe5eRmdi8AY/NJbKBaJfKm1AvYJb3MSFvNZXBW1Rl7JNqBId2COaEeWr+ 1wgR9ChNHx40DXUf+U+LJM+7+IgrHJoRyy9LFVAMDqbO1g035Y+v+5phcQk3GRBC4gQp AmgCjlPsXebzzbdsVeD48wAnw3ang3/YZe/h2WXNdRbhLsUoQmMYuAZ96laE3hyl2XZY 7g9dd7+a6Sed+vcoCZiUcjNbGU3R/5GOoV+KECh1VnuZ5YTd7RoxAvbsIbQJsXrVSdad Wg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2y8udd6tct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:42:51 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1bqfe051095; Thu, 20 Feb 2020 01:42:48 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2y8ud2g2pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:42:48 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1gl2T006071; Thu, 20 Feb 2020 01:42:47 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:42:47 -0800 Subject: [PATCH 02/18] libxfs: clean up writebuf flags From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:42:46 -0800 Message-ID: <158216296640.602314.16919417617883884717.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=802 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 mlxlogscore=845 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Create an explicit namespace for writebuf flags so that we can keep the flags namespaces separate. Signed-off-by: Darrick J. Wong --- libxfs/libxfs_io.h | 3 +++ libxfs/rdwr.c | 11 +++++++++-- mkfs/proto.c | 2 +- mkfs/xfs_mkfs.c | 14 +++++++------- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index b294e659..bb6b689e 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -127,6 +127,9 @@ extern struct cache_operations libxfs_bcache_operations; /* Exit on buffer read error */ #define LIBXFS_READBUF_FAIL_EXIT (1 << 0) +/* Exit on buffer write error */ +#define LIBXFS_WRITEBUF_FAIL_EXIT (1 << 0) + #ifdef XFS_BUF_TRACING #define libxfs_readbuf(dev, daddr, len, flags, ops) \ diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 32619a8d..f56303e2 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1177,21 +1177,28 @@ libxfs_writebuf_int(xfs_buf_t *bp, int flags) } int -libxfs_writebuf(xfs_buf_t *bp, int flags) +libxfs_writebuf( + struct xfs_buf *bp, + int flags) { + int bflags = LIBXFS_B_DIRTY; + #ifdef IO_DEBUG printf("%lx: %s: dirty blkno=%llu(%llu)\n", pthread_self(), __FUNCTION__, (long long)LIBXFS_BBTOOFF64(bp->b_bn), (long long)bp->b_bn); #endif + if (flags & LIBXFS_WRITEBUF_FAIL_EXIT) + bflags |= LIBXFS_B_EXIT; + /* * Clear any error hanging over from reading the buffer. This prevents * subsequent reads after this write from seeing stale errors. */ bp->b_error = 0; bp->b_flags &= ~LIBXFS_B_STALE; - bp->b_flags |= (LIBXFS_B_DIRTY | flags); + bp->b_flags |= bflags; libxfs_putbuf(bp); return 0; } diff --git a/mkfs/proto.c b/mkfs/proto.c index 2ece593e..0025fa08 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -262,7 +262,7 @@ newfile( if (logit) libxfs_trans_log_buf(tp, bp, 0, bp->b_bcount - 1); else - libxfs_writebuf(bp, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(bp, LIBXFS_WRITEBUF_FAIL_EXIT); } ip->i_d.di_size = len; return flags; diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index a57046f1..db640a11 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3447,7 +3447,7 @@ prepare_devices( buf = libxfs_getbuf(mp->m_ddev_targp, (xi->dsize - whack_blks), whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); libxfs_purgebuf(buf); /* @@ -3458,7 +3458,7 @@ prepare_devices( */ buf = libxfs_getbuf(mp->m_ddev_targp, 0, whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); libxfs_purgebuf(buf); /* OK, now write the superblock... */ @@ -3466,7 +3466,7 @@ prepare_devices( buf->b_ops = &xfs_sb_buf_ops; memset(buf->b_addr, 0, cfg->sectorsize); libxfs_sb_to_disk(buf->b_addr, sbp); - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); libxfs_purgebuf(buf); /* ...and zero the log.... */ @@ -3486,7 +3486,7 @@ prepare_devices( XFS_FSB_TO_BB(mp, cfg->rtblocks - 1LL), BTOBB(cfg->blocksize)); memset(buf->b_addr, 0, cfg->blocksize); - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); libxfs_purgebuf(buf); } @@ -3579,7 +3579,7 @@ rewrite_secondary_superblocks( XFS_FSS_TO_BB(mp, 1), LIBXFS_READBUF_FAIL_EXIT, &xfs_sb_buf_ops); XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino); - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); /* and one in the middle for luck if there's enough AGs for that */ if (mp->m_sb.sb_agcount <= 2) @@ -3591,7 +3591,7 @@ rewrite_secondary_superblocks( XFS_FSS_TO_BB(mp, 1), LIBXFS_READBUF_FAIL_EXIT, &xfs_sb_buf_ops); XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino); - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); } static void @@ -3939,7 +3939,7 @@ main( if (!buf || buf->b_error) exit(1); (XFS_BUF_TO_SBP(buf))->sb_inprogress = 0; - libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); + libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); /* Make sure our new fs made it to stable storage. */ libxfs_flush_devices(mp, &d, &l, &r); From patchwork Thu Feb 20 01:42:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392931 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 9048A1395 for ; Thu, 20 Feb 2020 01:42:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7133224672 for ; Thu, 20 Feb 2020 01:42:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="SnEsgBfA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbgBTBm7 (ORCPT ); Wed, 19 Feb 2020 20:42:59 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:48784 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgBTBm6 (ORCPT ); Wed, 19 Feb 2020 20:42:58 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1cDje039770; Thu, 20 Feb 2020 01:42:56 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-2020-01-29; bh=3KLbsYP5GZrl6ukWotNTHuBs1Kr6fK9/fwwGm/mknjM=; b=SnEsgBfAEa32j/a/m+UiV/G4g4jPk6AveQD2BkbJfK9IV0sFPZb8InCkES3yqwahTlv3 W+86g7aA/Sgj8+JU7PBqJ5Nrce4GmXMus7Tf1OJEjkzPDHma0CbQKjgCO0K3ps6eMRhp Wz/8PRjTQxQRbnLiLN03199ddanPr7IN60sKfGHBA1MQDVR2bCl/Q2kUI2VaBISXr1R+ O7sSH2fLk6wGDRwDNd1Eos4hLgU3n+phQYh93iTm3q+N1a1fimkbhKg9oAwAlztiUDce qbzuLSnBVhNWRhjsi6ImVgJTlSVgz6T4x/KIcLEonpZARwwZ/qI/oBkd+xrZnDkItPy8 pw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2y8ud16saf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:42:56 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1g8jW188837; Thu, 20 Feb 2020 01:42:55 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2y8ud971fw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:42:55 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1gtCM002005; Thu, 20 Feb 2020 01:42:55 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:42:55 -0800 Subject: [PATCH 03/18] libxfs: remove LIBXFS_EXIT_ON_FAILURE From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:42:52 -0800 Message-ID: <158216297243.602314.7156693497979033081.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=934 phishscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=991 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 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 all the implicit users of this flag are gone, remove its definition. Signed-off-by: Darrick J. Wong --- include/libxfs.h | 1 - libxfs/libxfs_io.h | 2 +- libxfs/rdwr.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index aaac00f6..14113e56 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -126,7 +126,6 @@ typedef struct libxfs_xinit { int bcache_flags; /* cache init flags */ } libxfs_init_t; -#define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails */ #define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems */ #define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro */ #define LIBXFS_DANGEROUSLY 0x0008 /* repairing a device mounted ro */ diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index bb6b689e..560cf0fd 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -86,7 +86,7 @@ bool xfs_verify_magic(struct xfs_buf *bp, __be32 dmagic); bool xfs_verify_magic16(struct xfs_buf *bp, __be16 dmagic); /* b_flags bits */ -#define LIBXFS_B_EXIT 0x0001 /* ==LIBXFS_EXIT_ON_FAILURE */ +#define LIBXFS_B_EXIT 0x0001 /* exit if write fails */ #define LIBXFS_B_DIRTY 0x0002 /* buffer has been modified */ #define LIBXFS_B_STALE 0x0004 /* buffer marked as invalid */ #define LIBXFS_B_UPTODATE 0x0008 /* buffer is sync'd to disk */ diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index f56303e2..6a75fb12 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -19,7 +19,7 @@ #include "xfs_trans.h" #include "libfrog/platform.h" -#include "libxfs.h" /* for LIBXFS_EXIT_ON_FAILURE */ +#include "libxfs.h" /* * Important design/architecture note: From patchwork Thu Feb 20 01:43:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392933 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 6EAA71395 for ; Thu, 20 Feb 2020 01:43:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BE7824670 for ; Thu, 20 Feb 2020 01:43:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TKRqxDiq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgBTBnF (ORCPT ); Wed, 19 Feb 2020 20:43:05 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:44666 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgBTBnF (ORCPT ); Wed, 19 Feb 2020 20:43:05 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gxVt092837; Thu, 20 Feb 2020 01:43:04 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-2020-01-29; bh=n9oHOZwmc3nA8p1CwEIyBBIhNW+vsX8iORqrsmrBoIA=; b=TKRqxDiqOdxLA7uHjnyheS8td7HoLRe8yJVJ10YGABuoY5MjoeGhqQTW3X8z+bSDo7Zn qxzmsimwl6qr6xJBusd1uYssca80FsfNT23o4Xqpfi/SkdddHpGs03s6V/Ehth1Nkb/G MmXx/fTPmYdiNsmrtIl2LmallFlD6sIAM8t0FZYZdpk5DagO6UxG/vxGSrtlL+9dtS2k MoCcNIvVDw3YyfT5fVMyYBoLzZFjHmKKVieXteCBNnBJp3Exsk6DQunfdxe4CULfD8oD P+IPcqC5w1+RYZRRDez9jiyuyNHMg9gBlrs9kpdo5fweURzJK3gG7EktQoEmlD1MiIBD RQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2y8udd6td4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:03 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1h3m8190565; Thu, 20 Feb 2020 01:43:03 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2y8ud9723c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:02 +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 01K1h11F027682; Thu, 20 Feb 2020 01:43:01 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:01 -0800 Subject: [PATCH 04/18] libxfs: replace libxfs_putbuf with libxfs_buf_relse From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:00 -0800 Message-ID: <158216298043.602314.11584630332389192986.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=2 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=2 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Change all the libxfs_putbuf calls to libxfs_buf_relse to match the kernel interface, since one is a #define of the other. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- copy/xfs_copy.c | 4 ++-- db/fsmap.c | 6 +++--- db/info.c | 2 +- db/init.c | 2 +- db/io.c | 2 +- libxfs/init.c | 8 ++++---- libxfs/libxfs_api_defs.h | 1 + libxfs/libxfs_io.h | 4 ++-- libxfs/libxfs_priv.h | 1 - libxfs/rdwr.c | 14 +++++++------- libxfs/trans.c | 10 +++++----- repair/attr_repair.c | 24 ++++++++++++------------ repair/da_util.c | 22 +++++++++++----------- repair/dino_chunks.c | 8 ++++---- repair/dinode.c | 8 ++++---- repair/dir2.c | 14 +++++++------- repair/phase3.c | 2 +- repair/phase6.c | 36 ++++++++++++++++++------------------ repair/prefetch.c | 10 +++++----- repair/rmap.c | 8 ++++---- repair/rt.c | 4 ++-- repair/scan.c | 18 +++++++++--------- repair/xfs_repair.c | 2 +- 23 files changed, 105 insertions(+), 105 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index a6d67038..74dd2e23 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -716,12 +716,12 @@ main(int argc, char **argv) libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp)); /* Do it again, now with proper length and verifier */ - libxfs_putbuf(sbp); + libxfs_buf_relse(sbp); libxfs_purgebuf(sbp); sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR, 1 << (sb->sb_sectlog - BBSHIFT), 0, &xfs_sb_buf_ops); - libxfs_putbuf(sbp); + libxfs_buf_relse(sbp); mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 0); if (mp == NULL) { diff --git a/db/fsmap.c b/db/fsmap.c index 29f3827c..a6e61962 100644 --- a/db/fsmap.c +++ b/db/fsmap.c @@ -75,7 +75,7 @@ fsmap( bt_cur = libxfs_rmapbt_init_cursor(mp, NULL, agbp, agno); if (!bt_cur) { - libxfs_putbuf(agbp); + libxfs_buf_relse(agbp); dbprintf(_("Not enough memory.\n")); return; } @@ -85,14 +85,14 @@ fsmap( fsmap_fn, &info); if (error) { libxfs_btree_del_cursor(bt_cur, XFS_BTREE_ERROR); - libxfs_putbuf(agbp); + libxfs_buf_relse(agbp); dbprintf(_("Error %d while querying fsmap btree.\n"), error); return; } libxfs_btree_del_cursor(bt_cur, XFS_BTREE_NOERROR); - libxfs_putbuf(agbp); + libxfs_buf_relse(agbp); if (agno == start_ag) low.rm_startblock = 0; diff --git a/db/info.c b/db/info.c index fc5ccfe7..5c941dc4 100644 --- a/db/info.c +++ b/db/info.c @@ -89,7 +89,7 @@ print_agresv_info( length = be32_to_cpu(agf->agf_length); free = be32_to_cpu(agf->agf_freeblks) + be32_to_cpu(agf->agf_flcount); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); printf("AG %d: length: %u free: %u reserved: %u used: %u", agno, length, free, ask, used); diff --git a/db/init.c b/db/init.c index e92de232..be4a08e5 100644 --- a/db/init.c +++ b/db/init.c @@ -123,7 +123,7 @@ init( /* copy SB from buffer to in-core, converting architecture as we go */ libxfs_sb_from_disk(&xmount.m_sb, XFS_BUF_TO_SBP(bp)); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); libxfs_purgebuf(bp); sbp = &xmount.m_sb; diff --git a/db/io.c b/db/io.c index 6b66472e..a11b7bb1 100644 --- a/db/io.c +++ b/db/io.c @@ -96,7 +96,7 @@ pop_cur(void) return; } if (iocur_top->bp) { - libxfs_putbuf(iocur_top->bp); + libxfs_buf_relse(iocur_top->bp); iocur_top->bp = NULL; } if (iocur_top->bbmap) { diff --git a/libxfs/init.c b/libxfs/init.c index 428497f0..2c290428 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -445,7 +445,7 @@ rtmount_init( progname); return -1; } - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 0; } @@ -729,7 +729,7 @@ libxfs_mount( if (!(flags & LIBXFS_MOUNT_DEBUGGER)) return NULL; } else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); if (mp->m_logdev_targp->dev && mp->m_logdev_targp->dev != mp->m_ddev_targp->dev) { @@ -745,7 +745,7 @@ libxfs_mount( return NULL; } if (bp) - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } /* Initialize realtime fields in the mount structure */ @@ -775,7 +775,7 @@ libxfs_mount( progname); sbp->sb_agcount = 1; } - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } error = libxfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi); diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 1a438e58..8bca7ddf 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -44,6 +44,7 @@ #define xfs_btree_del_cursor libxfs_btree_del_cursor #define xfs_btree_init_block libxfs_btree_init_block #define xfs_buf_delwri_submit libxfs_buf_delwri_submit +#define xfs_buf_relse libxfs_buf_relse #define xfs_bunmapi libxfs_bunmapi #define xfs_calc_dquots_per_chunk libxfs_calc_dquots_per_chunk #define xfs_da3_node_hdr_from_disk libxfs_da3_node_hdr_from_disk diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 560cf0fd..704237d1 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -150,7 +150,7 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_getbuf_flags(dev, daddr, len, flags) \ libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \ (dev), (daddr), (len), (flags)) -#define libxfs_putbuf(buf) \ +#define libxfs_buf_relse(buf) \ libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int, @@ -182,7 +182,7 @@ extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, int, unsigned int); -extern void libxfs_putbuf (xfs_buf_t *); +void libxfs_buf_relse(struct xfs_buf *); #endif diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index fe08f96b..4bd3c462 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -377,7 +377,6 @@ roundup_64(uint64_t x, uint32_t y) (len) = __bar; /* no set-but-unused warning */ \ NULL; \ }) -#define xfs_buf_relse(bp) libxfs_putbuf(bp) #define xfs_buf_get(devp,blkno,len) (libxfs_getbuf((devp), (blkno), (len))) #define xfs_bwrite(bp) libxfs_writebuf((bp), 0) #define xfs_buf_oneshot(bp) ((void) 0) diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 6a75fb12..62b79bc4 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -48,7 +48,7 @@ * * The result of this is that until the userspace code outside libxfs is cleaned * up, functions that release buffers from userspace control (i.e - * libxfs_writebuf/libxfs_putbuf) need to zero bp->b_error to prevent + * libxfs_writebuf/libxfs_buf_relse) need to zero bp->b_error to prevent * propagation of stale errors into future buffer operations. */ @@ -387,7 +387,6 @@ libxfs_log_header( #undef libxfs_getbuf #undef libxfs_getbuf_map #undef libxfs_getbuf_flags -#undef libxfs_putbuf xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int, const struct xfs_buf_ops *); @@ -399,7 +398,7 @@ xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, int, unsigned int); -void libxfs_putbuf (xfs_buf_t *); +void libxfs_buf_relse(struct xfs_buf *); #define __add_trace(bp, func, file, line) \ do { \ @@ -469,7 +468,7 @@ void libxfs_trace_putbuf(const char *func, const char *file, int line, xfs_buf_t *bp) { __add_trace(bp, func, file, line); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } @@ -844,7 +843,8 @@ libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, } void -libxfs_putbuf(xfs_buf_t *bp) +libxfs_buf_relse( + struct xfs_buf *bp) { /* * ensure that any errors on this use of the buffer don't carry @@ -1199,7 +1199,7 @@ libxfs_writebuf( bp->b_error = 0; bp->b_flags &= ~LIBXFS_B_STALE; bp->b_flags |= bflags; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 0; } @@ -1529,7 +1529,7 @@ xfs_buf_delwri_submit( error2 = libxfs_writebufr(bp); if (!error) error = error2; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } return error; diff --git a/libxfs/trans.c b/libxfs/trans.c index 18b87d70..59cb897f 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -566,7 +566,7 @@ libxfs_trans_brelse( ASSERT(bp->b_transp == tp); if (!tp) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return; } @@ -602,7 +602,7 @@ libxfs_trans_brelse( xfs_buf_item_put(bip); bp->b_transp = NULL; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } /* @@ -839,7 +839,7 @@ inode_item_done( if (error) { fprintf(stderr, _("%s: warning - iflush_int failed (%d)\n"), progname, error); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto free; } @@ -868,7 +868,7 @@ buf_item_done( xfs_buf_item_put(bip); if (hold) return; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } static void @@ -906,7 +906,7 @@ buf_item_unlock( bip->bli_flags &= ~XFS_BLI_HOLD; xfs_buf_item_put(bip); if (!hold) - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } static void diff --git a/repair/attr_repair.c b/repair/attr_repair.c index 535fcfbb..ec068ba2 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -418,7 +418,7 @@ rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap, if (bp->b_error == -EFSBADCRC || bp->b_error == -EFSCORRUPTED) { do_warn( _("Corrupt remote block for attributes of inode %" PRIu64 "\n"), ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); clearit = 1; break; } @@ -430,7 +430,7 @@ rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap, amountdone += length; value += length; i++; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } return (clearit); } @@ -782,7 +782,7 @@ process_leaf_attr_level(xfs_mount_t *mp, do_warn( _("bad attribute leaf magic %#x for inode %" PRIu64 "\n"), leafhdr.magic, ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } @@ -793,7 +793,7 @@ process_leaf_attr_level(xfs_mount_t *mp, if (process_leaf_attr_block(mp, leaf, da_bno, ino, da_cursor->blkmap, current_hashval, &greatest_hashval, &repair)) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } @@ -813,7 +813,7 @@ process_leaf_attr_level(xfs_mount_t *mp, do_warn( _("bad sibling back pointer for block %u in attribute fork for inode %" PRIu64 "\n"), da_bno, ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } @@ -822,7 +822,7 @@ process_leaf_attr_level(xfs_mount_t *mp, if (da_bno != 0) { if (verify_da_path(mp, da_cursor, 0, XFS_ATTR_FORK)) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } } @@ -838,7 +838,7 @@ process_leaf_attr_level(xfs_mount_t *mp, if (repair && !no_modify) libxfs_writebuf(bp, 0); else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } while (da_bno != 0); if (verify_final_da_path(mp, da_cursor, 0, XFS_ATTR_FORK)) { @@ -992,7 +992,7 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 " if (badness) { *repair = 0; /* the block is bad. lose the attribute fork. */ - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } @@ -1001,7 +1001,7 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 " if (*repair && !no_modify) libxfs_writebuf(bp, 0); else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 0; } @@ -1045,7 +1045,7 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 " *repair = 1; libxfs_writebuf(bp, 0); } else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); error = process_node_attr(mp, ino, dip, blkmap); /* + repair */ if (error) *repair = 0; @@ -1107,7 +1107,7 @@ process_longform_attr( /* is this block sane? */ if (__check_attr_header(mp, bp, ino)) { *repair = 0; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } @@ -1130,7 +1130,7 @@ process_longform_attr( do_warn( _("bad attribute leaf magic # %#x for dir ino %" PRIu64 "\n"), be16_to_cpu(info->magic), ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); *repair = 0; return 1; } diff --git a/repair/da_util.c b/repair/da_util.c index bf25f7f2..c02d621c 100644 --- a/repair/da_util.c +++ b/repair/da_util.c @@ -145,7 +145,7 @@ _("found non-root LEAFN node in inode %" PRIu64 " bno = %u\n"), da_cursor->ino, bno); } *rbno = 0; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } @@ -155,13 +155,13 @@ _("found non-root LEAFN node in inode %" PRIu64 " bno = %u\n"), _("bad %s magic number 0x%x in inode %" PRIu64 " bno = %u\n"), FORKNAME(whichfork), nodehdr.magic, da_cursor->ino, bno); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } /* corrupt node; rebuild the dir. */ if (bp->b_error == -EFSBADCRC || bp->b_error == -EFSCORRUPTED) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); do_warn( _("corrupt %s tree block %u for inode %" PRIu64 "\n"), FORKNAME(whichfork), bno, da_cursor->ino); @@ -173,7 +173,7 @@ _("corrupt %s tree block %u for inode %" PRIu64 "\n"), _("bad %s record count in inode %" PRIu64 ", count = %d, max = %d\n"), FORKNAME(whichfork), da_cursor->ino, nodehdr.count, geo->node_ents); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } @@ -186,7 +186,7 @@ _("bad %s record count in inode %" PRIu64 ", count = %d, max = %d\n"), do_warn( _("bad header depth for directory inode %" PRIu64 "\n"), da_cursor->ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); i = -1; goto error_out; } @@ -197,7 +197,7 @@ _("bad header depth for directory inode %" PRIu64 "\n"), do_warn( _("bad %s btree for inode %" PRIu64 "\n"), FORKNAME(whichfork), da_cursor->ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } } @@ -222,7 +222,7 @@ _("bad %s btree for inode %" PRIu64 "\n"), error_out: while (i > 1 && i <= da_cursor->active) { - libxfs_putbuf(da_cursor->level[i].bp); + libxfs_buf_relse(da_cursor->level[i].bp); i++; } @@ -252,7 +252,7 @@ release_da_cursor_int( } ASSERT(error != 0); - libxfs_putbuf(cursor->level[level].bp); + libxfs_buf_relse(cursor->level[level].bp); cursor->level[level].bp = NULL; } @@ -406,7 +406,7 @@ _("would correct bad hashval in non-leaf %s block\n" if (cursor->level[this_level].dirty && !no_modify) libxfs_writebuf(cursor->level[this_level].bp, 0); else - libxfs_putbuf(cursor->level[this_level].bp); + libxfs_buf_relse(cursor->level[this_level].bp); cursor->level[this_level].bp = NULL; @@ -600,7 +600,7 @@ _("bad level %d in %s block %u for inode %" PRIu64 "\n"), #ifdef XR_DIR_TRACE fprintf(stderr, "verify_da_path returns 1 (bad) #4\n"); #endif - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } @@ -622,7 +622,7 @@ _("bad level %d in %s block %u for inode %" PRIu64 "\n"), if (cursor->level[this_level].dirty && !no_modify) libxfs_writebuf(cursor->level[this_level].bp, 0); else - libxfs_putbuf(cursor->level[this_level].bp); + libxfs_buf_relse(cursor->level[this_level].bp); /* switch cursor to point at the new buffer we just read */ cursor->level[this_level].bp = bp; diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c index dbf3d37a..863c4531 100644 --- a/repair/dino_chunks.c +++ b/repair/dino_chunks.c @@ -56,7 +56,7 @@ check_aginode_block(xfs_mount_t *mp, if (cnt) bp->b_ops = &xfs_inode_buf_ops; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return(cnt); } @@ -670,7 +670,7 @@ process_inode_chunk( M_IGEO(mp)->blocks_per_cluster)); while (bp_index > 0) { bp_index--; - libxfs_putbuf(bplist[bp_index]); + libxfs_buf_relse(bplist[bp_index]); } free(bplist); return(1); @@ -759,7 +759,7 @@ process_inode_chunk( *bogus = 1; for (bp_index = 0; bp_index < cluster_count; bp_index++) if (bplist[bp_index]) - libxfs_putbuf(bplist[bp_index]); + libxfs_buf_relse(bplist[bp_index]); free(bplist); return(0); } @@ -942,7 +942,7 @@ process_inode_chunk( if (dirty && !no_modify) libxfs_writebuf(bplist[bp_index], 0); else - libxfs_putbuf(bplist[bp_index]); + libxfs_buf_relse(bplist[bp_index]); } free(bplist); break; diff --git a/repair/dinode.c b/repair/dinode.c index 0d9c96be..928698cb 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -1234,7 +1234,7 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 " if (writebuf && !no_modify) libxfs_writebuf(bp, 0); else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } return 0; } @@ -1296,7 +1296,7 @@ _("cannot read inode %" PRIu64 ", file block %d, disk block %" PRIu64 "\n"), do_warn( _("Corrupt symlink remote block %" PRIu64 ", inode %" PRIu64 ".\n"), fsbno, lino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } if (bp->b_error == -EFSBADCRC) { @@ -1316,7 +1316,7 @@ _("Bad symlink buffer CRC, block %" PRIu64 ", inode %" PRIu64 ".\n" do_warn( _("bad symlink header ino %" PRIu64 ", file block %d, disk block %" PRIu64 "\n"), lino, i, fsbno); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } src += sizeof(struct xfs_dsymlink_hdr); @@ -1331,7 +1331,7 @@ _("bad symlink header ino %" PRIu64 ", file block %d, disk block %" PRIu64 "\n") if (badcrc && !no_modify) libxfs_writebuf(bp, 0); else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } return 0; } diff --git a/repair/dir2.c b/repair/dir2.c index 723aee1f..769e341c 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -1012,7 +1012,7 @@ _("bad directory block magic # %#x in block %u for directory inode %" PRIu64 "\n *repair = 1; libxfs_writebuf(bp, 0); } else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return rval; } @@ -1131,7 +1131,7 @@ _("can't read file block %u for directory inode %" PRIu64 "\n"), do_warn( _("bad directory leaf magic # %#x for directory inode %" PRIu64 " block %u\n"), leafhdr.magic, ino, da_bno); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } buf_dirty = 0; @@ -1141,7 +1141,7 @@ _("bad directory leaf magic # %#x for directory inode %" PRIu64 " block %u\n"), */ if (process_leaf_block_dir2(mp, leaf, da_bno, ino, current_hashval, &greatest_hashval)) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } /* @@ -1159,14 +1159,14 @@ _("bad directory leaf magic # %#x for directory inode %" PRIu64 " block %u\n"), do_warn( _("bad sibling back pointer for block %u in directory inode %" PRIu64 "\n"), da_bno, ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } prev_bno = da_bno; da_bno = leafhdr.forw; if (da_bno != 0) { if (verify_da_path(mp, da_cursor, 0, XFS_DATA_FORK)) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); goto error_out; } } @@ -1182,7 +1182,7 @@ _("bad sibling back pointer for block %u in directory inode %" PRIu64 "\n"), *repair = 1; libxfs_writebuf(bp, 0); } else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } while (da_bno != 0); if (verify_final_da_path(mp, da_cursor, 0, XFS_DATA_FORK)) { /* @@ -1341,7 +1341,7 @@ _("bad directory block magic # %#x in block %" PRIu64 " for directory inode %" P *repair = 1; libxfs_writebuf(bp, 0); } else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } if (good == 0) return 1; diff --git a/repair/phase3.c b/repair/phase3.c index 161852e0..1c6929ac 100644 --- a/repair/phase3.c +++ b/repair/phase3.c @@ -49,7 +49,7 @@ process_agi_unlinked( if (agi_dirty) libxfs_writebuf(bp, 0); else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } static void diff --git a/repair/phase6.c b/repair/phase6.c index 70135694..2464fe1a 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -1624,7 +1624,7 @@ longform_dir2_entry_check_data( dir2_kill_block(mp, ip, da_bno, bp); } else { do_warn(_("would junk block\n")); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } freetab->ents[db].v = NULLDATAOFF; *bpp = NULL; @@ -2063,21 +2063,21 @@ longform_dir2_check_leaf( do_warn( _("leaf block %u for directory inode %" PRIu64 " bad header\n"), da_bno, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } if (leafhdr.magic == XFS_DIR3_LEAF1_MAGIC) { error = check_da3_header(mp, bp, ip->i_ino); if (error) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return error; } } seeval = dir_hash_see_all(hashtab, ents, leafhdr.count, leafhdr.stale); if (dir_hash_check(hashtab, ip, seeval)) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } badtail = freetab->nents != be32_to_cpu(ltp->bestcount); @@ -2089,10 +2089,10 @@ longform_dir2_check_leaf( do_warn( _("leaf block %u for directory inode %" PRIu64 " bad tail\n"), da_bno, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return fixit; } @@ -2155,7 +2155,7 @@ longform_dir2_check_node( do_warn( _("unknown magic number %#x for block %u in directory inode %" PRIu64 "\n"), leafhdr.magic, da_bno, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } @@ -2164,7 +2164,7 @@ longform_dir2_check_node( leafhdr.magic == XFS_DA3_NODE_MAGIC) { error = check_da3_header(mp, bp, ip->i_ino); if (error) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return error; } } @@ -2172,7 +2172,7 @@ longform_dir2_check_node( /* ignore nodes */ if (leafhdr.magic == XFS_DA_NODE_MAGIC || leafhdr.magic == XFS_DA3_NODE_MAGIC) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); continue; } @@ -2186,12 +2186,12 @@ longform_dir2_check_node( do_warn( _("leaf block %u for directory inode %" PRIu64 " bad header\n"), da_bno, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } seeval = dir_hash_see_all(hashtab, ents, leafhdr.count, leafhdr.stale); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); if (seeval != DIR_HASH_CK_OK) return 1; } @@ -2226,14 +2226,14 @@ longform_dir2_check_node( do_warn( _("free block %u for directory inode %" PRIu64 " bad header\n"), da_bno, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } if (freehdr.magic == XFS_DIR3_FREE_MAGIC) { error = check_dir3_header(mp, bp, ip->i_ino); if (error) { - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return error; } } @@ -2244,7 +2244,7 @@ longform_dir2_check_node( do_warn( _("free block %u entry %i for directory ino %" PRIu64 " bad\n"), da_bno, i, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } used += be16_to_cpu(bests[i]) != NULLDATAOFF; @@ -2254,10 +2254,10 @@ longform_dir2_check_node( do_warn( _("free block %u for directory inode %" PRIu64 " bad nused\n"), da_bno, ip->i_ino); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 1; } - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } for (i = 0; i < freetab->nents; i++) { if ((freetab->ents[i].s == 0) && @@ -2433,14 +2433,14 @@ longform_dir2_entry_check(xfs_mount_t *mp, dir_hash_dup_names(hashtab); for (i = 0; i < num_bps; i++) if (bplist[i]) - libxfs_putbuf(bplist[i]); + libxfs_buf_relse(bplist[i]); longform_dir2_rebuild(mp, ino, ip, irec, ino_offset, hashtab); *num_illegal = 0; *need_dot = 0; } else { for (i = 0; i < num_bps; i++) if (bplist[i]) - libxfs_putbuf(bplist[i]); + libxfs_buf_relse(bplist[i]); } free(bplist); diff --git a/repair/prefetch.c b/repair/prefetch.c index 8e3772ed..f7ea9c8f 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -129,7 +129,7 @@ pf_queue_io( pf_read_inode_dirs(args, bp); XFS_BUF_SET_PRIORITY(bp, XFS_BUF_PRIORITY(bp) + CACHE_PREFETCH_PRIORITY); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return; } XFS_BUF_SET_PRIORITY(bp, flag); @@ -286,13 +286,13 @@ pf_scan_lbtree( */ if (bp->b_error) { bp->b_flags |= LIBXFS_B_UNCHECKED; - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return 0; } rc = (*func)(XFS_BUF_TO_BLOCK(bp), level - 1, isadir, args); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return rc; } @@ -578,7 +578,7 @@ pf_batch_read( if ((bplist[num - 1]->b_flags & LIBXFS_B_DISCONTIG)) { libxfs_readbufr_map(mp->m_ddev_targp, bplist[num - 1], 0); bplist[num - 1]->b_flags |= LIBXFS_B_UNCHECKED; - libxfs_putbuf(bplist[num - 1]); + libxfs_buf_relse(bplist[num - 1]); num--; } @@ -612,7 +612,7 @@ pf_batch_read( B_IS_INODE(XFS_BUF_PRIORITY(bplist[i])) ? 'I' : 'M', bplist[i], (long long)XFS_BUF_ADDR(bplist[i]), args->agno); - libxfs_putbuf(bplist[i]); + libxfs_buf_relse(bplist[i]); } pthread_mutex_lock(&args->lock); if (which != PF_SECONDARY) { diff --git a/repair/rmap.c b/repair/rmap.c index 2f99d35d..bc53e6c0 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -527,7 +527,7 @@ rmap_store_ag_btree_rec( } b++; } - libxfs_putbuf(agflbp); + libxfs_buf_relse(agflbp); agflbp = NULL; bitmap_free(&own_ag_bitmap); @@ -579,7 +579,7 @@ rmap_store_ag_btree_rec( free_slab_cursor(&rm_cur); err: if (agflbp) - libxfs_putbuf(agflbp); + libxfs_buf_relse(agflbp); if (own_ag_bitmap) bitmap_free(&own_ag_bitmap); return error; @@ -1082,7 +1082,7 @@ _("Incorrect reverse-mapping: saw (%u/%u) %slen %u owner %"PRId64" %s%soff \ if (bt_cur) libxfs_btree_del_cursor(bt_cur, XFS_BTREE_NOERROR); if (agbp) - libxfs_putbuf(agbp); + libxfs_buf_relse(agbp); free_slab_cursor(&rm_cur); return 0; } @@ -1417,7 +1417,7 @@ _("Incorrect reference count: saw (%u/%u) len %u nlinks %u; should be (%u/%u) le libxfs_btree_del_cursor(bt_cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); if (agbp) - libxfs_putbuf(agbp); + libxfs_buf_relse(agbp); free_slab_cursor(&rl_cur); return 0; } diff --git a/repair/rt.c b/repair/rt.c index 7108e3d5..3319829c 100644 --- a/repair/rt.c +++ b/repair/rt.c @@ -222,7 +222,7 @@ process_rtbitmap(xfs_mount_t *mp, prevbit = 0; } } - libxfs_putbuf(bp); + libxfs_buf_relse(bp); if (extno == mp->m_sb.sb_rextents) break; } @@ -266,7 +266,7 @@ process_rtsummary(xfs_mount_t *mp, bytes = bp->b_un.b_addr; memmove((char *)sumfile + sumbno * mp->m_sb.sb_blocksize, bytes, mp->m_sb.sb_blocksize); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } } #endif diff --git a/repair/scan.c b/repair/scan.c index 05707dd2..c961e843 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -82,7 +82,7 @@ scan_sbtree( (*func)(XFS_BUF_TO_BLOCK(bp), nlevels - 1, root, agno, suspect, isroot, magic, priv, ops); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); } /* @@ -154,7 +154,7 @@ scan_lbtree( if ((dirty || badcrc) && !no_modify) libxfs_writebuf(bp, 0); else - libxfs_putbuf(bp); + libxfs_buf_relse(bp); return(err); } @@ -2142,7 +2142,7 @@ scan_freelist( agcnts->fdblocks += state.count; - libxfs_putbuf(agflbuf); + libxfs_buf_relse(agflbuf); } static void @@ -2432,12 +2432,12 @@ scan_ag( if (agi_dirty && !no_modify) libxfs_writebuf(agibuf, 0); else - libxfs_putbuf(agibuf); + libxfs_buf_relse(agibuf); if (agf_dirty && !no_modify) libxfs_writebuf(agfbuf, 0); else - libxfs_putbuf(agfbuf); + libxfs_buf_relse(agfbuf); if (sb_dirty && !no_modify) { if (agno == 0) @@ -2445,7 +2445,7 @@ scan_ag( libxfs_sb_to_disk(XFS_BUF_TO_SBP(sbbuf), sb); libxfs_writebuf(sbbuf, 0); } else - libxfs_putbuf(sbbuf); + libxfs_buf_relse(sbbuf); free(sb); PROG_RPT_INC(prog_rpt_done[agno], 1); @@ -2455,11 +2455,11 @@ scan_ag( return; out_free_agibuf: - libxfs_putbuf(agibuf); + libxfs_buf_relse(agibuf); out_free_agfbuf: - libxfs_putbuf(agfbuf); + libxfs_buf_relse(agfbuf); out_free_sbbuf: - libxfs_putbuf(sbbuf); + libxfs_buf_relse(sbbuf); out_free_sb: free(sb); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index c0a77cad..8642c5cd 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -479,7 +479,7 @@ guess_correct_sunit( if (error) continue; libxfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp)); - libxfs_putbuf(bp); + libxfs_buf_relse(bp); calc_rootino = libxfs_ialloc_calc_rootino(mp, sb.sb_unit); if (calc_rootino == mp->m_sb.sb_rootino) From patchwork Thu Feb 20 01:43:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392935 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 06E91138D for ; Thu, 20 Feb 2020 01:43:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C90EF21D56 for ; Thu, 20 Feb 2020 01:43:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="O7DwlMvt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbgBTBnM (ORCPT ); Wed, 19 Feb 2020 20:43:12 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:44804 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbgBTBnM (ORCPT ); Wed, 19 Feb 2020 20:43:12 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hAoZ092873; Thu, 20 Feb 2020 01:43:10 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-2020-01-29; bh=ZZT/FAwUxxNskEUxf9kLVKIUpc2OtVI8xWKqueVX8Uw=; b=O7DwlMvtI6N4an8/sA4Xja9yOLTsUKRzVsbQKckCDyvQccrnlqLW5b27ENKs+iIYYiis u6qd8wWT+0i+2wDhrFppW3vBqxDhAZUkZZ0MzeDnBHOQqc3VhLZL4R3we2TDArD8D3Bg v8ET1cLdJcay1iq5d7JTBLK2kI5msplLQqclM5dG9PpvoYlyeiXWsR0WhDVuI3K5oToG +JGYvQnzquxmVdL386iSWFwv1CFkag6OGZEToEoJndhujMevcYpqadAnQcZnpZab+DOp wmwBROC/IlwAWnuY4BkzwckEeG82pRuZyy6rY301Lh7dsVJxrpGK3HMpr4TZSMU8qBKN hA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2y8udd6tde-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:10 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gErs094272; Thu, 20 Feb 2020 01:43:09 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2y8udbmg64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:09 +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 01K1h8xc006160; Thu, 20 Feb 2020 01:43:08 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:07 -0800 Subject: [PATCH 05/18] libxfs: replace libxfs_getbuf with libxfs_buf_get From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:06 -0800 Message-ID: <158216298676.602314.14219714632503201687.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Change all the libxfs_getbuf calls to libxfs_buf_get to match the kernel interface, since one is a #define of the other. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- include/cache.h | 2 +- libxfs/libxfs_api_defs.h | 1 + libxfs/libxfs_io.h | 21 ++++++++++++++++----- libxfs/libxfs_priv.h | 1 - libxfs/rdwr.c | 34 ++++++++++++++++------------------ mkfs/xfs_mkfs.c | 8 ++++---- repair/phase5.c | 30 +++++++++++++++--------------- 7 files changed, 53 insertions(+), 44 deletions(-) diff --git a/include/cache.h b/include/cache.h index 552b9248..334ad263 100644 --- a/include/cache.h +++ b/include/cache.h @@ -33,7 +33,7 @@ enum { * For prefetch support, the top half of the range starts at * CACHE_PREFETCH_PRIORITY and everytime the buffer is fetched and is at or * above this priority level, it is reduced to below this level (refer to - * libxfs_getbuf). + * libxfs_buf_get). * * If we have dirty nodes, we can't recycle them until they've been cleaned. To * keep these out of the reclaimable lists (as there can be lots of them) give diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 8bca7ddf..6d86774f 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -44,6 +44,7 @@ #define xfs_btree_del_cursor libxfs_btree_del_cursor #define xfs_btree_init_block libxfs_btree_init_block #define xfs_buf_delwri_submit libxfs_buf_delwri_submit +#define xfs_buf_get libxfs_buf_get #define xfs_buf_relse libxfs_buf_relse #define xfs_bunmapi libxfs_bunmapi #define xfs_calc_dquots_per_chunk libxfs_calc_dquots_per_chunk diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 704237d1..5087f03d 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -141,7 +141,7 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_writebuf(buf, flags) \ libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \ (buf), (flags)) -#define libxfs_getbuf(dev, daddr, len) \ +#define libxfs_buf_get(dev, daddr, len) \ libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ (dev), (daddr), (len)) #define libxfs_getbuf_map(dev, map, nmaps, flags) \ @@ -161,8 +161,9 @@ extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int, const struct xfs_buf_ops *); extern int libxfs_trace_writebuf(const char *, const char *, int, xfs_buf_t *, int); -extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int, - struct xfs_buftarg *, xfs_daddr_t, int); +struct xfs_buf *libxfs_trace_getbuf(const char *func, const char *file, + int line, struct xfs_buftarg *btp, xfs_daddr_t daddr, + size_t len); extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int, struct xfs_buftarg *, struct xfs_buf_map *, int, int); extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int, @@ -177,14 +178,24 @@ extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int, extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); extern int libxfs_writebuf(xfs_buf_t *, int); -extern xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int); extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, int, unsigned int); void libxfs_buf_relse(struct xfs_buf *); -#endif +static inline struct xfs_buf* +libxfs_buf_get( + struct xfs_buftarg *target, + xfs_daddr_t blkno, + size_t numblks) +{ + DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + + return libxfs_getbuf_map(target, &map, 1, 0); +} + +#endif /* XFS_BUF_TRACING */ extern void libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops); diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 4bd3c462..0f26120f 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -377,7 +377,6 @@ roundup_64(uint64_t x, uint32_t y) (len) = __bar; /* no set-but-unused warning */ \ NULL; \ }) -#define xfs_buf_get(devp,blkno,len) (libxfs_getbuf((devp), (blkno), (len))) #define xfs_bwrite(bp) libxfs_writebuf((bp), 0) #define xfs_buf_oneshot(bp) ((void) 0) diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 62b79bc4..56c50d47 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -30,7 +30,7 @@ * outside libxfs clears bp->b_error - very little code even checks it - so the * libxfs code is tripping on stale errors left by the userspace code. * - * We can't clear errors or zero buffer contents in libxfs_getbuf-* like we do + * We can't clear errors or zero buffer contents in libxfs_buf_get-* like we do * in the kernel, because those functions are used by the libxfs_readbuf_* * functions and hence need to leave the buffers unchanged on cache hits. This * is actually the only way to gather a write error from a libxfs_writebuf() @@ -44,7 +44,7 @@ * * IOWs, userspace is behaving quite differently to the kernel and as a result * it leaks errors from reads, invalidations and writes through - * libxfs_getbuf/libxfs_readbuf. + * libxfs_buf_get/libxfs_readbuf. * * The result of this is that until the userspace code outside libxfs is cleaned * up, functions that release buffers from userspace control (i.e @@ -384,7 +384,6 @@ libxfs_log_header( #undef libxfs_readbuf #undef libxfs_readbuf_map #undef libxfs_writebuf -#undef libxfs_getbuf #undef libxfs_getbuf_map #undef libxfs_getbuf_flags @@ -393,7 +392,8 @@ xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int, xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); int libxfs_writebuf(xfs_buf_t *, int); -xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int); +struct xfs_buf *libxfs_buf_get(struct xfs_buftarg *btp, xfs_daddr_t daddr, + size_t len); xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, int, @@ -436,11 +436,19 @@ libxfs_trace_writebuf(const char *func, const char *file, int line, xfs_buf_t *b return libxfs_writebuf(bp, flags); } -xfs_buf_t * -libxfs_trace_getbuf(const char *func, const char *file, int line, - struct xfs_buftarg *btp, xfs_daddr_t blkno, int len) +struct xfs_buf * +libxfs_trace_getbuf( + const char *func, + const char *file, + int line, + struct xfs_buftarg *btp, + xfs_daddr_t blkno, + size_t len) { - xfs_buf_t *bp = libxfs_getbuf(btp, blkno, len); + struct xfs_buf *bp; + DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + + bp = libxfs_getbuf_map(target, &map, 1, 0); __add_trace(bp, func, file, line); return bp; } @@ -799,16 +807,6 @@ reset_buf_state( LIBXFS_B_UPTODATE); } -struct xfs_buf * -libxfs_getbuf(struct xfs_buftarg *btp, xfs_daddr_t blkno, int len) -{ - struct xfs_buf *bp; - - bp = libxfs_getbuf_flags(btp, blkno, len, 0); - reset_buf_state(bp); - return bp; -} - static struct xfs_buf * __libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index db640a11..948749e9 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3444,7 +3444,7 @@ prepare_devices( * the end of the device. (MD sb is ~64k from the end, take out a wider * swath to be sure) */ - buf = libxfs_getbuf(mp->m_ddev_targp, (xi->dsize - whack_blks), + buf = libxfs_buf_get(mp->m_ddev_targp, (xi->dsize - whack_blks), whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); @@ -3456,13 +3456,13 @@ prepare_devices( * swap (somewhere around the page size), jfs (32k), * ext[2,3] and reiserfs (64k) - and hopefully all else. */ - buf = libxfs_getbuf(mp->m_ddev_targp, 0, whack_blks); + buf = libxfs_buf_get(mp->m_ddev_targp, 0, whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); libxfs_purgebuf(buf); /* OK, now write the superblock... */ - buf = libxfs_getbuf(mp->m_ddev_targp, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1)); + buf = libxfs_buf_get(mp->m_ddev_targp, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1)); buf->b_ops = &xfs_sb_buf_ops; memset(buf->b_addr, 0, cfg->sectorsize); libxfs_sb_to_disk(buf->b_addr, sbp); @@ -3482,7 +3482,7 @@ prepare_devices( /* finally, check we can write the last block in the realtime area */ if (mp->m_rtdev_targp->dev && cfg->rtblocks > 0) { - buf = libxfs_getbuf(mp->m_rtdev_targp, + buf = libxfs_buf_get(mp->m_rtdev_targp, XFS_FSB_TO_BB(mp, cfg->rtblocks - 1LL), BTOBB(cfg->blocksize)); memset(buf->b_addr, 0, cfg->blocksize); diff --git a/repair/phase5.c b/repair/phase5.c index 7f7d3d18..cdbf6697 100644 --- a/repair/phase5.c +++ b/repair/phase5.c @@ -689,7 +689,7 @@ prop_freespace_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); lptr->agbno = agbno; @@ -767,7 +767,7 @@ build_freespace_tree(xfs_mount_t *mp, xfs_agnumber_t agno, lptr = &btree_curs->level[i]; agbno = get_next_blockaddr(agno, i, btree_curs); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); @@ -877,7 +877,7 @@ build_freespace_tree(xfs_mount_t *mp, xfs_agnumber_t agno, lptr->agbno = get_next_blockaddr(agno, 0, btree_curs); bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(lptr->agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, lptr->agbno), XFS_FSB_TO_BB(mp, 1)); } @@ -1054,7 +1054,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs, bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); lptr->agbno = agbno; @@ -1104,7 +1104,7 @@ build_agi(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs, xfs_agi_t *agi; int i; - agi_buf = libxfs_getbuf(mp->m_dev, + agi_buf = libxfs_buf_get(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), mp->m_sb.sb_sectsize/BBSIZE); agi_buf->b_ops = &xfs_agi_buf_ops; @@ -1174,7 +1174,7 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnumber_t agno, lptr = &btree_curs->level[i]; agbno = get_next_blockaddr(agno, i, btree_curs); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); @@ -1306,7 +1306,7 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnumber_t agno, lptr->agbno = get_next_blockaddr(agno, 0, btree_curs); bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(lptr->agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, lptr->agbno), XFS_FSB_TO_BB(mp, 1)); } @@ -1459,7 +1459,7 @@ prop_rmap_cursor( bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); lptr->agbno = agbno; @@ -1569,7 +1569,7 @@ build_rmap_tree( lptr = &btree_curs->level[i]; agbno = get_next_blockaddr(agno, i, btree_curs); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); @@ -1668,7 +1668,7 @@ _("Insufficient memory to construct reverse-map cursor.")); lptr->agbno = get_next_blockaddr(agno, 0, btree_curs); bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(lptr->agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, lptr->agbno), XFS_FSB_TO_BB(mp, 1)); } @@ -1809,7 +1809,7 @@ prop_refc_cursor( bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); lptr->agbno = agbno; @@ -1874,7 +1874,7 @@ build_refcount_tree( lptr = &btree_curs->level[i]; agbno = get_next_blockaddr(agno, i, btree_curs); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1)); @@ -1961,7 +1961,7 @@ _("Insufficient memory to construct refcount cursor.")); lptr->agbno = get_next_blockaddr(agno, 0, btree_curs); bt_hdr->bb_u.s.bb_rightsib = cpu_to_be32(lptr->agbno); - lptr->buf_p = libxfs_getbuf(mp->m_dev, + lptr->buf_p = libxfs_buf_get(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, lptr->agbno), XFS_FSB_TO_BB(mp, 1)); } @@ -1996,7 +1996,7 @@ build_agf_agfl( __be32 *freelist; int error; - agf_buf = libxfs_getbuf(mp->m_dev, + agf_buf = libxfs_buf_get(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), mp->m_sb.sb_sectsize/BBSIZE); agf_buf->b_ops = &xfs_agf_buf_ops; @@ -2068,7 +2068,7 @@ build_agf_agfl( platform_uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); /* initialise the AGFL, then fill it if there are blocks left over. */ - agfl_buf = libxfs_getbuf(mp->m_dev, + agfl_buf = libxfs_buf_get(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)), mp->m_sb.sb_sectsize/BBSIZE); agfl_buf->b_ops = &xfs_agfl_buf_ops; From patchwork Thu Feb 20 01:43:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392937 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 398DC1395 for ; Thu, 20 Feb 2020 01:43:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0848D24672 for ; Thu, 20 Feb 2020 01:43:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="g6NKI2P2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbgBTBnT (ORCPT ); Wed, 19 Feb 2020 20:43:19 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49026 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBnT (ORCPT ); Wed, 19 Feb 2020 20:43:19 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1cvaA039912; Thu, 20 Feb 2020 01:43:15 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-2020-01-29; bh=lUxgPvUZGH15FNqehbt2FY6YkR2J3Ep/vQHe4VrE1j8=; b=g6NKI2P24n0H088I1ZzVeBBssrq2DMeL2m06CWJvCTuXiVAebJFUm/opd3MiA7Px6bc6 CIvfBbqXCg2sVixwNqhZFi37jcR7EnT4xQqkV1nE/G64z6PeTxPFIuCHA7VFRJegPwGt MzhLw6Z6zxi8JMRaH9lsP66HC6iowztK70kP+XWN7O9aeTDdsM33VNcKh8UpWNlIfhYR gn4kTEIlmNguPKo78ae8jf0XO16rbdljq+iDJ85xadssjA3PBu1v57kLeICV1Vx7aUBL wzLeMGDvcqmb13Npvr1dPjzSIHzV8aPihHfrjR5W6UUx/t8PnHCrjVYVb6hqRpZufTzU 9A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2y8ud16sba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:15 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gdW7147411; Thu, 20 Feb 2020 01:43:15 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2y8ud4pxna-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:15 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 01K1hEuj002942; Thu, 20 Feb 2020 01:43:14 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:13 -0800 Subject: [PATCH 06/18] libxfs: replace libxfs_readbuf with libxfs_buf_read From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:13 -0800 Message-ID: <158216299309.602314.10312057165892234719.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 suspectscore=2 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=2 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Change all the libxfs_readbuf calls to libxfs_buf_read to match the kernel interface. This enables us to hide libxfs_readbuf and simplify the userspace buffer interface further. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- copy/xfs_copy.c | 4 ++- db/init.c | 2 +- db/io.c | 2 +- libxfs/init.c | 8 +++---- libxfs/libxfs_api_defs.h | 1 + libxfs/libxfs_io.h | 25 +++++++++++++++------ libxfs/rdwr.c | 56 +++++++++++++++++++++++----------------------- mkfs/xfs_mkfs.c | 4 ++- repair/attr_repair.c | 6 ++--- repair/dino_chunks.c | 4 ++- repair/dinode.c | 6 ++--- repair/phase3.c | 2 +- repair/prefetch.c | 2 +- repair/rt.c | 4 ++- repair/scan.c | 12 +++++----- 15 files changed, 75 insertions(+), 63 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 74dd2e23..bb3ecd43 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -710,7 +710,7 @@ main(int argc, char **argv) /* We don't yet know the sector size, so read maximal size */ libxfs_buftarg_init(&mbuf, xargs.ddev, xargs.logdev, xargs.rtdev); - sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR, + sbp = libxfs_buf_read(mbuf.m_ddev_targp, XFS_SB_DADDR, 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); sb = &mbuf.m_sb; libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp)); @@ -718,7 +718,7 @@ main(int argc, char **argv) /* Do it again, now with proper length and verifier */ libxfs_buf_relse(sbp); libxfs_purgebuf(sbp); - sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR, + sbp = libxfs_buf_read(mbuf.m_ddev_targp, XFS_SB_DADDR, 1 << (sb->sb_sectlog - BBSHIFT), 0, &xfs_sb_buf_ops); libxfs_buf_relse(sbp); diff --git a/db/init.c b/db/init.c index be4a08e5..acab349c 100644 --- a/db/init.c +++ b/db/init.c @@ -112,7 +112,7 @@ init( */ memset(&xmount, 0, sizeof(struct xfs_mount)); libxfs_buftarg_init(&xmount, x.ddev, x.logdev, x.rtdev); - bp = libxfs_readbuf(xmount.m_ddev_targp, XFS_SB_DADDR, + bp = libxfs_buf_read(xmount.m_ddev_targp, XFS_SB_DADDR, 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); if (!bp || bp->b_error) { diff --git a/db/io.c b/db/io.c index a11b7bb1..163ccc89 100644 --- a/db/io.c +++ b/db/io.c @@ -545,7 +545,7 @@ set_cur( bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b, bbmap->nmaps, 0, ops); } else { - bp = libxfs_readbuf(mp->m_ddev_targp, blknum, len, 0, ops); + bp = libxfs_buf_read(mp->m_ddev_targp, blknum, len, 0, ops); iocur_top->bbmap = NULL; } diff --git a/libxfs/init.c b/libxfs/init.c index 2c290428..c66cb785 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -438,7 +438,7 @@ rtmount_init( (unsigned long long) mp->m_sb.sb_rblocks); return -1; } - bp = libxfs_readbuf(mp->m_rtdev, + bp = libxfs_buf_read(mp->m_rtdev, d - XFS_FSB_TO_BB(mp, 1), XFS_FSB_TO_BB(mp, 1), 0, NULL); if (bp == NULL) { fprintf(stderr, _("%s: realtime size check failed\n"), @@ -721,7 +721,7 @@ libxfs_mount( if (!(flags & LIBXFS_MOUNT_DEBUGGER)) readflags |= LIBXFS_READBUF_FAIL_EXIT; - bp = libxfs_readbuf(mp->m_dev, + bp = libxfs_buf_read(mp->m_dev, d - XFS_FSS_TO_BB(mp, 1), XFS_FSS_TO_BB(mp, 1), readflags, NULL); if (!bp) { @@ -735,7 +735,7 @@ libxfs_mount( mp->m_logdev_targp->dev != mp->m_ddev_targp->dev) { d = (xfs_daddr_t) XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); if ( (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) || - (!(bp = libxfs_readbuf(mp->m_logdev_targp, + (!(bp = libxfs_buf_read(mp->m_logdev_targp, d - XFS_FSB_TO_BB(mp, 1), XFS_FSB_TO_BB(mp, 1), readflags, NULL))) ) { @@ -763,7 +763,7 @@ libxfs_mount( * read the first one and let the user know to check the geometry. */ if (sbp->sb_agcount > 1000000) { - bp = libxfs_readbuf(mp->m_dev, + bp = libxfs_buf_read(mp->m_dev, XFS_AG_DADDR(mp, sbp->sb_agcount - 1, 0), 1, readflags, NULL); if (bp->b_error) { diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 6d86774f..57cf5f83 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -45,6 +45,7 @@ #define xfs_btree_init_block libxfs_btree_init_block #define xfs_buf_delwri_submit libxfs_buf_delwri_submit #define xfs_buf_get libxfs_buf_get +#define xfs_buf_read libxfs_buf_read #define xfs_buf_relse libxfs_buf_relse #define xfs_bunmapi libxfs_bunmapi #define xfs_calc_dquots_per_chunk libxfs_calc_dquots_per_chunk diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 5087f03d..9484c627 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -132,7 +132,7 @@ extern struct cache_operations libxfs_bcache_operations; #ifdef XFS_BUF_TRACING -#define libxfs_readbuf(dev, daddr, len, flags, ops) \ +#define libxfs_buf_read(dev, daddr, len, flags, ops) \ libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \ (dev), (daddr), (len), (flags), (ops)) #define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \ @@ -153,9 +153,9 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_buf_relse(buf) \ libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) -extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int, - struct xfs_buftarg *, xfs_daddr_t, int, int, - const struct xfs_buf_ops *); +struct xfs_buf *libxfs_trace_readbuf(const char *func, const char *file, + int line, struct xfs_buftarg *btp, xfs_daddr_t daddr, + size_t len, int flags, const struct xfs_buf_ops *ops); extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int, struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); @@ -173,8 +173,6 @@ extern void libxfs_trace_putbuf (const char *, const char *, int, #else -extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int, - const struct xfs_buf_ops *); extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); extern int libxfs_writebuf(xfs_buf_t *, int); @@ -195,11 +193,24 @@ libxfs_buf_get( return libxfs_getbuf_map(target, &map, 1, 0); } +static inline struct xfs_buf* +libxfs_buf_read( + struct xfs_buftarg *target, + xfs_daddr_t blkno, + size_t numblks, + xfs_buf_flags_t flags, + const struct xfs_buf_ops *ops) +{ + DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); + + return libxfs_readbuf_map(target, &map, 1, flags, ops); +} + #endif /* XFS_BUF_TRACING */ extern void libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops); -extern xfs_buf_t *libxfs_getsb(struct xfs_mount *); +struct xfs_buf *libxfs_getsb(struct xfs_mount *); extern void libxfs_bcache_purge(void); extern void libxfs_bcache_free(void); extern void libxfs_bcache_flush(void); diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 56c50d47..ea2f4a13 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -44,7 +44,7 @@ * * IOWs, userspace is behaving quite differently to the kernel and as a result * it leaks errors from reads, invalidations and writes through - * libxfs_buf_get/libxfs_readbuf. + * libxfs_buf_get/libxfs_buf_read. * * The result of this is that until the userspace code outside libxfs is cleaned * up, functions that release buffers from userspace control (i.e @@ -381,14 +381,11 @@ libxfs_log_header( #ifdef XFS_BUF_TRACING -#undef libxfs_readbuf #undef libxfs_readbuf_map #undef libxfs_writebuf #undef libxfs_getbuf_map #undef libxfs_getbuf_flags -xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, int, - const struct xfs_buf_ops *); xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); int libxfs_writebuf(xfs_buf_t *, int); @@ -409,22 +406,21 @@ do { \ } \ } while (0) -xfs_buf_t * -libxfs_trace_readbuf(const char *func, const char *file, int line, - struct xfs_buftarg *btp, xfs_daddr_t blkno, int len, int flags, - const struct xfs_buf_ops *ops) +struct xfs_buf * +libxfs_trace_readbuf( + const char *func, + const char *file, + int line, + struct xfs_buftarg *btp, + xfs_daddr_t blkno, + size_t len, + int flags, + const struct xfs_buf_ops *ops) { - xfs_buf_t *bp = libxfs_readbuf(btp, blkno, len, flags, ops); - __add_trace(bp, func, file, line); - return bp; -} + struct xfs_buf *bp; + DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); -xfs_buf_t * -libxfs_trace_readbuf_map(const char *func, const char *file, int line, - struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags, - const struct xfs_buf_ops *ops) -{ - xfs_buf_t *bp = libxfs_readbuf_map(btp, map, nmaps, flags, ops); + bp = libxfs_readbuf_map(btp, &map, 1, flags, ops); __add_trace(bp, func, file, line); return bp; } @@ -483,11 +479,12 @@ libxfs_trace_putbuf(const char *func, const char *file, int line, xfs_buf_t *bp) #endif -xfs_buf_t * -libxfs_getsb(xfs_mount_t *mp) +struct xfs_buf * +libxfs_getsb( + struct xfs_mount *mp) { - return libxfs_readbuf(mp->m_ddev_targp, XFS_SB_DADDR, - XFS_FSS_TO_BB(mp, 1), 0, &xfs_sb_buf_ops); + return libxfs_buf_read(mp->m_ddev_targp, XFS_SB_DADDR, + XFS_FSS_TO_BB(mp, 1), 0, &xfs_sb_buf_ops); } kmem_zone_t *xfs_buf_zone; @@ -956,13 +953,16 @@ libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops) bp->b_flags &= ~LIBXFS_B_UNCHECKED; } - -xfs_buf_t * -libxfs_readbuf(struct xfs_buftarg *btp, xfs_daddr_t blkno, int len, int flags, - const struct xfs_buf_ops *ops) +static struct xfs_buf * +libxfs_readbuf( + struct xfs_buftarg *btp, + xfs_daddr_t blkno, + size_t len, + int flags, + const struct xfs_buf_ops *ops) { - xfs_buf_t *bp; - int error; + struct xfs_buf *bp; + int error; bp = libxfs_getbuf_flags(btp, blkno, len, 0); if (!bp) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 948749e9..9ca4cb1a 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3573,7 +3573,7 @@ rewrite_secondary_superblocks( struct xfs_buf *buf; /* rewrite the last superblock */ - buf = libxfs_readbuf(mp->m_dev, + buf = libxfs_buf_read(mp->m_dev, XFS_AGB_TO_DADDR(mp, mp->m_sb.sb_agcount - 1, XFS_SB_DADDR), XFS_FSS_TO_BB(mp, 1), @@ -3585,7 +3585,7 @@ rewrite_secondary_superblocks( if (mp->m_sb.sb_agcount <= 2) return; - buf = libxfs_readbuf(mp->m_dev, + buf = libxfs_buf_read(mp->m_dev, XFS_AGB_TO_DADDR(mp, (mp->m_sb.sb_agcount - 1) / 2, XFS_SB_DADDR), XFS_FSS_TO_BB(mp, 1), diff --git a/repair/attr_repair.c b/repair/attr_repair.c index ec068ba2..cc20b1a1 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -405,7 +405,7 @@ rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap, clearit = 1; break; } - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), XFS_FSB_TO_BB(mp, 1), 0, &xfs_attr3_rmt_buf_ops); if (!bp) { @@ -763,7 +763,7 @@ process_leaf_attr_level(xfs_mount_t *mp, goto error_out; } - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, dev_bno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, dev_bno), XFS_FSB_TO_BB(mp, 1), 0, &xfs_attr3_leaf_buf_ops); if (!bp) { @@ -1093,7 +1093,7 @@ process_longform_attr( return 1; } - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), XFS_FSB_TO_BB(mp, 1), 0, &xfs_da3_node_buf_ops); if (!bp) { do_warn( diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c index 863c4531..76e9f773 100644 --- a/repair/dino_chunks.c +++ b/repair/dino_chunks.c @@ -39,7 +39,7 @@ check_aginode_block(xfs_mount_t *mp, * tree and we wouldn't be here and we stale the buffers out * so no one else will overlap them. */ - bp = libxfs_readbuf(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), + bp = libxfs_buf_read(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, 1), 0, NULL); if (!bp) { do_warn(_("cannot read agbno (%u/%u), disk block %" PRId64 "\n"), @@ -656,7 +656,7 @@ process_inode_chunk( pftrace("about to read off %llu in AG %d", XFS_AGB_TO_DADDR(mp, agno, agbno), agno); - bplist[bp_index] = libxfs_readbuf(mp->m_dev, + bplist[bp_index] = libxfs_buf_read(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, agbno), XFS_FSB_TO_BB(mp, M_IGEO(mp)->blocks_per_cluster), diff --git a/repair/dinode.c b/repair/dinode.c index 928698cb..848eac09 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -748,7 +748,7 @@ get_agino_buf( cluster_agino, cluster_daddr, cluster_blks); #endif - bp = libxfs_readbuf(mp->m_dev, cluster_daddr, cluster_blks, + bp = libxfs_buf_read(mp->m_dev, cluster_daddr, cluster_blks, 0, &xfs_inode_buf_ops); if (!bp) { do_warn(_("cannot read inode (%u/%u), disk block %" PRIu64 "\n"), @@ -1179,7 +1179,7 @@ process_quota_inode( fsbno = blkmap_get(blkmap, qbno); dqid = (xfs_dqid_t)qbno * dqperchunk; - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno), dqchunklen, 0, &xfs_dquot_buf_ops); if (!bp) { do_warn( @@ -1284,7 +1284,7 @@ _("cannot read inode %" PRIu64 ", file block %d, NULL disk block\n"), byte_cnt = XFS_FSB_TO_B(mp, blk_cnt); - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno), BTOBB(byte_cnt), 0, &xfs_symlink_buf_ops); if (!bp) { do_warn( diff --git a/repair/phase3.c b/repair/phase3.c index 1c6929ac..886acd1f 100644 --- a/repair/phase3.c +++ b/repair/phase3.c @@ -28,7 +28,7 @@ process_agi_unlinked( xfs_agnumber_t i; int agi_dirty = 0; - bp = libxfs_readbuf(mp->m_dev, + bp = libxfs_buf_read(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), mp->m_sb.sb_sectsize/BBSIZE, 0, &xfs_agi_buf_ops); if (!bp) diff --git a/repair/prefetch.c b/repair/prefetch.c index f7ea9c8f..12272932 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -271,7 +271,7 @@ pf_scan_lbtree( xfs_buf_t *bp; int rc; - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, dbno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, dbno), XFS_FSB_TO_BB(mp, 1), 0, &xfs_bmbt_buf_ops); if (!bp) return 0; diff --git a/repair/rt.c b/repair/rt.c index 3319829c..b514998d 100644 --- a/repair/rt.c +++ b/repair/rt.c @@ -193,7 +193,7 @@ process_rtbitmap(xfs_mount_t *mp, error = 1; continue; } - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), XFS_FSB_TO_BB(mp, 1), NULL); if (!bp) { do_warn(_("can't read block %d for rtbitmap inode\n"), @@ -255,7 +255,7 @@ process_rtsummary(xfs_mount_t *mp, error++; continue; } - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno), XFS_FSB_TO_BB(mp, 1), NULL); if (!bp) { do_warn(_("can't read block %d for rtsummary inode\n"), diff --git a/repair/scan.c b/repair/scan.c index c961e843..f4e4fef5 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -68,7 +68,7 @@ scan_sbtree( { xfs_buf_t *bp; - bp = libxfs_readbuf(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, root), + bp = libxfs_buf_read(mp->m_dev, XFS_AGB_TO_DADDR(mp, agno, root), XFS_FSB_TO_BB(mp, 1), 0, ops); if (!bp) { do_error(_("can't read btree block %d/%d\n"), agno, root); @@ -123,7 +123,7 @@ scan_lbtree( int dirty = 0; bool badcrc = false; - bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, root), + bp = libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, root), XFS_FSB_TO_BB(mp, 1), 0, ops); if (!bp) { do_error(_("can't read btree block %d/%d\n"), @@ -2111,7 +2111,7 @@ scan_freelist( if (be32_to_cpu(agf->agf_flcount) == 0) return; - agflbuf = libxfs_readbuf(mp->m_dev, + agflbuf = libxfs_buf_read(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)), XFS_FSS_TO_BB(mp, 1), 0, &xfs_agfl_buf_ops); if (!agflbuf) { @@ -2335,7 +2335,7 @@ scan_ag( return; } - sbbuf = libxfs_readbuf(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), + sbbuf = libxfs_buf_read(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), XFS_FSS_TO_BB(mp, 1), 0, &xfs_sb_buf_ops); if (!sbbuf) { objname = _("root superblock"); @@ -2343,7 +2343,7 @@ scan_ag( } libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbbuf)); - agfbuf = libxfs_readbuf(mp->m_dev, + agfbuf = libxfs_buf_read(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), XFS_FSS_TO_BB(mp, 1), 0, &xfs_agf_buf_ops); if (!agfbuf) { @@ -2352,7 +2352,7 @@ scan_ag( } agf = XFS_BUF_TO_AGF(agfbuf); - agibuf = libxfs_readbuf(mp->m_dev, + agibuf = libxfs_buf_read(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), XFS_FSS_TO_BB(mp, 1), 0, &xfs_agi_buf_ops); if (!agibuf) { From patchwork Thu Feb 20 01:43:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392939 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 89FFA138D for ; Thu, 20 Feb 2020 01:43:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A87824671 for ; Thu, 20 Feb 2020 01:43:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="YD3KibpU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgBTBnY (ORCPT ); Wed, 19 Feb 2020 20:43:24 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:33406 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBnX (ORCPT ); Wed, 19 Feb 2020 20:43:23 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hMop064466; Thu, 20 Feb 2020 01:43:22 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-2020-01-29; bh=/LHKTr/3CJR4mpDuh1+rpiWp71PZnEz1J8xYZrz6Pt0=; b=YD3KibpUEnuqO3o8HcB0+7TCjwxrmVkf2RkbXC+JSvwGnfnpS1zUqoaxkFue/Rw5BUoG 7AHrkklAaDVwfVsC+zmmjhVfySS0wj94W0N6EPp0xtv8Cck6H7zyarTPoktQJzt4uHVf naacra2wlPnUb3B/XzbrygI75qxNzPMbD2AC//KyJyMndlPehG5dzcJ3mYkTeaMPYF/F Q2Lf3GCSMnqZet00glAln9NQl0XE3nF2tlMU+UFRtuShbGvSNP8ycy23jJlJgLxT/iCD 1jgA3nTQwfDRwZ0p3d2VcRe9B8upSOT2ZdxG7G64TrQHWSytu1QkAlcPAuUhlV7UlATA Tg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2y8udket00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gCAP188971; Thu, 20 Feb 2020 01:43:21 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2y8ud972jm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:21 +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 01K1hKNd006311; Thu, 20 Feb 2020 01:43:20 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:20 -0800 Subject: [PATCH 07/18] libxfs: make libxfs_bwrite do what libxfs_writebufr does From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:19 -0800 Message-ID: <158216299927.602314.10659390054898124986.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 clxscore=1015 malwarescore=0 mlxlogscore=999 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Make libxfs_bwrite equivalent to libxfs_writebufr. This makes it so that libxfs bwrite calls write the buffer to disk immediately and without double-freeing the buffer. However, we choose to consolidate around the libxfs_bwrite name to match the kernel. Signed-off-by: Darrick J. Wong --- db/io.c | 4 ++-- libxfs/libxfs_api_defs.h | 1 + libxfs/libxfs_io.h | 2 +- libxfs/libxfs_priv.h | 1 - libxfs/rdwr.c | 11 ++++++----- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/db/io.c b/db/io.c index 163ccc89..7c7a4624 100644 --- a/db/io.c +++ b/db/io.c @@ -426,7 +426,7 @@ write_cur_buf(void) { int ret; - ret = -libxfs_writebufr(iocur_top->bp); + ret = -libxfs_bwrite(iocur_top->bp); if (ret != 0) dbprintf(_("write error: %s\n"), strerror(ret)); @@ -442,7 +442,7 @@ write_cur_bbs(void) { int ret; - ret = -libxfs_writebufr(iocur_top->bp); + ret = -libxfs_bwrite(iocur_top->bp); if (ret != 0) dbprintf(_("write error: %s\n"), strerror(ret)); diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 57cf5f83..df267c98 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -48,6 +48,7 @@ #define xfs_buf_read libxfs_buf_read #define xfs_buf_relse libxfs_buf_relse #define xfs_bunmapi libxfs_bunmapi +#define xfs_bwrite libxfs_bwrite #define xfs_calc_dquots_per_chunk libxfs_calc_dquots_per_chunk #define xfs_da3_node_hdr_from_disk libxfs_da3_node_hdr_from_disk #define xfs_da_get_buf libxfs_da_get_buf diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 9484c627..f00ff8d3 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -222,7 +222,7 @@ extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int); extern void libxfs_putbufr(xfs_buf_t *); extern int libxfs_writebuf_int(xfs_buf_t *, int); -extern int libxfs_writebufr(struct xfs_buf *); +int libxfs_bwrite(struct xfs_buf *); extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int); extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int); diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 0f26120f..5d6dd063 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -377,7 +377,6 @@ roundup_64(uint64_t x, uint32_t y) (len) = __bar; /* no set-but-unused warning */ \ NULL; \ }) -#define xfs_bwrite(bp) libxfs_writebuf((bp), 0) #define xfs_buf_oneshot(bp) ((void) 0) #define XBRW_READ LIBXFS_BREAD diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index ea2f4a13..2a4ef15a 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1091,9 +1091,10 @@ __write_buf(int fd, void *buf, int len, off64_t offset, int flags) } int -libxfs_writebufr(xfs_buf_t *bp) +libxfs_bwrite( + struct xfs_buf *bp) { - int fd = libxfs_device_to_fd(bp->b_target->dev); + int fd = libxfs_device_to_fd(bp->b_target->dev); /* * we never write buffers that are marked stale. This indicates they @@ -1303,7 +1304,7 @@ libxfs_bflush( struct xfs_buf *bp = (struct xfs_buf *)node; if (!bp->b_error && bp->b_flags & LIBXFS_B_DIRTY) - return libxfs_writebufr(bp); + return libxfs_bwrite(bp); return bp->b_error; } @@ -1311,7 +1312,7 @@ void libxfs_putbufr(xfs_buf_t *bp) { if (bp->b_flags & LIBXFS_B_DIRTY) - libxfs_writebufr(bp); + libxfs_bwrite(bp); libxfs_brelse((struct cache_node *)bp); } @@ -1524,7 +1525,7 @@ xfs_buf_delwri_submit( list_for_each_entry_safe(bp, n, buffer_list, b_list) { list_del_init(&bp->b_list); - error2 = libxfs_writebufr(bp); + error2 = libxfs_bwrite(bp); if (!error) error = error2; libxfs_buf_relse(bp); From patchwork Thu Feb 20 01:43:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392945 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 3296A1395 for ; Thu, 20 Feb 2020 01:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1373624670 for ; Thu, 20 Feb 2020 01:43:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="tOdbj2/A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgBTBnk (ORCPT ); Wed, 19 Feb 2020 20:43:40 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49416 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgBTBnk (ORCPT ); Wed, 19 Feb 2020 20:43:40 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1c5F6039404; Thu, 20 Feb 2020 01:43:38 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-2020-01-29; bh=PSJLXYuRL2mRztiEFRJis2EjQkzceI4GjUq2nIISVMk=; b=tOdbj2/ATOq2kysXP1Do+kO17fdBsUiQDr+UBr+NV/ACiE7b4f6J5qWjSX1yuxJ5qwtw cIgGo/uRitANSpBYFGqejDwO1ib4g2r3ViU6YIjFZdFsqzjfKrdKEFZHHXkb7J9idjhf GYA+PbnCUz3G91wpI/2ZqHzli8px3z38RFPzBMLpx7zjZwAFB7oiFZiOCKHbXanfN74S gZXvoO3pDNxuFGtwxTmEzbsjSU2zrVTwXhV9AtVwmwUOBsqJEs5W5loOu8ttOSdEYq4H R11R+0T38l0FWQ0POHNVoyvcbPQzJLA/HFa9gLD6PdIcGqjk4B6Ujku52vhri0PAGxn8 kw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2y8ud16sc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:37 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hbpV114128; Thu, 20 Feb 2020 01:43:37 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2y8ud2g3mb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:37 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1hQu2002205; Thu, 20 Feb 2020 01:43:26 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:26 -0800 Subject: [PATCH 08/18] libxfs: make libxfs_readbuf_verify return an error code From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:25 -0800 Message-ID: <158216300534.602314.4013285592257885758.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=888 suspectscore=2 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=2 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=942 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Return the bp->b_error from libxfs_readbuf_verify instead of making callers check it. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_io.h | 3 +-- libxfs/rdwr.c | 10 +++++++--- repair/prefetch.c | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index f00ff8d3..b01f2896 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -208,8 +208,7 @@ libxfs_buf_read( #endif /* XFS_BUF_TRACING */ -extern void libxfs_readbuf_verify(struct xfs_buf *bp, - const struct xfs_buf_ops *ops); +int libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops); struct xfs_buf *libxfs_getsb(struct xfs_mount *); extern void libxfs_bcache_purge(void); extern void libxfs_bcache_free(void); diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 2a4ef15a..24c5eaf6 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -943,14 +943,18 @@ libxfs_readbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, xfs_buf_t *bp, return error; } -void -libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops) +int +libxfs_readbuf_verify( + struct xfs_buf *bp, + const struct xfs_buf_ops *ops) { if (!ops) - return; + return bp->b_error; + bp->b_ops = ops; bp->b_ops->verify_read(bp); bp->b_flags &= ~LIBXFS_B_UNCHECKED; + return bp->b_error; } static struct xfs_buf * diff --git a/repair/prefetch.c b/repair/prefetch.c index 12272932..a3858f9a 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -400,9 +400,10 @@ pf_read_inode_dirs( int icnt = 0; int hasdir = 0; int isadir; + int error; - libxfs_readbuf_verify(bp, &xfs_inode_buf_ops); - if (bp->b_error) + error = -libxfs_readbuf_verify(bp, &xfs_inode_buf_ops); + if (error) return; for (icnt = 0; icnt < (bp->b_bcount >> mp->m_sb.sb_inodelog); icnt++) { From patchwork Thu Feb 20 01:43:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392947 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 BE38917E0 for ; Thu, 20 Feb 2020 01:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F29521D56 for ; Thu, 20 Feb 2020 01:43:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="wBbeA9nB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbgBTBnl (ORCPT ); Wed, 19 Feb 2020 20:43:41 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:33798 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBnk (ORCPT ); Wed, 19 Feb 2020 20:43:40 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hdQS064547; Thu, 20 Feb 2020 01:43: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-2020-01-29; bh=w26Y+3v7Ys3mShTAHqspDNQ1G9QNWGQf5upfZJK7d8g=; b=wBbeA9nBn3twlUYMG0VKfdX8l8Pmfz58nPi6vZIBj5RSPJcv7LeL+8tX8qalACZVHeUL 5wEtBC5t2Zw//ABcKwsuPoLhVjsH1pBb0rl8mos/tkVvJ1lM8Ace47J8lt92Od9BEdfK 5Em3SvqSeKHAJ2ddgIlsJ4ZSuFg+BW2J/UW8rVfHH7zgTF96Tcg76rQCTIdz0Yhlhj8Y 0qzerHxDe7bUlt1BRn/JFfHT2tqwTopWgVzRsaRbIejGCOvazq2zEkb7r3dvViZ0tCHo K2NSz54SiI6pQJFImK1vrs7tyuv8RTUfG9/9n2hkhMM49dUEjIEtDW6RiKURqq3diDm3 4Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2y8udket0s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:38 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hboc114171; Thu, 20 Feb 2020 01:43:38 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2y8ud2g3ru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:38 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1hWbs002256; Thu, 20 Feb 2020 01:43:32 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:32 -0800 Subject: [PATCH 09/18] libxfs: make libxfs_readbufr stash the error value in b_error From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:31 -0800 Message-ID: <158216301140.602314.6904049540452018739.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=758 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 clxscore=1015 malwarescore=0 mlxlogscore=809 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Make libxfs_readbufr stash the error value in b_error, which will make the behavior consistent between regular and multi-mapping buffers. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/rdwr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 24c5eaf6..51f93c3e 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -940,6 +940,7 @@ libxfs_readbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, xfs_buf_t *bp, pthread_self(), __FUNCTION__, bytes, error, (long long)LIBXFS_BBTOOFF64(blkno), (long long)blkno, bp); #endif + bp->b_error = error; return error; } @@ -999,9 +1000,7 @@ libxfs_readbuf( * contents. *cough* xfs_da_node_buf_ops *cough*. */ error = libxfs_readbufr(btp, blkno, bp, len, flags); - if (error) - bp->b_error = error; - else + if (!error) libxfs_readbuf_verify(bp, ops); return bp; } From patchwork Thu Feb 20 01:43:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392949 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 3DC8E138D for ; Thu, 20 Feb 2020 01:43:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 169F524671 for ; Thu, 20 Feb 2020 01:43:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="QPrbpy7p" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727291AbgBTBnm (ORCPT ); Wed, 19 Feb 2020 20:43:42 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:33828 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBnm (ORCPT ); Wed, 19 Feb 2020 20:43:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1heQw064553; Thu, 20 Feb 2020 01:43:40 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-2020-01-29; bh=fHm36qQvvHZPSh/RJCc6EUNvl7O1RI/9jN3Ofxozx9A=; b=QPrbpy7pE/Zm+z0AlTj0riJGhWSIIeKsn12rGZG6K97mEL8Zkr52Rao2rd6pCD5c98Y4 66Y3ZSV1sTXalF7v9d3On0Y3URKV8J5EwmJSjI2MTbpxSLjIbMmdzMdCTHONLKbTud8W NAl3lAZSighBgw4liBFZPsSvw0tKXeoBpjxVZl8Q162IGdOm19TVTeiyNCjDu+mKaXT6 HVM2ROMQPdGQqsOJ2264YKMFrOe/ZuQS0yWhumLdA0wCcUYl+b39iA3jPZa3SaSlbBBU 3BRvcIkNStiFBrLyiplM0QQR0MGPSeU7usumGh85XpkSRLRhVvlrZJaSCEWPQPZxBRD+ ag== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2y8udket0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hdA9114447; Thu, 20 Feb 2020 01:43:39 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2y8ud2g3tw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:39 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1hcFJ006370; Thu, 20 Feb 2020 01:43:38 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:38 -0800 Subject: [PATCH 10/18] libxfs: introduce libxfs_buf_read_uncached From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:37 -0800 Message-ID: <158216301746.602314.17789861786273491972.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=901 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 clxscore=1015 malwarescore=0 mlxlogscore=960 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Introduce an uncached read function so that userspace can handle them in the same way as the kernel. This also eliminates the need for some of the libxfs_purgebuf calls (and two trips into the cache code). Refactor the get/read uncached buffer functions to hide the details of uncached buffer-ism in rdwr.c. Signed-off-by: Darrick J. Wong --- copy/xfs_copy.c | 13 +++++++-- db/init.c | 9 +++--- libxfs/libxfs_api_defs.h | 2 + libxfs/libxfs_io.h | 22 +++------------ libxfs/rdwr.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 25 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index bb3ecd43..75c39407 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -562,6 +562,7 @@ main(int argc, char **argv) libxfs_init_t xargs; thread_args *tcarg; struct stat statbuf; + int error; progname = basename(argv[0]); @@ -710,14 +711,20 @@ main(int argc, char **argv) /* We don't yet know the sector size, so read maximal size */ libxfs_buftarg_init(&mbuf, xargs.ddev, xargs.logdev, xargs.rtdev); - sbp = libxfs_buf_read(mbuf.m_ddev_targp, XFS_SB_DADDR, - 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); + error = -libxfs_buf_read_uncached(mbuf.m_ddev_targp, XFS_SB_DADDR, + 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, &sbp, NULL); + if (error) { + do_log(_("%s: couldn't read superblock, error=%d\n"), + progname, error); + exit(1); + } + sb = &mbuf.m_sb; libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp)); /* Do it again, now with proper length and verifier */ libxfs_buf_relse(sbp); - libxfs_purgebuf(sbp); + sbp = libxfs_buf_read(mbuf.m_ddev_targp, XFS_SB_DADDR, 1 << (sb->sb_sectlog - BBSHIFT), 0, &xfs_sb_buf_ops); diff --git a/db/init.c b/db/init.c index acab349c..eb53d672 100644 --- a/db/init.c +++ b/db/init.c @@ -47,6 +47,7 @@ init( struct xfs_buf *bp; unsigned int agcount; int c; + int error; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -112,10 +113,9 @@ init( */ memset(&xmount, 0, sizeof(struct xfs_mount)); libxfs_buftarg_init(&xmount, x.ddev, x.logdev, x.rtdev); - bp = libxfs_buf_read(xmount.m_ddev_targp, XFS_SB_DADDR, - 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL); - - if (!bp || bp->b_error) { + error = -libxfs_buf_read_uncached(xmount.m_ddev_targp, XFS_SB_DADDR, + 1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, &bp, NULL); + if (error) { fprintf(stderr, _("%s: %s is invalid (cannot read first 512 " "bytes)\n"), progname, fsdevice); exit(1); @@ -124,7 +124,6 @@ init( /* copy SB from buffer to in-core, converting architecture as we go */ libxfs_sb_from_disk(&xmount.m_sb, XFS_BUF_TO_SBP(bp)); libxfs_buf_relse(bp); - libxfs_purgebuf(bp); sbp = &xmount.m_sb; if (sbp->sb_magicnum != XFS_SB_MAGIC) { diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index df267c98..1149e301 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -45,7 +45,9 @@ #define xfs_btree_init_block libxfs_btree_init_block #define xfs_buf_delwri_submit libxfs_buf_delwri_submit #define xfs_buf_get libxfs_buf_get +#define xfs_buf_get_uncached libxfs_buf_get_uncached #define xfs_buf_read libxfs_buf_read +#define xfs_buf_read_uncached libxfs_buf_read_uncached #define xfs_buf_relse libxfs_buf_relse #define xfs_bunmapi libxfs_bunmapi #define xfs_bwrite libxfs_bwrite diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index b01f2896..546b7710 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -257,23 +257,11 @@ xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t len) return 0; } -/* - * Allocate an uncached buffer that points nowhere. The refcount will be 1, - * and the cache node hash list will be empty to indicate that it's uncached. - */ -static inline struct xfs_buf * -xfs_buf_get_uncached(struct xfs_buftarg *targ, size_t bblen, int flags) -{ - struct xfs_buf *bp; - - bp = libxfs_getbufr(targ, XFS_BUF_DADDR_NULL, bblen); - if (!bp) - return NULL; - - INIT_LIST_HEAD(&bp->b_node.cn_hash); - bp->b_node.cn_count = 1; - return bp; -} +struct xfs_buf *libxfs_buf_get_uncached(struct xfs_buftarg *targ, size_t bblen, + int flags); +int libxfs_buf_read_uncached(struct xfs_buftarg *targ, xfs_daddr_t daddr, + size_t bblen, int flags, struct xfs_buf **bpp, + const struct xfs_buf_ops *ops); /* Push a single buffer on a delwri queue. */ static inline void diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 51f93c3e..ada20dd9 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1070,6 +1070,73 @@ libxfs_readbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, return bp; } +/* Allocate a raw uncached buffer. */ +static inline struct xfs_buf * +libxfs_getbufr_uncached( + struct xfs_buftarg *targ, + xfs_daddr_t daddr, + size_t bblen) +{ + struct xfs_buf *bp; + + bp = libxfs_getbufr(targ, daddr, bblen); + if (!bp) + return NULL; + + INIT_LIST_HEAD(&bp->b_node.cn_hash); + bp->b_node.cn_count = 1; + return bp; +} + +/* + * Allocate an uncached buffer that points nowhere. The refcount will be 1, + * and the cache node hash list will be empty to indicate that it's uncached. + */ +struct xfs_buf * +libxfs_buf_get_uncached( + struct xfs_buftarg *targ, + size_t bblen, + int flags) +{ + return libxfs_getbufr_uncached(targ, XFS_BUF_DADDR_NULL, bblen); +} + +/* + * Allocate and read an uncached buffer. The refcount will be 1, and the cache + * node hash list will be empty to indicate that it's uncached. + */ +int +libxfs_buf_read_uncached( + struct xfs_buftarg *targ, + xfs_daddr_t daddr, + size_t bblen, + int flags, + struct xfs_buf **bpp, + const struct xfs_buf_ops *ops) +{ + struct xfs_buf *bp; + int error; + + *bpp = NULL; + bp = libxfs_getbufr_uncached(targ, daddr, bblen); + if (!bp) + return -ENOMEM; + + error = libxfs_readbufr(targ, daddr, bp, bblen, flags); + if (error) + goto err; + + error = libxfs_readbuf_verify(bp, ops); + if (error) + goto err; + + *bpp = bp; + return 0; +err: + libxfs_buf_relse(bp); + return error; +} + static int __write_buf(int fd, void *buf, int len, off64_t offset, int flags) { From patchwork Thu Feb 20 01:43:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392951 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 AB4E41395 for ; Thu, 20 Feb 2020 01:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CBA024671 for ; Thu, 20 Feb 2020 01:43:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="a5ddXQRx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbgBTBns (ORCPT ); Wed, 19 Feb 2020 20:43:48 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49506 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBns (ORCPT ); Wed, 19 Feb 2020 20:43:48 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1cFj5039791; Thu, 20 Feb 2020 01:43: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-2020-01-29; bh=0l3bU7FdAb0o7V2b+zL+9XrihyZdMccUtI8HuecDlQs=; b=a5ddXQRxYN9D2xv9X3hwy2wAZlBvRodRBIocab3EGGB3pr4aTgxbccKmWy17IGsucukI MnEnu5ChEcsS4q+ccHaSUc1fJAULIv9Hcz139F0Yj4S0vB0lZmno4s9iIdpEGl+3dvrO Hx1Zey4A6q1dMMR4c1doqUOVLrokpo4DFatAJOMpOd2s0JUXURGZk8bbmBUjGwpkMqtd iaWPMlhAk4/C9wTYmKlqd22MBPgmklJqQMR3RoekiY14QQ0XFpblIXLHX2gt5lUxXK6U 5PVbJQ7oHYsEV3pAiz8oSj/CijR7Bbt1zdWl3WbC4/VakPpEMuQC9+4RNcqdnT/R7ilX jg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2y8ud16scc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:45 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1he0B114472; Thu, 20 Feb 2020 01:43:45 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2y8ud2g3wv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:45 +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 01K1hirt028138; Thu, 20 Feb 2020 01:43:44 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:44 -0800 Subject: [PATCH 11/18] libxlog: use uncached buffers instead of open-coding them From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:43 -0800 Message-ID: <158216302373.602314.13809511355239867956.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 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 new uncached buffer functions to manage buffers instead of open-coding the logic. Signed-off-by: Darrick J. Wong --- include/libxlog.h | 1 - libxlog/xfs_log_recover.c | 35 ++++++++++++++--------------------- logprint/log_print_all.c | 2 +- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/include/libxlog.h b/include/libxlog.h index 4b785507..5e94fa1e 100644 --- a/include/libxlog.h +++ b/include/libxlog.h @@ -75,7 +75,6 @@ extern libxfs_init_t x; extern int xlog_is_dirty(struct xfs_mount *, struct xlog *, libxfs_init_t *, int); extern struct xfs_buf *xlog_get_bp(struct xlog *, int); -extern void xlog_put_bp(struct xfs_buf *); extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks, xfs_buf_t *bp, char **offset); extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no, diff --git a/libxlog/xfs_log_recover.c b/libxlog/xfs_log_recover.c index 9324a213..e7e57bd2 100644 --- a/libxlog/xfs_log_recover.c +++ b/libxlog/xfs_log_recover.c @@ -67,14 +67,7 @@ xlog_get_bp( nbblks += log->l_sectBBsize; nbblks = round_up(nbblks, log->l_sectBBsize); - return libxfs_getbufr(log->l_dev, (xfs_daddr_t)-1, nbblks); -} - -void -xlog_put_bp( - xfs_buf_t *bp) -{ - libxfs_putbufr(bp); + return libxfs_buf_get_uncached(log->l_dev, nbblks, 0); } /* @@ -274,7 +267,7 @@ xlog_find_verify_cycle( *new_blk = -1; out: - xlog_put_bp(bp); + libxfs_buf_relse(bp); return error; } @@ -383,7 +376,7 @@ xlog_find_verify_log_record( *last_blk = i; out: - xlog_put_bp(bp); + libxfs_buf_relse(bp); return error; } @@ -634,7 +627,7 @@ xlog_find_head( goto bp_err; } - xlog_put_bp(bp); + libxfs_buf_relse(bp); if (head_blk == log_bbnum) *return_head_blk = 0; else @@ -648,7 +641,7 @@ xlog_find_head( return 0; bp_err: - xlog_put_bp(bp); + libxfs_buf_relse(bp); if (error) xfs_warn(log->l_mp, "failed to find log head"); @@ -745,7 +738,7 @@ xlog_find_tail( } if (!found) { xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__); - xlog_put_bp(bp); + libxfs_buf_relse(bp); ASSERT(0); return XFS_ERROR(EIO); } @@ -858,7 +851,7 @@ xlog_find_tail( error = xlog_clear_stale_blocks(log, tail_lsn); done: - xlog_put_bp(bp); + libxfs_buf_relse(bp); if (error) xfs_warn(log->l_mp, "failed to locate log tail"); @@ -906,7 +899,7 @@ xlog_find_zeroed( first_cycle = xlog_get_cycle(offset); if (first_cycle == 0) { /* completely zeroed log */ *blk_no = 0; - xlog_put_bp(bp); + libxfs_buf_relse(bp); return -1; } @@ -917,7 +910,7 @@ xlog_find_zeroed( last_cycle = xlog_get_cycle(offset); if (last_cycle != 0) { /* log completely written to */ - xlog_put_bp(bp); + libxfs_buf_relse(bp); return 0; } else if (first_cycle != 1) { /* @@ -974,7 +967,7 @@ xlog_find_zeroed( *blk_no = last_blk; bp_err: - xlog_put_bp(bp); + libxfs_buf_relse(bp); if (error) return error; return -1; @@ -1457,7 +1450,7 @@ xlog_do_recovery_pass( hblks = h_size / XLOG_HEADER_CYCLE_SIZE; if (h_size % XLOG_HEADER_CYCLE_SIZE) hblks++; - xlog_put_bp(hbp); + libxfs_buf_relse(hbp); hbp = xlog_get_bp(log, hblks); } else { hblks = 1; @@ -1473,7 +1466,7 @@ xlog_do_recovery_pass( return ENOMEM; dbp = xlog_get_bp(log, BTOBB(h_size)); if (!dbp) { - xlog_put_bp(hbp); + libxfs_buf_relse(hbp); return ENOMEM; } @@ -1657,8 +1650,8 @@ xlog_do_recovery_pass( } bread_err2: - xlog_put_bp(dbp); + libxfs_buf_relse(dbp); bread_err1: - xlog_put_bp(hbp); + libxfs_buf_relse(hbp); return error; } diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c index d3d4c07b..32d13719 100644 --- a/logprint/log_print_all.c +++ b/logprint/log_print_all.c @@ -39,7 +39,7 @@ xlog_print_find_oldest( error = xlog_find_cycle_start(log, bp, first_blk, last_blk, last_half_cycle); - xlog_put_bp(bp); + libxfs_buf_relse(bp); return error; } From patchwork Thu Feb 20 01:43:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392989 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 4FCD8109A for ; Thu, 20 Feb 2020 01:45:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3085224671 for ; Thu, 20 Feb 2020 01:45:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LMfx/iTS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727224AbgBTBpx (ORCPT ); Wed, 19 Feb 2020 20:45:53 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36454 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727211AbgBTBpx (ORCPT ); Wed, 19 Feb 2020 20:45:53 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hdxV064550; Thu, 20 Feb 2020 01:45:51 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-2020-01-29; bh=UVz2XuvqfkprsYTuxQrX9ud6p+JZbjoMdREPrzLF5pA=; b=LMfx/iTSeOFkEceB8XzhZn4pouqIv15TmBQLYKS/k/JZ2zdjtuVcCjNVBOb+q9pXaSq+ 1vGzF1m7/z7i5Im5PchXHF/oK0t2uJt/8aDiWw3wtBov7sJovx679eC3NAcUQlOEBDFv F5LXmDJoHa4np3SUeCl8hKNMMc53bbJjjkvpgb3SuzquUu7UX9vyksjPW3Rp03POk9+4 Z1IuQsq1k4NWfRma2/heCxKM56lqiBCWa+pFXwzZn5LnsjiUYlGYpuvUDK935cStvF4t jKtpUbZQ6J8O7tXl7mFRij7tAhIdfuHCrYfKaOokYdFYEB+ha/AWcUTbajZ9NsvytCsQ rg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2y8udket7j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:45:51 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gELJ094360; Thu, 20 Feb 2020 01:43:51 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2y8udbmh32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:51 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1ho5T002412; Thu, 20 Feb 2020 01:43:50 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:50 -0800 Subject: [PATCH 12/18] libxfs: use uncached buffers for initial mkfs writes From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:49 -0800 Message-ID: <158216302984.602314.15196666031325406487.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=25 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=2 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=2 spamscore=0 priorityscore=1501 adultscore=8 mlxscore=0 clxscore=1015 malwarescore=0 mlxlogscore=999 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Teach mkfs to use uncached buffers to write the start and end of the data device, the initial superblock, and the end of the realtime device instead of open-coding uncached buffers. This means we can get rid of libxfs_purgebuf since we handle the state from the start now. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_io.h | 1 - libxfs/rdwr.c | 12 ------------ mkfs/xfs_mkfs.c | 34 +++++++++++++++++++++++----------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 546b7710..6598dba7 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -213,7 +213,6 @@ struct xfs_buf *libxfs_getsb(struct xfs_mount *); extern void libxfs_bcache_purge(void); extern void libxfs_bcache_free(void); extern void libxfs_bcache_flush(void); -extern void libxfs_purgebuf(xfs_buf_t *); extern int libxfs_bcache_overflowed(void); /* Buffer (Raw) Interfaces */ diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index ada20dd9..20a8b0ce 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -869,18 +869,6 @@ libxfs_buf_relse( libxfs_putbufr(bp); } -void -libxfs_purgebuf(xfs_buf_t *bp) -{ - struct xfs_bufkey key = {NULL}; - - key.buftarg = bp->b_target; - key.blkno = bp->b_bn; - key.bblen = bp->b_length; - - cache_node_purge(libxfs_bcache, &key, (struct cache_node *)bp); -} - static struct cache_node * libxfs_balloc(cache_key_t key) { diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 9ca4cb1a..f58f235d 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3396,6 +3396,21 @@ finish_superblock_setup( } +/* Prepare an uncached buffer, ready to write something out. */ +static inline struct xfs_buf * +get_write_buf( + struct xfs_buftarg *btp, + xfs_daddr_t daddr, + int bblen) +{ + struct xfs_buf *bp; + + bp = libxfs_buf_get_uncached(btp, bblen, 0); + bp->b_bn = daddr; + bp->b_maps[0].bm_bn = daddr; + return bp; +} + /* * Sanitise the data and log devices and prepare them so libxfs can mount the * device successfully. Also check we can access the rt device if configured. @@ -3444,11 +3459,10 @@ prepare_devices( * the end of the device. (MD sb is ~64k from the end, take out a wider * swath to be sure) */ - buf = libxfs_buf_get(mp->m_ddev_targp, (xi->dsize - whack_blks), - whack_blks); + buf = get_write_buf(mp->m_ddev_targp, (xi->dsize - whack_blks), + whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); - libxfs_purgebuf(buf); /* * Now zero out the beginning of the device, to obliterate any old @@ -3456,18 +3470,17 @@ prepare_devices( * swap (somewhere around the page size), jfs (32k), * ext[2,3] and reiserfs (64k) - and hopefully all else. */ - buf = libxfs_buf_get(mp->m_ddev_targp, 0, whack_blks); + buf = get_write_buf(mp->m_ddev_targp, 0, whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); - libxfs_purgebuf(buf); /* OK, now write the superblock... */ - buf = libxfs_buf_get(mp->m_ddev_targp, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1)); + buf = get_write_buf(mp->m_ddev_targp, XFS_SB_DADDR, + XFS_FSS_TO_BB(mp, 1)); buf->b_ops = &xfs_sb_buf_ops; memset(buf->b_addr, 0, cfg->sectorsize); libxfs_sb_to_disk(buf->b_addr, sbp); libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); - libxfs_purgebuf(buf); /* ...and zero the log.... */ lsunit = sbp->sb_logsunit; @@ -3482,12 +3495,11 @@ prepare_devices( /* finally, check we can write the last block in the realtime area */ if (mp->m_rtdev_targp->dev && cfg->rtblocks > 0) { - buf = libxfs_buf_get(mp->m_rtdev_targp, - XFS_FSB_TO_BB(mp, cfg->rtblocks - 1LL), - BTOBB(cfg->blocksize)); + buf = get_write_buf(mp->m_rtdev_targp, + XFS_FSB_TO_BB(mp, cfg->rtblocks - 1LL), + BTOBB(cfg->blocksize)); memset(buf->b_addr, 0, cfg->blocksize); libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); - libxfs_purgebuf(buf); } } From patchwork Thu Feb 20 01:43:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392957 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 D41DF138D for ; Thu, 20 Feb 2020 01:44:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A34C924670 for ; Thu, 20 Feb 2020 01:44:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="nHbr38xs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgBTBoD (ORCPT ); Wed, 19 Feb 2020 20:44:03 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49656 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBoD (ORCPT ); Wed, 19 Feb 2020 20:44:03 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1cvBS039922; Thu, 20 Feb 2020 01:43:58 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-2020-01-29; bh=F/h4fO5JyMJp1JwLur4LstT0JlqqW0Ma/8WvZl96Afw=; b=nHbr38xsAl/VO30B+ZwLPdtA3pudiY46PJhzIBxi7mQ3Vs3qSCJrj2L6rwwefB0OwxYI T8qAjOUvvxn4DUXvd6T/QNJyHv1NFV2uUMJTOTC4GvJuYY6hMeiM325owrN7czFWnM6e etd+kgeYMiH/cS6ttL/0S1CdveRlBu3Ev6N1Dw5RYknC0e0ejaM5s2ulcth+4aYmyeP4 FRdllXzYthZjgyPC6HBaVvJpBKrWU9IDFVLE4xFX/dzV7V7uGVw+TyyYQlHWY5whF8HR 4I7NHaVJfnJOrbW61ew6PIB3mGoQ8EyxRJEY+Ccwx3sMnEIjoH/uPAMzTqt5fzcvrZ0f gA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2y8ud16scr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:58 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1g7TL188816; Thu, 20 Feb 2020 01:43:57 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2y8ud973jv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:43:57 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 01K1hvMT003311; Thu, 20 Feb 2020 01:43:57 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:43:56 -0800 Subject: [PATCH 13/18] libxfs: straighten out libxfs_writebuf confusion From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:43:55 -0800 Message-ID: <158216303592.602314.4622638173533560298.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=2 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=2 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200010 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong libxfs_writebuf is not a well named function -- it marks the buffer dirty and then releases the caller's reference. The actual write comes when the cache is flushed, either because someone explicitly told the cache to flush or because we started buffer reclaim. Make the buffer release explicit in the callers and rename the function to say what it actually does -- it marks the buffer dirty outside of transaction context. Signed-off-by: Darrick J. Wong --- libxfs/libxfs_io.h | 10 +++++----- libxfs/rdwr.c | 21 ++++++++++++++------- libxfs/trans.c | 3 ++- mkfs/proto.c | 6 ++++-- mkfs/xfs_mkfs.c | 21 ++++++++++++++------- repair/attr_repair.c | 17 +++++++++-------- repair/da_util.c | 12 ++++++++---- repair/dino_chunks.c | 6 ++++-- repair/dinode.c | 12 ++++++++---- repair/dir2.c | 9 ++++++--- repair/phase3.c | 6 ++++-- repair/phase5.c | 42 ++++++++++++++++++++++++++++-------------- repair/rmap.c | 3 ++- repair/scan.c | 21 ++++++++++++++------- repair/xfs_repair.c | 3 ++- 15 files changed, 124 insertions(+), 68 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 6598dba7..ad8acc1e 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -138,8 +138,8 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \ libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \ (dev), (map), (nmaps), (flags), (ops)) -#define libxfs_writebuf(buf, flags) \ - libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \ +#define libxfs_buf_dirty(buf, flags) \ + libxfs_trace_dirtybuf(__FUNCTION__, __FILE__, __LINE__, \ (buf), (flags)) #define libxfs_buf_get(dev, daddr, len) \ libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ @@ -159,8 +159,8 @@ struct xfs_buf *libxfs_trace_readbuf(const char *func, const char *file, extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int, struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); -extern int libxfs_trace_writebuf(const char *, const char *, int, - xfs_buf_t *, int); +void libxfs_trace_dirtybuf(const char *func, const char *file, int line, + struct xfs_buf *bp, int flags); struct xfs_buf *libxfs_trace_getbuf(const char *func, const char *file, int line, struct xfs_buftarg *btp, xfs_daddr_t daddr, size_t len); @@ -175,7 +175,7 @@ extern void libxfs_trace_putbuf (const char *, const char *, int, extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); -extern int libxfs_writebuf(xfs_buf_t *, int); +void libxfs_buf_dirty(struct xfs_buf *bp, int flags); extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 20a8b0ce..af363bef 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -425,11 +425,16 @@ libxfs_trace_readbuf( return bp; } -int -libxfs_trace_writebuf(const char *func, const char *file, int line, xfs_buf_t *bp, int flags) +void +libxfs_trace_dirtybuf( + const char *func, + const char *file, + int line, + struct xfs_buf *bp, + int flags) { __add_trace(bp, func, file, line); - return libxfs_writebuf(bp, flags); + libxfs_buf_dirty(bp, flags); } struct xfs_buf * @@ -1233,8 +1238,12 @@ libxfs_writebuf_int(xfs_buf_t *bp, int flags) return 0; } -int -libxfs_writebuf( +/* + * Mark a buffer dirty. The dirty data will be written out when the cache + * is flushed (or at release time if the buffer is uncached). + */ +void +libxfs_buf_dirty( struct xfs_buf *bp, int flags) { @@ -1256,8 +1265,6 @@ libxfs_writebuf( bp->b_error = 0; bp->b_flags &= ~LIBXFS_B_STALE; bp->b_flags |= bflags; - libxfs_buf_relse(bp); - return 0; } void diff --git a/libxfs/trans.c b/libxfs/trans.c index 59cb897f..4c208422 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -843,7 +843,8 @@ inode_item_done( goto free; } - libxfs_writebuf(bp, 0); + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); free: xfs_inode_item_put(iip); } diff --git a/mkfs/proto.c b/mkfs/proto.c index 0025fa08..de5ae306 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -261,8 +261,10 @@ newfile( memset((char *)bp->b_addr + len, 0, bp->b_bcount - len); if (logit) libxfs_trans_log_buf(tp, bp, 0, bp->b_bcount - 1); - else - libxfs_writebuf(bp, LIBXFS_WRITEBUF_FAIL_EXIT); + else { + libxfs_buf_dirty(bp, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(bp); + } } ip->i_d.di_size = len; return flags; diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index f58f235d..b50b8b3a 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3462,7 +3462,8 @@ prepare_devices( buf = get_write_buf(mp->m_ddev_targp, (xi->dsize - whack_blks), whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); /* * Now zero out the beginning of the device, to obliterate any old @@ -3472,7 +3473,8 @@ prepare_devices( */ buf = get_write_buf(mp->m_ddev_targp, 0, whack_blks); memset(buf->b_addr, 0, WHACK_SIZE); - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); /* OK, now write the superblock... */ buf = get_write_buf(mp->m_ddev_targp, XFS_SB_DADDR, @@ -3480,7 +3482,8 @@ prepare_devices( buf->b_ops = &xfs_sb_buf_ops; memset(buf->b_addr, 0, cfg->sectorsize); libxfs_sb_to_disk(buf->b_addr, sbp); - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); /* ...and zero the log.... */ lsunit = sbp->sb_logsunit; @@ -3499,7 +3502,8 @@ prepare_devices( XFS_FSB_TO_BB(mp, cfg->rtblocks - 1LL), BTOBB(cfg->blocksize)); memset(buf->b_addr, 0, cfg->blocksize); - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); } } @@ -3591,7 +3595,8 @@ rewrite_secondary_superblocks( XFS_FSS_TO_BB(mp, 1), LIBXFS_READBUF_FAIL_EXIT, &xfs_sb_buf_ops); XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino); - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); /* and one in the middle for luck if there's enough AGs for that */ if (mp->m_sb.sb_agcount <= 2) @@ -3603,7 +3608,8 @@ rewrite_secondary_superblocks( XFS_FSS_TO_BB(mp, 1), LIBXFS_READBUF_FAIL_EXIT, &xfs_sb_buf_ops); XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino); - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); } static void @@ -3951,7 +3957,8 @@ main( if (!buf || buf->b_error) exit(1); (XFS_BUF_TO_SBP(buf))->sb_inprogress = 0; - libxfs_writebuf(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_dirty(buf, LIBXFS_WRITEBUF_FAIL_EXIT); + libxfs_buf_relse(buf); /* Make sure our new fs made it to stable storage. */ libxfs_flush_devices(mp, &d, &l, &r); diff --git a/repair/attr_repair.c b/repair/attr_repair.c index cc20b1a1..fb64b0be 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -835,8 +835,10 @@ process_leaf_attr_level(xfs_mount_t *mp, if (!no_modify && bp->b_error == -EFSBADCRC) repair++; - if (repair && !no_modify) - libxfs_writebuf(bp, 0); + if (repair && !no_modify) { + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); + } else libxfs_buf_relse(bp); } while (da_bno != 0); @@ -999,9 +1001,8 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 " *repair = *repair || repairlinks; if (*repair && !no_modify) - libxfs_writebuf(bp, 0); - else - libxfs_buf_relse(bp); + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); return 0; } @@ -1043,9 +1044,9 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 " /* must do this now, to release block 0 before the traversal */ if ((*repair || repairlinks) && !no_modify) { *repair = 1; - libxfs_writebuf(bp, 0); - } else - libxfs_buf_relse(bp); + libxfs_buf_dirty(bp, 0); + } + libxfs_buf_relse(bp); error = process_node_attr(mp, ino, dip, blkmap); /* + repair */ if (error) *repair = 0; diff --git a/repair/da_util.c b/repair/da_util.c index c02d621c..d1e17ec3 100644 --- a/repair/da_util.c +++ b/repair/da_util.c @@ -403,8 +403,10 @@ _("would correct bad hashval in non-leaf %s block\n" ASSERT(cursor->level[this_level].dirty == 0 || (cursor->level[this_level].dirty && !no_modify)); - if (cursor->level[this_level].dirty && !no_modify) - libxfs_writebuf(cursor->level[this_level].bp, 0); + if (cursor->level[this_level].dirty && !no_modify) { + libxfs_buf_dirty(cursor->level[this_level].bp, 0); + libxfs_buf_relse(cursor->level[this_level].bp); + } else libxfs_buf_relse(cursor->level[this_level].bp); @@ -619,8 +621,10 @@ _("bad level %d in %s block %u for inode %" PRIu64 "\n"), cursor->level[this_level].bp->b_error == -EFSBADCRC) cursor->level[this_level].dirty = 1; - if (cursor->level[this_level].dirty && !no_modify) - libxfs_writebuf(cursor->level[this_level].bp, 0); + if (cursor->level[this_level].dirty && !no_modify) { + libxfs_buf_dirty(cursor->level[this_level].bp, 0); + libxfs_buf_relse(cursor->level[this_level].bp); + } else libxfs_buf_relse(cursor->level[this_level].bp); diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c index 76e9f773..1378fc59 100644 --- a/repair/dino_chunks.c +++ b/repair/dino_chunks.c @@ -939,8 +939,10 @@ process_inode_chunk( bplist[bp_index], (long long) XFS_BUF_ADDR(bplist[bp_index]), agno); - if (dirty && !no_modify) - libxfs_writebuf(bplist[bp_index], 0); + if (dirty && !no_modify) { + libxfs_buf_dirty(bplist[bp_index], 0); + libxfs_buf_relse(bplist[bp_index]); + } else libxfs_buf_relse(bplist[bp_index]); } diff --git a/repair/dinode.c b/repair/dinode.c index 848eac09..276dd2e1 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -1231,8 +1231,10 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 " } } - if (writebuf && !no_modify) - libxfs_writebuf(bp, 0); + if (writebuf && !no_modify) { + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); + } else libxfs_buf_relse(bp); } @@ -1328,8 +1330,10 @@ _("bad symlink header ino %" PRIu64 ", file block %d, disk block %" PRIu64 "\n") offset += byte_cnt; i++; - if (badcrc && !no_modify) - libxfs_writebuf(bp, 0); + if (badcrc && !no_modify) { + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); + } else libxfs_buf_relse(bp); } diff --git a/repair/dir2.c b/repair/dir2.c index 769e341c..a8b8de58 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -1010,7 +1010,8 @@ _("bad directory block magic # %#x in block %u for directory inode %" PRIu64 "\n dirty = 1; if (dirty && !no_modify) { *repair = 1; - libxfs_writebuf(bp, 0); + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); } else libxfs_buf_relse(bp); return rval; @@ -1180,7 +1181,8 @@ _("bad sibling back pointer for block %u in directory inode %" PRIu64 "\n"), ASSERT(buf_dirty == 0 || (buf_dirty && !no_modify)); if (buf_dirty && !no_modify) { *repair = 1; - libxfs_writebuf(bp, 0); + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); } else libxfs_buf_relse(bp); } while (da_bno != 0); @@ -1339,7 +1341,8 @@ _("bad directory block magic # %#x in block %" PRIu64 " for directory inode %" P } if (dirty && !no_modify) { *repair = 1; - libxfs_writebuf(bp, 0); + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); } else libxfs_buf_relse(bp); } diff --git a/repair/phase3.c b/repair/phase3.c index 886acd1f..396743a4 100644 --- a/repair/phase3.c +++ b/repair/phase3.c @@ -46,8 +46,10 @@ process_agi_unlinked( } } - if (agi_dirty) - libxfs_writebuf(bp, 0); + if (agi_dirty) { + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); + } else libxfs_buf_relse(bp); } diff --git a/repair/phase5.c b/repair/phase5.c index cdbf6697..561a6b3f 100644 --- a/repair/phase5.c +++ b/repair/phase5.c @@ -321,9 +321,11 @@ write_cursor(bt_status_t *curs) fprintf(stderr, "writing bt prev block %u\n", curs->level[i].prev_agbno); #endif - libxfs_writebuf(curs->level[i].prev_buf_p, 0); + libxfs_buf_dirty(curs->level[i].prev_buf_p, 0); + libxfs_buf_relse(curs->level[i].prev_buf_p); } - libxfs_writebuf(curs->level[i].buf_p, 0); + libxfs_buf_dirty(curs->level[i].buf_p, 0); + libxfs_buf_relse(curs->level[i].buf_p); } } @@ -681,7 +683,8 @@ prop_freespace_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, #endif if (lptr->prev_agbno != NULLAGBLOCK) { ASSERT(lptr->prev_buf_p != NULL); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_agbno = lptr->agbno;; lptr->prev_buf_p = lptr->buf_p; @@ -870,7 +873,8 @@ build_freespace_tree(xfs_mount_t *mp, xfs_agnumber_t agno, lptr->prev_agbno); #endif ASSERT(lptr->prev_agbno != NULLAGBLOCK); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_buf_p = lptr->buf_p; lptr->prev_agbno = lptr->agbno; @@ -1046,7 +1050,8 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs, #endif if (lptr->prev_agbno != NULLAGBLOCK) { ASSERT(lptr->prev_buf_p != NULL); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_agbno = lptr->agbno;; lptr->prev_buf_p = lptr->buf_p; @@ -1137,7 +1142,8 @@ build_agi(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs, agi->agi_free_level = cpu_to_be32(finobt_curs->num_levels); } - libxfs_writebuf(agi_buf, 0); + libxfs_buf_dirty(agi_buf, 0); + libxfs_buf_relse(agi_buf); } /* @@ -1299,7 +1305,8 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnumber_t agno, lptr->prev_agbno); #endif ASSERT(lptr->prev_agbno != NULLAGBLOCK); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_buf_p = lptr->buf_p; lptr->prev_agbno = lptr->agbno; @@ -1451,7 +1458,8 @@ prop_rmap_cursor( #endif if (lptr->prev_agbno != NULLAGBLOCK) { ASSERT(lptr->prev_buf_p != NULL); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_agbno = lptr->agbno; lptr->prev_buf_p = lptr->buf_p; @@ -1661,7 +1669,8 @@ _("Insufficient memory to construct reverse-map cursor.")); lptr->prev_agbno); #endif ASSERT(lptr->prev_agbno != NULLAGBLOCK); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_buf_p = lptr->buf_p; lptr->prev_agbno = lptr->agbno; @@ -1801,7 +1810,8 @@ prop_refc_cursor( #endif if (lptr->prev_agbno != NULLAGBLOCK) { ASSERT(lptr->prev_buf_p != NULL); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_agbno = lptr->agbno; lptr->prev_buf_p = lptr->buf_p; @@ -1954,7 +1964,8 @@ _("Insufficient memory to construct refcount cursor.")); lptr->prev_agbno); #endif ASSERT(lptr->prev_agbno != NULLAGBLOCK); - libxfs_writebuf(lptr->prev_buf_p, 0); + libxfs_buf_dirty(lptr->prev_buf_p, 0); + libxfs_buf_relse(lptr->prev_buf_p); } lptr->prev_buf_p = lptr->buf_p; lptr->prev_agbno = lptr->agbno; @@ -2142,7 +2153,8 @@ _("Insufficient memory saving lost blocks.\n")); agf->agf_flcount = 0; } - libxfs_writebuf(agfl_buf, 0); + libxfs_buf_dirty(agfl_buf, 0); + libxfs_buf_relse(agfl_buf); ext_ptr = findbiggest_bcnt_extent(agno); agf->agf_longest = cpu_to_be32((ext_ptr != NULL) ? @@ -2155,7 +2167,8 @@ _("Insufficient memory saving lost blocks.\n")); ASSERT(be32_to_cpu(agf->agf_refcount_root) != be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNTi])); - libxfs_writebuf(agf_buf, 0); + libxfs_buf_dirty(agf_buf, 0); + libxfs_buf_relse(agf_buf); /* * now fix up the free list appropriately @@ -2189,7 +2202,8 @@ sync_sb(xfs_mount_t *mp) update_sb_version(mp); libxfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb); - libxfs_writebuf(bp, 0); + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); } /* diff --git a/repair/rmap.c b/repair/rmap.c index bc53e6c0..c8c851a6 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -1231,7 +1231,8 @@ _("setting reflink flag on inode %"PRIu64"\n"), else dino->di_flags2 &= cpu_to_be64(~XFS_DIFLAG2_REFLINK); libxfs_dinode_calc_crc(mp, dino); - libxfs_writebuf(buf, 0); + libxfs_buf_dirty(buf, 0); + libxfs_buf_relse(buf); return 0; } diff --git a/repair/scan.c b/repair/scan.c index f4e4fef5..8b91b27e 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -151,8 +151,10 @@ scan_lbtree( ASSERT(dirty == 0 || (dirty && !no_modify)); - if ((dirty || badcrc) && !no_modify) - libxfs_writebuf(bp, 0); + if ((dirty || badcrc) && !no_modify) { + libxfs_buf_dirty(bp, 0); + libxfs_buf_relse(bp); + } else libxfs_buf_relse(bp); @@ -2429,13 +2431,17 @@ scan_ag( sb_dirty += (sbbuf->b_error == -EFSBADCRC); } - if (agi_dirty && !no_modify) - libxfs_writebuf(agibuf, 0); + if (agi_dirty && !no_modify) { + libxfs_buf_dirty(agibuf, 0); + libxfs_buf_relse(agibuf); + } else libxfs_buf_relse(agibuf); - if (agf_dirty && !no_modify) - libxfs_writebuf(agfbuf, 0); + if (agf_dirty && !no_modify) { + libxfs_buf_dirty(agfbuf, 0); + libxfs_buf_relse(agfbuf); + } else libxfs_buf_relse(agfbuf); @@ -2443,7 +2449,8 @@ scan_ag( if (agno == 0) memcpy(&mp->m_sb, sb, sizeof(xfs_sb_t)); libxfs_sb_to_disk(XFS_BUF_TO_SBP(sbbuf), sb); - libxfs_writebuf(sbbuf, 0); + libxfs_buf_dirty(sbbuf, 0); + libxfs_buf_relse(sbbuf); } else libxfs_buf_relse(sbbuf); free(sb); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 8642c5cd..2189c9fd 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -1126,7 +1126,8 @@ _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\ be32_to_cpu(dsb->sb_unit), be32_to_cpu(dsb->sb_width)); } - libxfs_writebuf(sbp, 0); + libxfs_buf_dirty(sbp, 0); + libxfs_buf_relse(sbp); /* * Done. Flush all cached buffers and inodes first to ensure all From patchwork Thu Feb 20 01:44:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392959 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 1D1E917E0 for ; Thu, 20 Feb 2020 01:44:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F267E24670 for ; Thu, 20 Feb 2020 01:44:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LJdPzYBL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbgBTBoI (ORCPT ); Wed, 19 Feb 2020 20:44:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49838 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBoI (ORCPT ); Wed, 19 Feb 2020 20:44:08 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1i6le168816; Thu, 20 Feb 2020 01:44:06 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-2020-01-29; bh=e5TDcAj6R+CUEt1VHfWggcvXOk6Gx9Ps4BCeEEi3suc=; b=LJdPzYBLFaCmJXnB6OIz6lEYDDDhoDMM6aG+HctQ7/kRtjErKJ+r6a6Mtl+EGcn2jErL OzLNsvr1MazDLI5/ID8UDsy4aqB2TXSXqCjp341By/EWDRibHI9EARyvwigA8rbwbs30 TDP+A0lOxOe2gZGh4ls32H3S/t80/a7Y/Emfq3AjkoHOfaxVopNYycoUZFAyFxmaSNva 3q8JqpMi/FK5kTT6a6vkxjoXXQZqLusQM2NeS9B9X1naGdNFOhiIKzudQylJl7bUHLPJ QdeEgkKYmL7XkPYC+yov4PKcFT1Htp+5l0vOgMJPJqIncdgdJDRoo+JqZoXZDKc3GV80 6g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2y8ud16sdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:06 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gCAR188971; Thu, 20 Feb 2020 01:44:05 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2y8ud973ts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:05 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 01K1i4aO028203; Thu, 20 Feb 2020 01:44:04 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:44:03 -0800 Subject: [PATCH 14/18] libxfs: remove libxfs_writebuf_int From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:44:02 -0800 Message-ID: <158216304216.602314.17621620292262138084.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong This function is the same as libxfs_buf_dirty so use that instead. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_io.h | 1 - libxfs/rdwr.c | 13 ------------- libxfs/trans.c | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index ad8acc1e..1f6e6d97 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -219,7 +219,6 @@ extern int libxfs_bcache_overflowed(void); extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int); extern void libxfs_putbufr(xfs_buf_t *); -extern int libxfs_writebuf_int(xfs_buf_t *, int); int libxfs_bwrite(struct xfs_buf *); extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int); extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int); diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index af363bef..9302a698 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1225,19 +1225,6 @@ libxfs_bwrite( return bp->b_error; } -int -libxfs_writebuf_int(xfs_buf_t *bp, int flags) -{ - /* - * Clear any error hanging over from reading the buffer. This prevents - * subsequent reads after this write from seeing stale errors. - */ - bp->b_error = 0; - bp->b_flags &= ~LIBXFS_B_STALE; - bp->b_flags |= (LIBXFS_B_DIRTY | flags); - return 0; -} - /* * Mark a buffer dirty. The dirty data will be written out when the cache * is flushed (or at release time if the buffer is uncached). diff --git a/libxfs/trans.c b/libxfs/trans.c index 4c208422..e23ae598 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -863,7 +863,7 @@ buf_item_done( hold = (bip->bli_flags & XFS_BLI_HOLD); if (bip->bli_flags & XFS_BLI_DIRTY) - libxfs_writebuf_int(bp, 0); + libxfs_buf_dirty(bp, 0); bip->bli_flags &= ~XFS_BLI_HOLD; xfs_buf_item_put(bip); From patchwork Thu Feb 20 01:44:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392961 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 1E20C1395 for ; Thu, 20 Feb 2020 01:44:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F386824671 for ; Thu, 20 Feb 2020 01:44:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="C+h/VV2y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbgBTBoN (ORCPT ); Wed, 19 Feb 2020 20:44:13 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:45714 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBoN (ORCPT ); Wed, 19 Feb 2020 20:44:13 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gqIw092800; Thu, 20 Feb 2020 01:44:11 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-2020-01-29; bh=Z5DXU59GpncfwPPbhxDiVAwd6cFF5G7OGB4FUTGC3ro=; b=C+h/VV2yEYvHurLWzEhM0CvoXcZyAJyXGZukuGxMcZ80//HseTArJMBIY1k9nZ5zzJtD bBaRdMq/7KHq5Xcyd+uq7Q2JEJQAoY5JulxM8/xUOZpge7eahhxkqj6EqaXjFjriEEb8 EVQ0qHj9+2bAAT2W4zjHxq6T3+6AXvelq+Xh0wPz11v/ACWP2kyuMUpz2YT1Md/RGZK0 sZZeGuduPu+B5ZNRkpeHAoYJwYF1FQLIH+WH76gbL95/FpHV5ucQfrC6TqMUw2KiQMav ZILpzJVWRhvToAPu+cXUzpqqjFns0ETh1DZFlYMUNad6Tya5ATpoj1TBR2nwCYchkd/A EQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2y8udd6tfq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:11 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1ggpk094941; Thu, 20 Feb 2020 01:44:10 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2y8udbmhmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:10 +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 01K1iADG002598; Thu, 20 Feb 2020 01:44:10 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:44:09 -0800 Subject: [PATCH 15/18] libxfs: hide libxfs_{get,put}bufr From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:44:09 -0800 Message-ID: <158216304905.602314.17780460003947176973.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=758 malwarescore=0 bulkscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 mlxlogscore=816 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Hide these two functions because they're not used outside of rdwr.c. Signed-off-by: Darrick J. Wong --- libxfs/libxfs_io.h | 3 --- libxfs/rdwr.c | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 1f6e6d97..7d96c2a3 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -216,9 +216,6 @@ extern void libxfs_bcache_flush(void); extern int libxfs_bcache_overflowed(void); /* Buffer (Raw) Interfaces */ -extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int); -extern void libxfs_putbufr(xfs_buf_t *); - int libxfs_bwrite(struct xfs_buf *); extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int); extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int); diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 9302a698..bab70dfd 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -52,6 +52,10 @@ * propagation of stale errors into future buffer operations. */ +static struct xfs_buf *libxfs_getbufr(struct xfs_buftarg *btp, + xfs_daddr_t daddr, int len); +static void libxfs_putbufr(struct xfs_buf *bp); + #define BDSTRAT_SIZE (256 * 1024) #define IO_BCOMPARE_CHECK @@ -666,7 +670,7 @@ __libxfs_getbufr(int blen) return bp; } -xfs_buf_t * +static xfs_buf_t * libxfs_getbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, int bblen) { xfs_buf_t *bp; @@ -1360,7 +1364,7 @@ libxfs_bflush( return bp->b_error; } -void +static void libxfs_putbufr(xfs_buf_t *bp) { if (bp->b_flags & LIBXFS_B_DIRTY) From patchwork Thu Feb 20 01:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392963 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 0CDB8138D for ; Thu, 20 Feb 2020 01:44:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E117724671 for ; Thu, 20 Feb 2020 01:44:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TwnsVI2I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727291AbgBTBoT (ORCPT ); Wed, 19 Feb 2020 20:44:19 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:34582 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBoT (ORCPT ); Wed, 19 Feb 2020 20:44:19 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1hJWI064443; Thu, 20 Feb 2020 01:44:17 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-2020-01-29; bh=C6jDziIBegjb8Uwoj/2XST1lr36u+2RT1EaUFeBV2T4=; b=TwnsVI2IKvDnX/XOhpuFIVZ03eywBo3ETa/FdNwL0m2r51+klXuErA4TXc2br/bOxdrN kQEQa+7VXgYdB6PFiVajzwjaWZ6stIIOOGQxu9jJXbtR6SX6T+Sqryfx+7d7tKsdD6gz 854KZY/iBPGcm5Ihw207bknBxTZP54IzPW7tGO/lypzITd8KIw8IZmjZ5EbA3Guak8Pp O0NFfEvyFV3PebQ2rM6eqlDVhXs1Agac8ADlPOx13Kkxlsd7RnbLesgdOuVPnp1i8jHF VGOembOH/ydYtG4rsoH4CzxCryYBl6NT8YcV+IUEGsmI2UiWxOAvwFvDZOk20nVLmWxK WA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2y8udket2b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:17 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gRfn094696; Thu, 20 Feb 2020 01:44:17 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2y8udbmhrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:16 +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 01K1iGpF002612; Thu, 20 Feb 2020 01:44:16 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:44:16 -0800 Subject: [PATCH 16/18] libxfs: hide libxfs_getbuf_flags From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:44:15 -0800 Message-ID: <158216305519.602314.7497657265091013884.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=748 malwarescore=0 bulkscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 clxscore=1015 malwarescore=0 mlxlogscore=803 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Hide this function since it's internal to rdwr.c. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_io.h | 7 ------- libxfs/rdwr.c | 21 ++++++--------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 7d96c2a3..32f8fde7 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -147,9 +147,6 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_getbuf_map(dev, map, nmaps, flags) \ libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \ (dev), (map), (nmaps), (flags)) -#define libxfs_getbuf_flags(dev, daddr, len, flags) \ - libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \ - (dev), (daddr), (len), (flags)) #define libxfs_buf_relse(buf) \ libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) @@ -166,8 +163,6 @@ struct xfs_buf *libxfs_trace_getbuf(const char *func, const char *file, size_t len); extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int, struct xfs_buftarg *, struct xfs_buf_map *, int, int); -extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int, - struct xfs_buftarg *, xfs_daddr_t, int, unsigned int); extern void libxfs_trace_putbuf (const char *, const char *, int, xfs_buf_t *); @@ -178,8 +173,6 @@ extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, void libxfs_buf_dirty(struct xfs_buf *bp, int flags); extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); -extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, - int, unsigned int); void libxfs_buf_relse(struct xfs_buf *); static inline struct xfs_buf* diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index bab70dfd..f46787a6 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -388,7 +388,6 @@ libxfs_log_header( #undef libxfs_readbuf_map #undef libxfs_writebuf #undef libxfs_getbuf_map -#undef libxfs_getbuf_flags xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); @@ -397,8 +396,6 @@ struct xfs_buf *libxfs_buf_get(struct xfs_buftarg *btp, xfs_daddr_t daddr, size_t len); xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); -xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, int, - unsigned int); void libxfs_buf_relse(struct xfs_buf *); #define __add_trace(bp, func, file, line) \ @@ -468,15 +465,6 @@ libxfs_trace_getbuf_map(const char *func, const char *file, int line, return bp; } -xfs_buf_t * -libxfs_trace_getbuf_flags(const char *func, const char *file, int line, - struct xfs_buftarg *btp, xfs_daddr_t blkno, int len, unsigned int flags) -{ - xfs_buf_t *bp = libxfs_getbuf_flags(btp, blkno, len, flags); - __add_trace(bp, func, file, line); - return bp; -} - void libxfs_trace_putbuf(const char *func, const char *file, int line, xfs_buf_t *bp) { @@ -780,9 +768,12 @@ __cache_lookup(struct xfs_bufkey *key, unsigned int flags) return NULL; } -struct xfs_buf * -libxfs_getbuf_flags(struct xfs_buftarg *btp, xfs_daddr_t blkno, int len, - unsigned int flags) +static struct xfs_buf * +libxfs_getbuf_flags( + struct xfs_buftarg *btp, + xfs_daddr_t blkno, + int len, + unsigned int flags) { struct xfs_bufkey key = {NULL}; From patchwork Thu Feb 20 01:44:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392965 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 16DB21395 for ; Thu, 20 Feb 2020 01:44:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3D1424670 for ; Thu, 20 Feb 2020 01:44:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iYOls1HM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgBTBoZ (ORCPT ); Wed, 19 Feb 2020 20:44:25 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:45852 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgBTBoZ (ORCPT ); Wed, 19 Feb 2020 20:44:25 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gp8x092701; Thu, 20 Feb 2020 01:44:23 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-2020-01-29; bh=f1VDn8fvbJ2Q45T+U7WRfUS2ZGa6xia+A3TXDvCp9Jo=; b=iYOls1HMqCEHOdFJ5gI10XAQ43ySuQ7n9PgxKxXDUXDLnaXDvwBycBMoUJcrDZKrhxy+ lM+Pn5LtThejv4duYL7JFz1QnouDn1DRLtEmiSoX/B2y1LNVkxckf1L/7bXO3+8V2sz8 dYmbwK6u5VlCGx6W6Lf61bfYJEioEFeRNn7Yus6iROqDbwABJJaVP2oPlHy+VbICNW7N Fsa4j80DU21nVRGOaTGIcPn7AxQVikS+JRbSxRQ12CtzLe8HxKnkcDW+YJuGiXBYcBRK jheA7VnuQrziBBamdriMJB5WbKDtuJW3RaUvFDmwZp4bk3LmxuNLjRJyj2UdAFUr8Y5R 9w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2y8udd6tg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:23 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gMje146790; Thu, 20 Feb 2020 01:44:23 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2y8ud4pyvj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:44:23 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1iMPV006690; Thu, 20 Feb 2020 01:44:22 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:44:22 -0800 Subject: [PATCH 17/18] libxfs: rename libxfs_readbuf_map to libxfs_buf_read_map From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 19 Feb 2020 17:44:21 -0800 Message-ID: <158216306157.602314.3988177354387047296.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> References: <158216295405.602314.2094526611933874427.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 suspectscore=2 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=2 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Rename this function to match the kernel function. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/io.c | 2 +- libxfs/libxfs_io.h | 6 +++--- libxfs/rdwr.c | 8 ++++---- libxfs/trans.c | 4 ++-- repair/da_util.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/io.c b/db/io.c index 7c7a4624..b81e9969 100644 --- a/db/io.c +++ b/db/io.c @@ -542,7 +542,7 @@ set_cur( if (!iocur_top->bbmap) return; memcpy(iocur_top->bbmap, bbmap, sizeof(struct bbmap)); - bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b, + bp = libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b, bbmap->nmaps, 0, ops); } else { bp = libxfs_buf_read(mp->m_ddev_targp, blknum, len, 0, ops); diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 32f8fde7..8e9af208 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -135,7 +135,7 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_buf_read(dev, daddr, len, flags, ops) \ libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \ (dev), (daddr), (len), (flags), (ops)) -#define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \ +#define libxfs_buf_read_map(dev, map, nmaps, flags, ops) \ libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \ (dev), (map), (nmaps), (flags), (ops)) #define libxfs_buf_dirty(buf, flags) \ @@ -168,7 +168,7 @@ extern void libxfs_trace_putbuf (const char *, const char *, int, #else -extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, +extern xfs_buf_t *libxfs_buf_read_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); void libxfs_buf_dirty(struct xfs_buf *bp, int flags); extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, @@ -196,7 +196,7 @@ libxfs_buf_read( { DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); - return libxfs_readbuf_map(target, &map, 1, flags, ops); + return libxfs_buf_read_map(target, &map, 1, flags, ops); } #endif /* XFS_BUF_TRACING */ diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index f46787a6..531f24e3 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -385,11 +385,11 @@ libxfs_log_header( #ifdef XFS_BUF_TRACING -#undef libxfs_readbuf_map +#undef libxfs_buf_read_map #undef libxfs_writebuf #undef libxfs_getbuf_map -xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, +xfs_buf_t *libxfs_buf_read_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); int libxfs_writebuf(xfs_buf_t *, int); struct xfs_buf *libxfs_buf_get(struct xfs_buftarg *btp, xfs_daddr_t daddr, @@ -421,7 +421,7 @@ libxfs_trace_readbuf( struct xfs_buf *bp; DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); - bp = libxfs_readbuf_map(btp, &map, 1, flags, ops); + bp = libxfs_buf_read_map(btp, &map, 1, flags, ops); __add_trace(bp, func, file, line); return bp; } @@ -1026,7 +1026,7 @@ libxfs_readbufr_map(struct xfs_buftarg *btp, struct xfs_buf *bp, int flags) } struct xfs_buf * -libxfs_readbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, +libxfs_buf_read_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags, const struct xfs_buf_ops *ops) { struct xfs_buf *bp; diff --git a/libxfs/trans.c b/libxfs/trans.c index e23ae598..f532e3d6 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -507,7 +507,7 @@ libxfs_trans_read_buf_map( *bpp = NULL; if (tp == NULL) { - bp = libxfs_readbuf_map(target, map, nmaps, flags, ops); + bp = libxfs_buf_read_map(target, map, nmaps, flags, ops); if (!bp) { return (flags & XBF_TRYLOCK) ? -EAGAIN : -ENOMEM; } @@ -526,7 +526,7 @@ libxfs_trans_read_buf_map( goto done; } - bp = libxfs_readbuf_map(target, map, nmaps, flags, ops); + bp = libxfs_buf_read_map(target, map, nmaps, flags, ops); if (!bp) { return (flags & XBF_TRYLOCK) ? -EAGAIN : -ENOMEM; } diff --git a/repair/da_util.c b/repair/da_util.c index d1e17ec3..ed2ec3ba 100644 --- a/repair/da_util.c +++ b/repair/da_util.c @@ -64,7 +64,7 @@ da_read_buf( map[i].bm_bn = XFS_FSB_TO_DADDR(mp, bmp[i].startblock); map[i].bm_len = XFS_FSB_TO_BB(mp, bmp[i].blockcount); } - bp = libxfs_readbuf_map(mp->m_dev, map, nex, 0, ops); + bp = libxfs_buf_read_map(mp->m_dev, map, nex, 0, ops); if (map != map_array) free(map); return bp; From patchwork Thu Feb 20 01:44:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11392997 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 3EC2B109A for ; Thu, 20 Feb 2020 01:47:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1650124671 for ; Thu, 20 Feb 2020 01:47:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jKTYNTBR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgBTBr0 (ORCPT ); Wed, 19 Feb 2020 20:47:26 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:48714 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgBTBr0 (ORCPT ); Wed, 19 Feb 2020 20:47:26 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1h0sP092840; Thu, 20 Feb 2020 01:47:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=1sQJlrMBRnKW49mEj4lyKPJ+1Pfu19sQGB2tLz0S1xE=; b=jKTYNTBRvEzTeGAfOiuXgBNBQKQzNVu1tbpOvuqXz1KlDURShXCVHbYStWUAFFlLgLT4 o/UCFjBL23yL7TaRU2E/IYrclb1Tr+EAiD1PT8egpk5hFHNURq0Nei2KMbfZOAoVt/sD VkSOol6ZAK4nftEB6Tg7yERolcxUDdHg+eR4sEuzWSMxI4F+2PVtRl8vntpH2iWNkLTa Hme1UXt4NAWy2mSPALp8KCKIcoKEbL8P+LoOhh22H46fh7vRU1RYYXUb5CIeGQO1khgZ j38iiyxnoKyGjoEi1KxssZp94Jyoa6jUo7iZjaNZS/culL4ClvhFhm08uSJSkFbgn+aE bQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2y8udd6trx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:47:23 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01K1gJ8g189105; Thu, 20 Feb 2020 01:45:22 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2y8ud9760v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Feb 2020 01:45:22 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01K1jLsl007198; Thu, 20 Feb 2020 01:45:21 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Feb 2020 17:44:28 -0800 USER-AGENT: StGit/0.17.1-dirty MIME-Version: 1.0 Message-ID: <158216306760.602314.2873425161697294878.stgit@magnolia> Date: Wed, 19 Feb 2020 17:44:27 -0800 (PST) From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Subject: [PATCH 18/18] libxfs: rename libxfs_getbuf_map to libxfs_buf_get_map References: <158216295405.602314.2094526611933874427.stgit@magnolia> In-Reply-To: <158216295405.602314.2094526611933874427.stgit@magnolia> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9536 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002200011 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Rename this function to match the kernel function. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/libxfs_io.h | 6 +++--- libxfs/rdwr.c | 16 ++++++++-------- libxfs/trans.c | 4 ++-- repair/prefetch.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h index 8e9af208..2a451ab2 100644 --- a/libxfs/libxfs_io.h +++ b/libxfs/libxfs_io.h @@ -144,7 +144,7 @@ extern struct cache_operations libxfs_bcache_operations; #define libxfs_buf_get(dev, daddr, len) \ libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ (dev), (daddr), (len)) -#define libxfs_getbuf_map(dev, map, nmaps, flags) \ +#define libxfs_buf_get_map(dev, map, nmaps, flags) \ libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \ (dev), (map), (nmaps), (flags)) #define libxfs_buf_relse(buf) \ @@ -171,7 +171,7 @@ extern void libxfs_trace_putbuf (const char *, const char *, int, extern xfs_buf_t *libxfs_buf_read_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); void libxfs_buf_dirty(struct xfs_buf *bp, int flags); -extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, +extern xfs_buf_t *libxfs_buf_get_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); void libxfs_buf_relse(struct xfs_buf *); @@ -183,7 +183,7 @@ libxfs_buf_get( { DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); - return libxfs_getbuf_map(target, &map, 1, 0); + return libxfs_buf_get_map(target, &map, 1, 0); } static inline struct xfs_buf* diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 531f24e3..52674559 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -387,14 +387,14 @@ libxfs_log_header( #undef libxfs_buf_read_map #undef libxfs_writebuf -#undef libxfs_getbuf_map +#undef libxfs_buf_get_map xfs_buf_t *libxfs_buf_read_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int, const struct xfs_buf_ops *); int libxfs_writebuf(xfs_buf_t *, int); struct xfs_buf *libxfs_buf_get(struct xfs_buftarg *btp, xfs_daddr_t daddr, size_t len); -xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, struct xfs_buf_map *, +xfs_buf_t *libxfs_buf_get_map(struct xfs_buftarg *, struct xfs_buf_map *, int, int); void libxfs_buf_relse(struct xfs_buf *); @@ -450,7 +450,7 @@ libxfs_trace_getbuf( struct xfs_buf *bp; DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); - bp = libxfs_getbuf_map(target, &map, 1, 0); + bp = libxfs_buf_get_map(target, &map, 1, 0); __add_trace(bp, func, file, line); return bp; } @@ -460,7 +460,7 @@ libxfs_trace_getbuf_map(const char *func, const char *file, int line, struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags) { - xfs_buf_t *bp = libxfs_getbuf_map(btp, map, nmaps, flags); + xfs_buf_t *bp = libxfs_buf_get_map(btp, map, nmaps, flags); __add_trace(bp, func, file, line); return bp; } @@ -805,7 +805,7 @@ reset_buf_state( } static struct xfs_buf * -__libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, +__libxfs_buf_get_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags) { struct xfs_bufkey key = {NULL}; @@ -827,12 +827,12 @@ __libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, } struct xfs_buf * -libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, +libxfs_buf_get_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags) { struct xfs_buf *bp; - bp = __libxfs_getbuf_map(btp, map, nmaps, flags); + bp = __libxfs_buf_get_map(btp, map, nmaps, flags); reset_buf_state(bp); return bp; } @@ -1036,7 +1036,7 @@ libxfs_buf_read_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, return libxfs_readbuf(btp, map[0].bm_bn, map[0].bm_len, flags, ops); - bp = __libxfs_getbuf_map(btp, map, nmaps, 0); + bp = __libxfs_buf_get_map(btp, map, nmaps, 0); if (!bp) return NULL; diff --git a/libxfs/trans.c b/libxfs/trans.c index f532e3d6..f4ce23a7 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -427,7 +427,7 @@ libxfs_trans_get_buf_map( struct xfs_buf_log_item *bip; if (!tp) - return libxfs_getbuf_map(target, map, nmaps, 0); + return libxfs_buf_get_map(target, map, nmaps, 0); /* * If we find the buffer in the cache with this transaction @@ -445,7 +445,7 @@ libxfs_trans_get_buf_map( return bp; } - bp = libxfs_getbuf_map(target, map, nmaps, 0); + bp = libxfs_buf_get_map(target, map, nmaps, 0); if (bp == NULL) { return NULL; } diff --git a/repair/prefetch.c b/repair/prefetch.c index a3858f9a..7f705cc0 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -120,7 +120,7 @@ pf_queue_io( * the lock holder is either reading it from disk himself or * completely overwriting it this behaviour is perfectly fine. */ - bp = libxfs_getbuf_map(mp->m_dev, map, nmaps, LIBXFS_GETBUF_TRYLOCK); + bp = libxfs_buf_get_map(mp->m_dev, map, nmaps, LIBXFS_GETBUF_TRYLOCK); if (!bp) return;