[U-Boot] [PATCH v2] ext2: Cache line aligned partial sector bounce buffer

Wolfgang Denk wd at denx.de
Tue Aug 23 20:39:48 CEST 2011


Dear Anton Staaf,

In message <CAF6FioXyMnhK=gKbwDeGpvGGz-xMs-Hr6c4q3SsTtJ29CRsqCQ at mail.gmail.com> you wrote:
>
> >> This patch allocates a cache line size aligned sector sized bounce
> >> buffer the first time that ext2fs_devread is called.
> >
> > ...and never frees ist, which is a bad thing. =A0Please fix.
> 
> That was actually intentional.  To free the buffer the code would need
> to know when it was done doing ext2 accesses.  This information isn't
> really available.  And it would be a performance hit to allocate and

As Mike pointed out, this information is of course available: the
bufer was on the stack before, so it disappears upon return from this
function.

> free the buffer every time a read was performed, instead this patch
> re-uses the same allocated buffer every time that the read is called.
> Would you prefer that I allocate and free the buffer each time?  I can

Do we really need malloc at all? Why cannot we just use a slightly
larger buffer on the stack and align the pointer into it?  We're
talking about cache line sizes here, i. e. a few tens of bytes -
that is probably way less than the code you add here.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No question is too silly to ask. Of course, some  questions  are  too
silly to to answer...  - L. Wall & R. L. Schwartz, _Programming Perl_


More information about the U-Boot mailing list