[Sheepdog] [PATCH] sheep: use valloc for data object I/O
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Sun Nov 27 19:14:41 CET 2011
Data objects may be opened with O_DIRECT, so we must allocate aligned
memory here.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/simple_store.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/sheep/simple_store.c b/sheep/simple_store.c
index 92e5504..424589f 100644
--- a/sheep/simple_store.c
+++ b/sheep/simple_store.c
@@ -45,7 +45,12 @@ static int store_write_last_sector(uint64_t oid, struct siocb *iocb)
char *buf = NULL;
int ret;
- buf = xzalloc(size);
+ buf = valloc(size);
+ if (!buf) {
+ eprintf("failed to allocate memory\n");
+ return SD_RES_NO_MEM;
+ }
+
iocb->buf = buf;
iocb->length = size;
iocb->offset = SD_DATA_OBJ_SIZE - size;
--
1.7.2.5
More information about the sheepdog
mailing list