From: Arne Jansen <sensille@gmx.net>
To: Josef Bacik <josef@redhat.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: don't kzalloc the ordered extents
Date: Wed, 06 Apr 2011 09:54:07 +0200 [thread overview]
Message-ID: <4D9C1C1F.8090208@gmx.net> (raw)
In-Reply-To: <1302045649-1580-1-git-send-email-josef@redhat.com>
On 06.04.2011 01:20, Josef Bacik wrote:
> 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,
Is it really worth it? we have seen a few bugs in the past resulting
from uninitialized structure element, that even made it to disk.
Using kzalloc makes maintenance much easier.
-Arne
>
> Signed-off-by: Josef Bacik <josef@redhat.com>
> ---
> 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,
next prev parent reply other threads:[~2011-04-06 7:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 23:20 [PATCH] Btrfs: don't kzalloc the ordered extents Josef Bacik
2011-04-06 7:54 ` Arne Jansen [this message]
2011-04-06 11:06 ` Chris Mason
2011-04-06 15:24 ` Josef Bacik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D9C1C1F.8090208@gmx.net \
--to=sensille@gmx.net \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.