From patchwork Sat Nov 22 13:13:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 5359261 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E7975C11AC for ; Sat, 22 Nov 2014 13:14:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B60120131 for ; Sat, 22 Nov 2014 13:14:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24B4820145 for ; Sat, 22 Nov 2014 13:14:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751422AbaKVNOr (ORCPT ); Sat, 22 Nov 2014 08:14:47 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:44301 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbaKVNOp (ORCPT ); Sat, 22 Nov 2014 08:14:45 -0500 Received: by mail-pd0-f175.google.com with SMTP id y10so7074392pdj.6 for ; Sat, 22 Nov 2014 05:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=pXtKJVB25/+rfC1loIo8S3zNlkCI/AMWdFhP4jfiDGA=; b=t23XvGC3bfvbzE+cuqL9YxPTHXCONKm98In8uNecOpDq9YrUEWWe4CcokLli/KT/aV ONlq+CTvOXTxmjHSbcIkl8L20h567FRL4EgRUc4VmcqLnBef5AttadrDCc/C/5BEFhpo PuP8VIT8EXYsPYv2Bor+GbnpR/K2OYcBuYPbGI4lY325gsAZBXqfiFSpZNVoUqhcsbdN AXPJJUebhn8ZLAO1bf+L+jr9SecwMrJCk3n4WgQzFbJUb5s+8M1E00q+3o5kcnqueEiX 5RVxKExBnp0CJzm0653kJ6bU/Sn8XTAfYLUbZYQZ65nvGxslXr+Sl/XQIAD5STexDXCj WXFg== X-Received: by 10.66.119.175 with SMTP id kv15mr16848454pab.30.1416662085342; Sat, 22 Nov 2014 05:14:45 -0800 (PST) Received: from promote.cache-dns.local.cache-dns.local ([223.65.142.103]) by mx.google.com with ESMTPSA id lr4sm7522107pab.42.2014.11.22.05.14.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Nov 2014 05:14:44 -0800 (PST) From: Wang Shilong To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: switch to kvfree() helper Date: Sat, 22 Nov 2014 21:13:10 +0800 Message-Id: <1416661990-20717-2-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1416661990-20717-1-git-send-email-wangshilong1991@gmail.com> References: <1416661990-20717-1-git-send-email-wangshilong1991@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A new helper kvfree() in mm/utils.c will do this. Signed-off-by: Wang Shilong --- fs/btrfs/raid56.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 6a41631..12e343b 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -221,12 +221,8 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info) } x = cmpxchg(&info->stripe_hash_table, NULL, table); - if (x) { - if (is_vmalloc_addr(x)) - vfree(x); - else - kfree(x); - } + if (x) + kvfree(x); return 0; } @@ -436,10 +432,7 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info) if (!info->stripe_hash_table) return; btrfs_clear_rbio_cache(info); - if (is_vmalloc_addr(info->stripe_hash_table)) - vfree(info->stripe_hash_table); - else - kfree(info->stripe_hash_table); + kvfree(info->stripe_hash_table); info->stripe_hash_table = NULL; }