From patchwork Tue Apr 5 23:20:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 688991 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p35NVdCq002452 for ; Tue, 5 Apr 2011 23:31:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752546Ab1DEXbh (ORCPT ); Tue, 5 Apr 2011 19:31:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37784 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861Ab1DEXbg (ORCPT ); Tue, 5 Apr 2011 19:31:36 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p35NVaYF002505 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Apr 2011 19:31:36 -0400 Received: from test1244.test.redhat.com (test1244.test.redhat.com [10.10.10.244]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p35NVakq032737 for ; Tue, 5 Apr 2011 19:31:36 -0400 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: don't kzalloc the ordered extents Date: Tue, 5 Apr 2011 19:20:49 -0400 Message-Id: <1302045649-1580-1-git-send-email-josef@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 05 Apr 2011 23:31:40 +0000 (UTC) We initialize almost all of the fields when we allocate an ordered extent, so use kmalloc instead of kzalloc and just initialize the other fields that we don't already initialize yet. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/ordered-data.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 083a554..2edc837 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -179,7 +179,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, struct btrfs_ordered_extent *entry; tree = &BTRFS_I(inode)->ordered_tree; - entry = kzalloc(sizeof(*entry), GFP_NOFS); + entry = kmalloc(sizeof(*entry), GFP_NOFS); if (!entry) return -ENOMEM; @@ -190,6 +190,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, entry->bytes_left = len; entry->inode = inode; entry->compress_type = compress_type; + entry->flags = 0; if (type != BTRFS_ORDERED_IO_DONE && type != BTRFS_ORDERED_COMPLETE) set_bit(type, &entry->flags); @@ -201,6 +202,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, init_waitqueue_head(&entry->wait); INIT_LIST_HEAD(&entry->list); INIT_LIST_HEAD(&entry->root_extent_list); + RB_CLEAR_NODE(&entry->rb_node); spin_lock(&tree->lock); node = tree_insert(&tree->tree, file_offset,