summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2014-02-19 20:30:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-19 20:30:25 +0000
commit3b0c24e28d7538ff5b49a98eee99bac85c8e687b (patch)
treea08b0dcf8c3c8c2bdfd08316838f1fd3a3254cc5
parent223e07983718e1515f2a54542b9b0163a8f508ed (diff)
parent49e9344bddca3699c04f3da8c689d0f2b1a338b6 (diff)
downloadsystem_core-3b0c24e28d7538ff5b49a98eee99bac85c8e687b.zip
system_core-3b0c24e28d7538ff5b49a98eee99bac85c8e687b.tar.gz
system_core-3b0c24e28d7538ff5b49a98eee99bac85c8e687b.tar.bz2
Merge "sdcard: direct I/O file access write buffer alignment"
-rw-r--r--sdcard/sdcard.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 3bc8cd3..cb03316 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1244,6 +1244,12 @@ static int handle_write(struct fuse* fuse, struct fuse_handler* handler,
struct fuse_write_out out;
struct handle *h = id_to_ptr(req->fh);
int res;
+ __u8 aligned_buffer[req->size] __attribute__((__aligned__(PAGESIZE)));
+
+ if (req->flags & O_DIRECT) {
+ memcpy(aligned_buffer, buffer, req->size);
+ buffer = (const __u8*) aligned_buffer;
+ }
TRACE("[%d] WRITE %p(%d) %u@%llu\n", handler->token,
h, h->fd, req->size, req->offset);