summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-io.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2018-09-22 04:13:35 +0200
committerTom Rini <trini@konsulko.com>2018-09-30 13:00:37 -0400
commitc9795396edd53ad29537037de8fd752662c676ad (patch)
treeb4489e56e5c686c6ed87a1e302b0a90f56e3d165 /fs/btrfs/extent-io.c
parent30b3241368aff899c56359f63214c164ed3fb3fb (diff)
fs: btrfs: Fix cache alignment bugs
The btrfs implementation passes cache-unaligned buffers into the block layer, which triggers cache alignment problems down in the block device drivers. Align the buffers to prevent this. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Behun <marek.behun@nic.cz>
Diffstat (limited to 'fs/btrfs/extent-io.c')
-rw-r--r--fs/btrfs/extent-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent-io.c b/fs/btrfs/extent-io.c
index 7263f41644..66d0e1c7d6 100644
--- a/fs/btrfs/extent-io.c
+++ b/fs/btrfs/extent-io.c
@@ -7,6 +7,7 @@
#include "btrfs.h"
#include <malloc.h>
+#include <memalign.h>
u64 btrfs_read_extent_inline(struct btrfs_path *path,
struct btrfs_file_extent_item *extent, u64 offset,
@@ -89,7 +90,7 @@ u64 btrfs_read_extent_reg(struct btrfs_path *path,
return size;
}
- cbuf = malloc(dlen > size ? clen + dlen : clen);
+ cbuf = malloc_cache_aligned(dlen > size ? clen + dlen : clen);
if (!cbuf)
return -1ULL;