* [U-Boot] [PATCH] ext2: Cache line align indirection buffers
@ 2011-12-21 20:01 Simon Glass
2012-01-05 16:12 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Simon Glass @ 2011-12-21 20:01 UTC (permalink / raw)
To: u-boot
Make ext2 use cache line aligned buffers for reading from the filesystem.
This is needed when caches are enabled because unaligned cache invalidates
are not safe.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
fs/ext2/ext2fs.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c
index e119e13..f621741 100644
--- a/fs/ext2/ext2fs.c
+++ b/fs/ext2/ext2fs.c
@@ -265,7 +265,8 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
/* Indirect. */
else if (fileblock < (INDIRECT_BLOCKS + (blksz / 4))) {
if (indir1_block == NULL) {
- indir1_block = (uint32_t *) malloc (blksz);
+ indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN,
+ blksz);
if (indir1_block == NULL) {
printf ("** ext2fs read block (indir 1) malloc failed. **\n");
return (-1);
@@ -278,7 +279,8 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
indir1_block = NULL;
indir1_size = 0;
indir1_blkno = -1;
- indir1_block = (uint32_t *) malloc (blksz);
+ indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN,
+ blksz);
if (indir1_block == NULL) {
printf ("** ext2fs read block (indir 1) malloc failed. **\n");
return (-1);
@@ -309,7 +311,8 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
+ blksz / 4);
if (indir1_block == NULL) {
- indir1_block = (uint32_t *) malloc (blksz);
+ indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN,
+ blksz);
if (indir1_block == NULL) {
printf ("** ext2fs read block (indir 2 1) malloc failed. **\n");
return (-1);
@@ -322,7 +325,8 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
indir1_block = NULL;
indir1_size = 0;
indir1_blkno = -1;
- indir1_block = (uint32_t *) malloc (blksz);
+ indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN,
+ blksz);
if (indir1_block == NULL) {
printf ("** ext2fs read block (indir 2 1) malloc failed. **\n");
return (-1);
@@ -343,7 +347,8 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
}
if (indir2_block == NULL) {
- indir2_block = (uint32_t *) malloc (blksz);
+ indir2_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN,
+ blksz);
if (indir2_block == NULL) {
printf ("** ext2fs read block (indir 2 2) malloc failed. **\n");
return (-1);
@@ -356,7 +361,8 @@ static int ext2fs_read_block (ext2fs_node_t node, int fileblock) {
indir2_block = NULL;
indir2_size = 0;
indir2_blkno = -1;
- indir2_block = (uint32_t *) malloc (blksz);
+ indir2_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN,
+ blksz);
if (indir2_block == NULL) {
printf ("** ext2fs read block (indir 2 2) malloc failed. **\n");
return (-1);
--
1.7.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] ext2: Cache line align indirection buffers
2011-12-21 20:01 [U-Boot] [PATCH] ext2: Cache line align indirection buffers Simon Glass
@ 2012-01-05 16:12 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2012-01-05 16:12 UTC (permalink / raw)
To: u-boot
Dear Simon Glass,
In message <1324497688-26529-1-git-send-email-sjg@chromium.org> you wrote:
> Make ext2 use cache line aligned buffers for reading from the filesystem.
> This is needed when caches are enabled because unaligned cache invalidates
> are not safe.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> fs/ext2/ext2fs.c | 18 ++++++++++++------
> 1 files changed, 12 insertions(+), 6 deletions(-)
Applied, thanks.
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
Real Programmers always confuse Christmas and Halloween because
OCT 31 == DEC 25 ! - Andrew Rutherford (andrewr at ucs.adelaide.edu.au)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-05 16:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 20:01 [U-Boot] [PATCH] ext2: Cache line align indirection buffers Simon Glass
2012-01-05 16:12 ` Wolfgang Denk
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.