From patchwork Fri Sep 22 13:59:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9966205 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 46EB86035E for ; Fri, 22 Sep 2017 13:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47A8220223 for ; Fri, 22 Sep 2017 13:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CC1C298EC; Fri, 22 Sep 2017 13:59:58 +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 DFDC120223 for ; Fri, 22 Sep 2017 13:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752348AbdIVN74 (ORCPT ); Fri, 22 Sep 2017 09:59:56 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:60051 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbdIVN7u (ORCPT ); Fri, 22 Sep 2017 09:59:50 -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=2ZrAtq6VgFAfU+atqLZ5UhRDGGd4ZA27sTuu/jWz7jM=; b=OpaDtGmWrZ/lcQH2UFW9B+wor LqUTxPWn9h0vlLDLpOenXU2CiO7RbOg9vnzzzdCxhVp05RFscJ29plBHZ9GRwnW2YU7A3A9Gh9WxN XOMnfvKsi9gEtV0q9e6fqWlf346RseHyulRYRReph4Kab5CHGoukR+Ci6DTlUaP/6cuJOkjy99HiU +nbFn133mzHgTqPZ7Kdt76RXTHJC4O4vOS9OI+/6vn5u+3StbpU/P6KCNInD3rPnM871+3SHqKgH2 qgYfsifVfNL0g8mXTdvG42zrcQxqBWDyvmyzR7hgmAsWAfcFhCuWGXUQ1Ydt8mmAGcYmm/ErrLsN8 gpsbMAXyA==; Received: from ip-64-134-232-11.public.wayport.net ([64.134.232.11] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dvOUg-0001At-4y for linux-xfs@vger.kernel.org; Fri, 22 Sep 2017 13:59:50 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 08/19] xfs: use the state defines in xfs_bmap_del_extent_real Date: Fri, 22 Sep 2017 06:59:34 -0700 Message-Id: <20170922135945.31574-9-hch@lst.de> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170922135945.31574-1-hch@lst.de> References: <20170922135945.31574-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 Use the same defines as the other extent add and delete helpers, which both improves code readability and trace point output. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index aa4af31750d3..037efc97499f 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5162,13 +5162,13 @@ xfs_bmap_del_extent_real( XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); } - /* - * Set flag value to use in switch statement. - * Left-contig is 2, right-contig is 1. - */ - switch (((got.br_startoff == del->br_startoff) << 1) | - (got_endoff == del_endoff)) { - case 3: + if (got.br_startoff == del->br_startoff) + state |= BMAP_LEFT_FILLING; + if (got_endoff == del_endoff) + state |= BMAP_RIGHT_FILLING; + + switch (state & (BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING)) { + case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING: /* * Matches the whole extent. Delete the entry. */ @@ -5188,8 +5188,7 @@ xfs_bmap_del_extent_real( goto done; XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); break; - - case 2: + case BMAP_LEFT_FILLING: /* * Deleting the first part of the extent. */ @@ -5208,8 +5207,7 @@ xfs_bmap_del_extent_real( got.br_state))) goto done; break; - - case 1: + case BMAP_RIGHT_FILLING: /* * Deleting the last part of the extent. */ @@ -5227,7 +5225,6 @@ xfs_bmap_del_extent_real( got.br_state))) goto done; break; - case 0: /* * Deleting the middle of the extent.