filejournal: make io contiguous in write_bl() for directio

Previously we were splitting the io for writing the header plus first
segment following a wrap.
This commit is contained in:
Sage Weil 2010-02-06 11:19:39 -08:00
parent d289ea0e62
commit 2ec2d579cb

View 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) {