From: Wolfgang Denk Date: Tue, 23 Aug 2011 20:39:48 +0200 Subject: [U-Boot] [PATCH v2] ext2: Cache line aligned partial sector bounce buffer In-Reply-To: References: <1314043924-22130-1-git-send-email-robotboy@chromium.org> <20110822214236.217D611F9E74@gemini.denx.de> Message-ID: <20110823183948.72B3711F9E62@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Anton Staaf, In message 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_