]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: make initial journal files 0 bytes
authorSage Weil <sage@inktank.com>
Tue, 10 Sep 2013 05:27:23 +0000 (22:27 -0700)
committerAlfredo Deza <alfredo@deza.pe>
Wed, 12 Feb 2014 21:37:06 +0000 (16:37 -0500)
The ceph-osd will resize journal files up and properly fallocate() them
so that the blocks are preallocated and (hopefully) contiguous.  We
don't need to do it here too, and getting fallocate() to work from
python is a pain in the butt.

Fixes: #5981
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit a786ad773cd33880075f1deb3691528d1afd03ec)

src/ceph-disk

index 5484c1a607b39c9dd988da16da7c15e0a63ce7cf..63b42de76214eb946e599cbe5e35f14d689e0cce 100755 (executable)
@@ -1039,15 +1039,12 @@ def prepare_journal_dev(
 
 
 def prepare_journal_file(
-    journal,
-    journal_size):
+    journal):
 
     if not os.path.exists(journal):
-        LOG.debug('Creating journal file %s with size %dM', journal, journal_size)
+        LOG.debug('Creating journal file %s with size 0 (ceph-osd will resize and allocate)', journal)
         with file(journal, 'wb') as journal_file:
-            journal_file.truncate(journal_size * 1048576)
-
-    # FIXME: should we resize an existing journal file?
+            pass
 
     LOG.debug('Journal is file %s', journal)
     LOG.warning('OSD will not be hot-swappable if journal is not the same device as the osd data')
@@ -1072,13 +1069,13 @@ def prepare_journal(
     if not os.path.exists(journal):
         if force_dev:
             raise Error('Journal does not exist; not a block device', journal)
-        return prepare_journal_file(journal, journal_size)
+        return prepare_journal_file(journal)
 
     jmode = os.stat(journal).st_mode
     if stat.S_ISREG(jmode):
         if force_dev:
             raise Error('Journal is not a block device', journal)
-        return prepare_journal_file(journal, journal_size)
+        return prepare_journal_file(journal)
 
     if stat.S_ISBLK(jmode):
         if force_file: