From patchwork Sat Jul 30 00:38:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9253019 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 6A07B6075F for ; Sat, 30 Jul 2016 00:38:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59833283A6 for ; Sat, 30 Jul 2016 00:38:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E0B828444; Sat, 30 Jul 2016 00:38:35 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 F1C09283A6 for ; Sat, 30 Jul 2016 00:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753247AbcG3Aie (ORCPT ); Fri, 29 Jul 2016 20:38:34 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:35104 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753178AbcG3Aic (ORCPT ); Fri, 29 Jul 2016 20:38:32 -0400 Received: by mail-pa0-f66.google.com with SMTP id cf3so5922283pad.2 for ; Fri, 29 Jul 2016 17:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=s0ecMaQhnDaC1X+klHa2dPZ7R9uyP3nTFOlrNry6fRk=; b=j1MepARFvKB4d/UW3Fdwnz3rCBpOigcbsObgUinkZO55dIS0oLpmEjrClGSIL4RJUV LTCtZYwXtMutmhf8F1/Xo51KLUVsvbva50yBgA4neJLU6mRq7oiXMqe6isHn7Gyunf2z 9ehjfXxLic0Md+txTUeD6VkzjLOd2zEx5F39Eob99iL8b7Urg4oClD3W0azF13t6Pp7T 64f7QD1AHqh5IYIQOkiRHKFfCMdQ6TbLaZdc2sLkkTu0pFXJ3kyt09/3B6sQdB77XhbH kBZ10AMb4AmClfq+me8VFYM8SJ4dJcHdfBmAmAMm6iNs2SKCmJ6EFSnPu+ZLEbCnlgXX OFsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=s0ecMaQhnDaC1X+klHa2dPZ7R9uyP3nTFOlrNry6fRk=; b=P/H3Rd5dFoM2qviG0TAVVRPG19BquKmO5bcqqVtJVqvLV5O72zrJoCZc3NYBhLmf4J 2LeW6IcGaj3BuQriFY8SIUsO16QV07T9XTN7arpQn6DqaTd11xkJqnIGCRY09TxHx4n/ VsPbiKaHycnA9HLgQCzaMJ+C/99TxdPn3evPKUl4LJ8siJg/0r+rR2dpUlI4sMBUbn+M VTqFozpEfPcCzsjCqaflhnX1yKEScXt6Wb7E7Mk2WRx9tZ0KKIRdenWDUixo7KQjJOTN Imp03ofebxOcPlsp30/0QS5idPe/xTiOYkBW/W62uhXmMMt2e4IT/d/NrrtaBiMOfvP4 Mu4g== X-Gm-Message-State: AEkoouvi9QC6H7+QeRPBQPEWf8Am+26cbzyf9HZhoVCYL+HKnjXtrLEs6TNZ35Y0pfctvQ== X-Received: by 10.66.236.39 with SMTP id ur7mr73080261pac.6.1469839111935; Fri, 29 Jul 2016 17:38:31 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id q1sm27661751pfd.48.2016.07.29.17.38.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 17:38:31 -0700 (PDT) From: Wei Yongjun To: Ilya Dryomov , "Yan, Zheng" , Sage Weil Cc: Wei Yongjun , ceph-devel@vger.kernel.org Subject: [PATCH -next] libceph: using kfree_rcu() to simplify the code Date: Sat, 30 Jul 2016 00:38:26 +0000 Message-Id: <1469839106-3692-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The callback function of call_rcu() just calls a kfree(), so we can use kfree_rcu() instead of call_rcu() + callback function. Signed-off-by: Wei Yongjun --- net/ceph/string_table.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ceph/string_table.c b/net/ceph/string_table.c index ca53c83..22fb96e 100644 --- a/net/ceph/string_table.c +++ b/net/ceph/string_table.c @@ -84,12 +84,6 @@ retry: } EXPORT_SYMBOL(ceph_find_or_create_string); -static void ceph_free_string(struct rcu_head *head) -{ - struct ceph_string *cs = container_of(head, struct ceph_string, rcu); - kfree(cs); -} - void ceph_release_string(struct kref *ref) { struct ceph_string *cs = container_of(ref, struct ceph_string, kref); @@ -101,7 +95,7 @@ void ceph_release_string(struct kref *ref) } spin_unlock(&string_tree_lock); - call_rcu(&cs->rcu, ceph_free_string); + kfree_rcu(cs, rcu); } EXPORT_SYMBOL(ceph_release_string);