From 2f9ea76fba50722eecf578eb3520304d281759e5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 30 Jun 2010 08:34:26 -0700 Subject: [PATCH] filejournal: fix buffer realignment condition; useful debug output on error We don't care about contiguous, only about page alignment. --- src/os/FileJournal.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 4f5cbcc93c4..00df2092834 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -498,9 +498,13 @@ int FileJournal::prepare_single_write(bufferlist& bl, off64_t& queue_pos, uint64 void FileJournal::write_bl(off64_t& pos, bufferlist& bl) { - // make sure this is a single, contiguous buffer - if (directio && !bl.is_contiguous()) { + // make sure list segments are page aligned + if (directio && (!bl.is_page_aligned() || + !bl.is_n_page_sized())) { bl.rebuild_page_aligned(); + if ((bl.length() & ~PAGE_MASK) != 0 || + (pos & ~PAGE_MASK) != 0) + dout(0) << "rebuild_page_aligned failed, " << bl << dendl; assert((bl.length() & ~PAGE_MASK) == 0); assert((pos & ~PAGE_MASK) == 0); }