]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filejournal: make journal alignment max of block, page sizes
authorSage Weil <sage@newdream.net>
Thu, 1 Jul 2010 23:48:26 +0000 (16:48 -0700)
committerSage Weil <sage@newdream.net>
Thu, 1 Jul 2010 23:48:26 +0000 (16:48 -0700)
Alignment must be a multiple of page size.  At least currently.

src/os/FileJournal.cc

index e1bfc7f861c123a7001dccdf1bcb28faec549710..c491a8775874c048b19c37ed7b8f82e80e72906a 100644 (file)
@@ -65,7 +65,7 @@ int FileJournal::_open(bool forwrite, bool create)
   if (r < 0)
     return -errno;
   max_size = st.st_size;
-  block_size = st.st_blksize;
+  block_size = MAX(st.st_blksize, PAGE_SIZE);
 
   if (max_size == 0) {
     // hmm, is this a raw block device?
@@ -224,6 +224,11 @@ int FileJournal::open(uint64_t next_seq)
            << block_size << " (required for direct_io journal mode)" << dendl;
     err = -EINVAL;
   }
+  if ((header.alignment % PAGE_SIZE) && directio) {
+    derr(0) << "open journal alignment " << header.alignment << " is not multiple of page size " << PAGE_SIZE
+           << " (required for direct_io journal mode)" << dendl;
+    err = -EINVAL;
+  }
   if (err)
     return err;