]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
filejournal: make io contiguous in write_bl() for directio
authorSage Weil <sage@newdream.net>
Sat, 6 Feb 2010 19:19:39 +0000 (11:19 -0800)
committerSage Weil <sage@newdream.net>
Sat, 6 Feb 2010 19:29:13 +0000 (11:29 -0800)
Previously we were splitting the io for writing the header plus first
segment following a wrap.

src/os/FileJournal.cc

index 5e066a925daea9daa5cf410ec889efbb4890ef07..b5b6366e4317e2f03a9d0be07f7cf5bd4b5f9c94 100644 (file)
@@ -444,6 +444,12 @@ bool FileJournal::prepare_single_write(bufferlist& bl, off64_t& queue_pos)
 
 void FileJournal::write_bl(off64_t& pos, bufferlist& bl)
 {
+  // make sure this is a single, contiguous buffer
+  if (directio && !bl.is_contiguous()) {
+    bl.rebuild();
+    assert((bl.length() & ~PAGE_MASK) == 0);
+  }
+
   ::lseek64(fd, pos, SEEK_SET);
 
   for (list<bufferptr>::const_iterator it = bl.buffers().begin();
@@ -489,13 +495,6 @@ void FileJournal::do_write(bufferlist& bl)
   // entry
   off64_t pos = write_pos;
 
-  // make sure this is a single, contiguous buffer
-  if (directio && !bl.is_contiguous()) {
-    bl.rebuild();
-    //dout(0) << "len " << bl.length() << " page_mask " << PAGE_MASK << " ~" << ~PAGE_MASK << dendl;
-    assert((bl.length() & ~PAGE_MASK) == 0);
-  }
-
   // split?
   off64_t split = 0;
   if (pos + bl.length() > header.max_size) {