From patchwork Fri Feb 15 14:47:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10815063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28F436C2 for ; Fri, 15 Feb 2019 14:47:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D0EF2F80C for ; Fri, 15 Feb 2019 14:47:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1199C2F80E; Fri, 15 Feb 2019 14:47:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACA812F80C for ; Fri, 15 Feb 2019 14:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728593AbfBOOro (ORCPT ); Fri, 15 Feb 2019 09:47:44 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35006 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727493AbfBOOro (ORCPT ); Fri, 15 Feb 2019 09:47:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=G1R0wjrubx7qussW6i8eK2iefSid/Zv9I6Y57+TC+ZA=; b=AKZXgtNZTa/pqm3gfW/BX/Ine0 bH+Go/Yruwa4Gde0kOiYJf9vA88YYUuflx2TLnwajz/253q1o+ND04pS9Y/0paeL9Vn4mO1FX2f3b cZ62Kn9W7APDGb7ud+r9PejzGYmR90AtHkZ7MZV68YXHfFRmhlFSn/9fivL8xoheMuI1ToEB6+cOw uOFK5Jsj/shLkSHB/A1NU53CLHHPdWesq/GMOvU91nogTwYGsSj2cO0Zsz8sSoD1FmFZ+2CEha4VK OUqL9suDrDIs9eu2GRUtPv8p2jUDDtTEZGjzgksBhoxHxdiTqFJiepIRK1RlMCxUY8tlYStAyCM2R ZSIoHW4g==; Received: from [91.112.108.175] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1guemF-0005Ze-Fy; Fri, 15 Feb 2019 14:47:43 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: Brian Foster Subject: [PATCH 07/10] xfs: move stat accounting to xfs_bmapi_convert_delalloc Date: Fri, 15 Feb 2019 15:47:22 +0100 Message-Id: <20190215144725.8894-8-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190215144725.8894-1-hch@lst.de> References: <20190215144725.8894-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This way we can actually count how many bytes got converted and how many calls we need, unlike in the caller which doesn't have the detailed view. Note that this includes a slight change in behavior as the xs_xstrat_quick is now bumped for every allocation instead of just the one covering the requested writeback offset, which makes a lot more sense. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 3 +++ fs/xfs/xfs_iomap.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index fc4f1d3145c4..4cf83475f0d0 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -4516,6 +4516,9 @@ xfs_bmapi_convert_delalloc( if (WARN_ON_ONCE(!bma.got.br_startblock && !XFS_IS_REALTIME_INODE(ip))) goto out_finish; + XFS_STATS_ADD(mp, xs_xstrat_bytes, XFS_FSB_TO_B(mp, bma.length)); + XFS_STATS_INC(mp, xs_xstrat_quick); + ASSERT(!isnullstartblock(bma.got.br_startblock)); *imap = bma.got; *seq = READ_ONCE(ifp->if_seq); diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 39be741cac5a..15da53b5fb53 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -707,9 +707,6 @@ xfs_iomap_write_allocate( map_start_fsb = imap->br_startoff; map_count_fsb = imap->br_blockcount; - XFS_STATS_ADD(mp, xs_xstrat_bytes, - XFS_FSB_TO_B(mp, imap->br_blockcount)); - while (true) { /* * Allocate in a loop because it may take several attempts to @@ -741,7 +738,6 @@ xfs_iomap_write_allocate( if ((offset_fsb >= imap->br_startoff) && (offset_fsb < (imap->br_startoff + imap->br_blockcount))) { - XFS_STATS_INC(mp, xs_xstrat_quick); xfs_trim_extent(imap, map_start_fsb, map_count_fsb); ASSERT(offset_fsb >= imap->br_startoff && offset_fsb < imap->br_startoff + imap->br_blockcount);