From: Stefan Behrens <sbehrens@giantdisaster.de>
To: dsterba@suse.cz, Eric Sandeen <sandeen@redhat.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] btrfs-progs: mark static & remove unused from non-kernel code
Date: Fri, 09 Aug 2013 16:39:27 +0200 [thread overview]
Message-ID: <5204FF1F.5070602@giantdisaster.de> (raw)
In-Reply-To: <20130809141039.GK5284@twin.jikos.cz>
On Fri, 9 Aug 2013 16:10:39 +0200, David Sterba wrote:
> On Wed, Aug 07, 2013 at 10:17:57AM -0500, Eric Sandeen wrote:
>> And isn't it still a mistake? I think it used to be that subvol_uuid_search_init()
>> would allocate the memory which must be freed, but that's no longer the case,
>> right? So under what circumstances is it correct to call
>> subvol_uuid_search_add() which frees those pointers?
>
> Looks like the memory management is internal to the subvol_uuid*
> functions, now _init does not allocate and I don't see why _add should
> call free. All users of subvol_uuid_search() free the memory themselves
> (in current code).
>
> Seems that subvol_uuid_search_add was exported without any concern that
> it could be part of the library interface.
>
> We don't have library ABI versioning in place, so I suggest to keep the
> function there for compatibility with current code (though I'm not aware
> of any external users of the _add function), but drop th free() calls
> and put a "don't use" comment.
>
Callers of the subvol_uuid interface (like Btrfs receive) allocate the
memory for newly created items (this is the case after receiving a
subvolume) and add them to the database with the _add function. _add()
stores the pointer and the caller mustn't free() the item. This was/is
the interface.
We don't have this database anymore, we don't keep the items that are
added. Since it was not allowed to call free() for items that have been
added, _add() must call free() now.
next prev parent reply other threads:[~2013-08-09 14:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 1:01 [PATCH 0/2] btrfs-progs: more statics & removals Eric Sandeen
2013-08-07 1:03 ` [PATCH 1/2] btrfs-progs: mark static & remove unused from shared kernel code Eric Sandeen
2013-08-07 1:05 ` [PATCH 2/2] btrfs-progs: mark static & remove unused from non-kernel code Eric Sandeen
2013-08-07 3:49 ` Eric Sandeen
2013-08-07 7:54 ` Stefan Behrens
2013-08-07 15:17 ` Eric Sandeen
2013-08-09 14:10 ` David Sterba
2013-08-09 14:39 ` Stefan Behrens [this message]
2013-08-09 20:20 ` [PATCH 2/2 V2] " Eric Sandeen
2013-08-09 22:48 ` David Sterba
2013-08-09 23:16 ` Eric Sandeen
2013-08-09 23:25 ` David Sterba
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=5204FF1F.5070602@giantdisaster.de \
--to=sbehrens@giantdisaster.de \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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.