diff options
author | Anton Staaf <robotboy@chromium.org> | 2011-06-08 15:12:14 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:19 -0700 |
commit | 0501cc8d71a840c5b8ab44c1522f7f61a4718c13 (patch) | |
tree | 8e754b3b7e51b6c43f5a75527ff0ab7eb481f646 /fs | |
parent | f97bdd6f0eba1ec18fa70cd059f9b8d504f9c8c2 (diff) |
ext2: Cache line align partial sector bounce buffer
This allocates a cache line size aligned sector sized bounce buffer the
first time that ext2fs_devread is called. This is required to avoid
bounce buffers on ARM.
BUG=chromium-os:16317
TEST=run "ext2ls mmc 0:3" on Seaboard
Change-Id: Ia01d17d655eb503bf7835a8e663c3b71806872a8
Reviewed-on: http://gerrit.chromium.org/gerrit/2328
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext2/dev.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/ext2/dev.c b/fs/ext2/dev.c index 78851d0a5d0..e928f70cf80 100644 --- a/fs/ext2/dev.c +++ b/fs/ext2/dev.c @@ -26,8 +26,13 @@ #include <common.h> #include <config.h> +#include <malloc.h> #include <ext2fs.h> +#ifndef CACHE_LINE_SIZE +#define CACHE_LINE_SIZE __BIGGEST_ALIGNMENT__ +#endif + static block_dev_desc_t *ext2fs_block_dev_desc; static disk_partition_t part_info; @@ -52,9 +57,15 @@ int ext2fs_set_blk_dev(block_dev_desc_t *rbdd, int part) int ext2fs_devread(int sector, int byte_offset, int byte_len, char *buf) { - char sec_buf[SECTOR_SIZE]; + static char *sec_buf; unsigned sectors; + if (sec_buf == NULL) + sec_buf = memalign(CACHE_LINE_SIZE, SECTOR_SIZE); + + if (sec_buf == NULL) + return 0; + /* * Check partition boundaries */ |