From patchwork Thu Jul 28 07:08:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Fengqi X-Patchwork-Id: 9250745 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 84A9E6075F for ; Thu, 28 Jul 2016 07:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7501D20246 for ; Thu, 28 Jul 2016 07:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69A6F254F7; Thu, 28 Jul 2016 07:09:00 +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.9 required=2.0 tests=BAYES_00,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 EC85F20246 for ; Thu, 28 Jul 2016 07:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163411AbcG1HI5 (ORCPT ); Thu, 28 Jul 2016 03:08:57 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:42349 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1163108AbcG1HI4 (ORCPT ); Thu, 28 Jul 2016 03:08:56 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="9211850" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 28 Jul 2016 15:08:47 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 8A3BD42984F5 for ; Thu, 28 Jul 2016 15:08:44 +0800 (CST) Received: from luke.localdomain (10.167.226.118) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.279.2; Thu, 28 Jul 2016 15:08:43 +0800 From: Lu Fengqi To: CC: Lu Fengqi , Qu Wenruo Subject: [PATCH 01/13] btrfs-progs: move btrfs_extref_hash() to hash.h Date: Thu, 28 Jul 2016 15:08:13 +0800 Message-ID: <1469689705-26836-2-git-send-email-lufq.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469689705-26836-1-git-send-email-lufq.fnst@cn.fujitsu.com> References: <1469689705-26836-1-git-send-email-lufq.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.118] X-yoursite-MailScanner-ID: 8A3BD42984F5.AED2D X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lufq.fnst@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move btrfs_extref_hash() from inode-item.c to hash.h, so that the function can be called elsewhere. Signed-off-by: Lu Fengqi Signed-off-by: Qu Wenruo --- hash.h | 10 ++++++++++ inode-item.c | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hash.h b/hash.h index ac4c411..9ff6761 100644 --- a/hash.h +++ b/hash.h @@ -25,4 +25,14 @@ static inline u64 btrfs_name_hash(const char *name, int len) { return crc32c((u32)~1, name, len); } + +/* + * Figure the key offset of an extended inode ref + */ +static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name, + int len) +{ + return (u64)btrfs_crc32c(parent_objectid, name, len); +} + #endif diff --git a/inode-item.c b/inode-item.c index 522d25a..df5011e 100644 --- a/inode-item.c +++ b/inode-item.c @@ -19,7 +19,7 @@ #include "ctree.h" #include "disk-io.h" #include "transaction.h" -#include "crc32c.h" +#include "hash.h" static int find_name_in_backref(struct btrfs_path *path, const char * name, int name_len, struct btrfs_inode_ref **ref_ret) @@ -184,12 +184,6 @@ out: return ret_inode_ref; } -static inline u64 btrfs_extref_hash(u64 parent_ino, const char *name, - int namelen) -{ - return (u64)btrfs_crc32c(parent_ino, name, namelen); -} - static int btrfs_find_name_in_ext_backref(struct btrfs_path *path, u64 parent_ino, const char *name, int namelen, struct btrfs_inode_extref **extref_ret)