From patchwork Thu Mar 15 15:08:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10284729 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 2EC7E60386 for ; Thu, 15 Mar 2018 15:08:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 224C828A57 for ; Thu, 15 Mar 2018 15:08:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16D6028B1C; Thu, 15 Mar 2018 15:08:40 +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 C2D2228A57 for ; Thu, 15 Mar 2018 15:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbeCOPIg (ORCPT ); Thu, 15 Mar 2018 11:08:36 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:4231 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752602AbeCOPIb (ORCPT ); Thu, 15 Mar 2018 11:08:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1521127620; x=1552663620; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=KYF2E4cJ0eTG8WVqanMiE79mdrUxCm5W9uKkLD2XC7Q=; b=TO0lzGu6qH3RuIUDuFm2GSMg1vfdfKrO4snY0PR2Vx8iOoZluu25t+Xo q52jasJSdX1Vk/6/ZSGpEgoaf+KWpu2B09mSBcLGwHA4YamBO4sSISL3V 8bkuyQRlf0NkK3yBxXRU+wn5Sd0xwR9v+4YjtVMxyzIi993sNUw0Y8k91 5Ayj/lGEpIRee5DrxULZiaNwvYFtCn/ErJpyOl+uWMjir7A9Hr+Y+x64o YiUqygNV4OE+aO1boktdUiSrmZq0AG0CyJLbPJkFnOyJAiLs4aIKh/eWp BD7Ck4KEA5h5Eu8vQRSJjYVW7lekPe+dYzTr/Md9+RnGki3qUPAuBC07Q Q==; X-IronPort-AV: E=Sophos;i="5.47,471,1515427200"; d="scan'208";a="170233278" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Mar 2018 23:26:38 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 15 Mar 2018 08:01:15 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Mar 2018 08:08:18 -0700 From: Bart Van Assche To: Michael Lyle , Kent Overstreet , Coly Li Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 14/16] bcache: Make csum_set() implementation easier to read Date: Thu, 15 Mar 2018 08:08:12 -0700 Message-Id: <20180315150814.9412-15-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180315150814.9412-1-bart.vanassche@wdc.com> References: <20180315150814.9412-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce two temporary variables to avoid having to repeat expressions. This patch does not change any functionality. Signed-off-by: Bart Van Assche --- drivers/md/bcache/bcache.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 12e5197f186c..72b1ea4576d9 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -777,10 +777,12 @@ static inline bool ptr_available(struct cache_set *c, const struct bkey *k, * This is used for various on disk data structures - cache_sb, prio_set, bset, * jset: The checksum is _always_ the first 8 bytes of these structs */ -#define csum_set(i) \ - bch_crc64(((void *) (i)) + sizeof(uint64_t), \ - ((void *) bset_bkey_last(i)) - \ - (((void *) (i)) + sizeof(uint64_t))) +#define csum_set(i) ({ \ + const void *p = (void *)(i) + sizeof(uint64_t); \ + const void *q = bset_bkey_last(i); \ + \ + bch_crc64(p, q - p); \ +}) /* Error handling macros */