From patchwork Sun Oct 25 20:15:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Moise <00moses.alexander00@gmail.com> X-Patchwork-Id: 7483891 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E965A9F71A for ; Sun, 25 Oct 2015 17:16:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1041D206A3 for ; Sun, 25 Oct 2015 17:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1ED58206DD for ; Sun, 25 Oct 2015 17:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbbJYRQD (ORCPT ); Sun, 25 Oct 2015 13:16:03 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:32875 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752061AbbJYRPk (ORCPT ); Sun, 25 Oct 2015 13:15:40 -0400 Received: by wijp11 with SMTP id p11so136055129wij.0; Sun, 25 Oct 2015 10:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=ZaAF6oQT9pIUGXzKg7K0JiirqJ6yBJGZfcZwtik791U=; b=bqsEQJPoQodVjGt296lx5kLxrQeUvs7tvidVfrEIaKhabORRO9ZF5Zs+iJ+1yy3aWv CXcYXcROM7zJwyzewBZo96snB19Kk46IzO9OQ8QSMq4bKFuzIgRc0NwByJ+BwGwy6OjR u4c+1N9jvczDhLsVGqkP7+XM0CdQRMlgZ6fkJdMdsgmTGRIuRCufKmVDfAr70GOO2R30 OAYiwoi8WQaASp6BkguTZJynL12448iATcnwF80ohGlVFgQuUhHohAiBAHHiB2BWA6pd X9cxC40EU32OPKQ06yf5aUtGwIzi54cQVxp6/LbPfM00mOUANxeAwVK6cr2/wkn1MEdX z37w== X-Received: by 10.194.78.15 with SMTP id x15mr17610181wjw.144.1445793339236; Sun, 25 Oct 2015 10:15:39 -0700 (PDT) Received: from gmail.com ([188.24.206.119]) by smtp.gmail.com with ESMTPSA id 71sm1611777wmt.15.2015.10.25.10.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Oct 2015 10:15:38 -0700 (PDT) Date: Sun, 25 Oct 2015 20:15:06 +0000 From: Alexandru Moise <00moses.alexander00@gmail.com> To: clm@fb.com Cc: jbacik@fb.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, jeffm@suse.com Subject: [PATCH v2] btrfs: zero out delayed node upon allocation Message-ID: <20151025201506.GA10121@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 It's slightly cleaner to zero-out the delayed node upon allocation than to do it by hand in btrfs_init_delayed_node() for a few members Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com> --- v2: Thanks Jeff Mahoney for pointing out the mistake of removing the atomic_set in v1 of the patch. atomic_set() call restored. fs/btrfs/delayed-inode.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index a2ae427..0a00c4f 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -54,16 +54,11 @@ static inline void btrfs_init_delayed_node( delayed_node->root = root; delayed_node->inode_id = inode_id; atomic_set(&delayed_node->refs, 0); - delayed_node->count = 0; - delayed_node->flags = 0; delayed_node->ins_root = RB_ROOT; delayed_node->del_root = RB_ROOT; mutex_init(&delayed_node->mutex); - delayed_node->index_cnt = 0; INIT_LIST_HEAD(&delayed_node->n_list); INIT_LIST_HEAD(&delayed_node->p_list); - delayed_node->bytes_reserved = 0; - memset(&delayed_node->inode_item, 0, sizeof(delayed_node->inode_item)); } static inline int btrfs_is_continuous_delayed_item( @@ -132,7 +127,7 @@ again: if (node) return node; - node = kmem_cache_alloc(delayed_node_cache, GFP_NOFS); + node = kmem_cache_zalloc(delayed_node_cache, GFP_NOFS); if (!node) return ERR_PTR(-ENOMEM); btrfs_init_delayed_node(node, root, ino);