summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-10-12 04:41:27 +0200
committerLennart Poettering <lennart@poettering.net>2011-10-12 04:41:27 +0200
commit38ac38b298a91c358285b7330aa66679338af874 (patch)
treeff04e22cddaf2262f7341ed26d38487e6d438e30 /src/journal/journal-file.c
parent689b9a22f7fa89686b2b5240b7ee9f449dea5630 (diff)
journal: only fallocate() what we really need to avoid slowness on file systems which do not support fallocate natively
Diffstat (limited to 'src/journal/journal-file.c')
-rw-r--r--src/journal/journal-file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 37e2e37eb1..45cc0d1d8e 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -162,7 +162,7 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
new_size = PAGE_ALIGN(offset + size);
/* We assume that this file is not sparse, and we know that
- * for sure, since we alway call posix_fallocate()
+ * for sure, since we always call posix_fallocate()
* ourselves */
old_size =
@@ -195,7 +195,7 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
if (asize > le64toh(f->header->arena_max_size))
return -E2BIG;
- if (posix_fallocate(f->fd, 0, new_size) < 0)
+ if (posix_fallocate(f->fd, old_size, new_size - old_size) < 0)
return -errno;
if (fstat(f->fd, &f->last_stat) < 0)