xfs
[Top] [All Lists]

Re: [PATCH V2] xfs_repair: fix record_allocation list manipulation

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH V2] xfs_repair: fix record_allocation list manipulation
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 22 Sep 2009 10:21:36 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <20090922120231.GB8143@xxxxxxxxxxxxx>
References: <4AB300CC.5020707@xxxxxxxxxxx> <4AB4EDBC.9050609@xxxxxxxxxxx> <20090922120231.GB8143@xxxxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Christoph Hellwig wrote:
> On Sat, Sep 19, 2009 at 09:42:04AM -0500, Eric Sandeen wrote:
>> clang found this one too as a "Dead assignment"
>>
>> Unless my pointer-fu is totally messed up, this function
>> was never actually updating the list head.
>>
>> This would mean that the later free_allocations() calls in
>> incore_ext_teardown() and free_rt_dup_extent_tree() don't
>> actually free any items, and therefore leak memory.
>>
>> V2: now with correct pointer-fu.
> 
> Barry already had this in his repair speedups patchkit, but I left it
> out for now because I wasn't too sure how this could work at all.

Hm, the patch as reposted does indeed free the allocations; I double
checked .... on a fairly large filesystem I saw about 10MB of memory
that was lost otherwise; not huge.

> After reviewing it again I noticed that it can actually work 

the original code can work?

> because the
> addr pointer in the ba_rec_t is unused, and we make use of the fact that
> the ba_rec_t is the first field in the structure to be tacked.  Entirely
> to subtile for my taste.  Id' prefer to just put a list_head into the
> extent_alloc_rec_t and rt_extent_alloc_rec_t and openconde the
> tracking/freeing of the beast.  The list_head if just as large as the
> ba_rec_t and make sure the list handlinjg is right, and the openconding
> gets rid of the annoying assumption that the ba_rec_t is the first thing
> in the structure to be tracked.  It should also be a net-removal of
> code.

Yeah, that sounds better.

IF barry's speedups stuff obsoletes this work should I just put it on
the shelf for now?

Sorry; you're probably at linuxcon, I'm having a hard time parsing all
of the quick reply ;)

-Eric

<Prev in Thread] Current Thread [Next in Thread>