[sheepdog] [PATCH 1/2] journal: prealloc object in journal replay if 'create' set

Liu Yuan namei.unix at gmail.com
Thu Nov 15 07:08:13 CET 2012


From: Liu Yuan <tailai.ly at taobao.com>


Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/journal_file.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sheep/journal_file.c b/sheep/journal_file.c
index 343fad1..74a8d0b 100644
--- a/sheep/journal_file.c
+++ b/sheep/journal_file.c
@@ -148,6 +148,11 @@ static int replay_journal_entry(struct journal_descriptor *jd)
 		return -1;
 	}
 
+	if (jd->create) {
+		ret = prealloc(fd, get_objsize(jd->oid));
+		if (ret < 0)
+			goto out;
+	}
 	buf = xmalloc(jd->size);
 	p += JOURNAL_DESC_SIZE;
 	memcpy(buf, p, jd->size);
-- 
1.7.9.5




More information about the sheepdog mailing list