From patchwork Thu Apr 13 08:05:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9678897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8591E60381 for ; Thu, 13 Apr 2017 08:05:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7832128631 for ; Thu, 13 Apr 2017 08:05:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CFED28654; Thu, 13 Apr 2017 08:05:36 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 E9D2228631 for ; Thu, 13 Apr 2017 08:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbdDMIFa (ORCPT ); Thu, 13 Apr 2017 04:05:30 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:44728 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbdDMIFZ (ORCPT ); Thu, 13 Apr 2017 04:05:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding: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=HO6NMQVYTYcg7oqsuG/3rz3Ac2FAxwjBGx8WxpqtnDo=; b=iPp9gq5JyaUvc6qQGwY7BnkTO K/A8M9JBiXG33GgGRGgaf0yB8a/tX6eE/LIV/tmkGKu/7MatOadQJDMJr1Ci6v5ooVde8p9zDFzGz 5+dliZpF2EpbT9TsYT+0R0ighyLWuj21YpqMlQEfMfXFk/36XZybQsrNCCOknZkDRL349O8LpuufT ux9E63VWzRdq7XoF4iN03DVU3p+Rg1nAQaBkl00FHrJX82zPmZT1Pa7KbWGyG3dA1ZUnFQGIZSy3v ShB+/B5Sr+zHEFlC7K6Sa20RalhwdIhz9ocruGmtvXXKPEt3pPKiSzRM2+fAeu2dQPj2+b2Ma2q3P G5vfdscZg==; Received: from 212095007060.public.telering.at ([212.95.7.60] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cyZkq-0007WV-9N for linux-xfs@vger.kernel.org; Thu, 13 Apr 2017 08:05:24 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 01/10] xfs: introduce xfs_trans_blk_res Date: Thu, 13 Apr 2017 10:05:08 +0200 Message-Id: <20170413080517.12564-2-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170413080517.12564-1-hch@lst.de> References: <20170413080517.12564-1-hch@lst.de> 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 is a smaller helper to check the remaining block reservation in a transaction. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster --- fs/xfs/xfs_trans.c | 2 +- fs/xfs/xfs_trans.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index a280e126491f..3a83927a5334 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -97,7 +97,7 @@ xfs_trans_dup( /* We gave our writer reference to the new transaction */ tp->t_flags |= XFS_TRANS_NO_WRITECOUNT; ntp->t_ticket = xfs_log_ticket_get(tp->t_ticket); - ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used; + ntp->t_blk_res = xfs_trans_blk_res(tp); tp->t_blk_res = tp->t_blk_res_used; ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; tp->t_rtx_res = tp->t_rtx_res_used; diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 2a9292df6640..e4f041c89846 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -152,6 +152,11 @@ typedef struct xfs_trans { #define xfs_trans_agbtree_delta(tp, d) #endif +static inline unsigned int xfs_trans_blk_res(struct xfs_trans *tp) +{ + return tp->t_blk_res - tp->t_blk_res_used; +} + /* * XFS transaction mechanism exported interfaces. */