From fe1e4a2193a02ff83a9eb7506e0d75ed94e0741b Mon Sep 17 00:00:00 2001 From: sage Date: Sun, 3 Sep 2006 22:39:07 +0000 Subject: [PATCH] fixed stpuid write blocking bug, yay! git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@839 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/ebofs/Ebofs.cc | 32 +++++++++++++++++++------------- ceph/ebofs/Table.h | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ceph/ebofs/Ebofs.cc b/ceph/ebofs/Ebofs.cc index 27518f3099c71..b99e6a70da7b3 100644 --- a/ceph/ebofs/Ebofs.cc +++ b/ceph/ebofs/Ebofs.cc @@ -375,6 +375,12 @@ int Ebofs::commit_thread_entry() << nodepool.num_free() << " (" << 100*nodepool.num_free()/nodepool.num_total() << "%) free, " << nodepool.num_limbo() << " (" << 100*nodepool.num_limbo()/nodepool.num_total() << "%) limbo, " << nodepool.num_total() << " total." << endl; + dout(2) << "commit_thread bc: " + << "size " << bc.get_size() + << ", trimmable " << bc.get_trimmable() + << ", max " << g_conf.ebofs_bc_size + << endl; + // (async) write onodes+condes (do this first; it currently involves inode reallocation) commit_inodes_start(); @@ -1976,9 +1982,21 @@ unsigned Ebofs::apply_transaction(Transaction& t, Context *onsafe) int Ebofs::_write(object_t oid, off_t offset, size_t length, bufferlist& bl) { - dout(7) << "_write " << hex << oid << dec << " len " << length << " off " << offset << endl; + dout(7) << "_write " << hex << oid << dec << " " << offset << "~" << length << endl; assert(bl.length() == length); + // too much unflushed dirty data? (if so, block!) + if (_write_will_block()) { + dout(10) << "_write blocking " + << hex << oid << dec << " " << offset << "~" << length << endl; + + while (_write_will_block()) + bc.waitfor_stat(); // waits on ebofs_lock + + dout(7) << "_write unblocked " + << hex << oid << dec << " " << offset << "~" << length << endl; + } + // out of space? unsigned max = (length+offset) / EBOFS_BLOCK_SIZE + 10; // very conservative; assumes we have to rewrite max += dirty_onodes.size() + dirty_cnodes.size(); @@ -2042,18 +2060,6 @@ int Ebofs::write(object_t oid, ebofs_lock.Lock(); assert(len > 0); - // too much unflushed dirty data? (if so, block!) - if (_write_will_block()) { - dout(10) << "write blocking " - << hex << oid << dec << " len " << len << " off " << off << endl; - - while (_write_will_block()) - bc.waitfor_stat(); // waits on ebofs_lock - - dout(7) << "write unblocked " - << hex << oid << dec << " len " << len << " off " << off << endl; - } - // go int r = _write(oid, off, len, bl); diff --git a/ceph/ebofs/Table.h b/ceph/ebofs/Table.h index 872b360b3de58..438dca4e6332a 100644 --- a/ceph/ebofs/Table.h +++ b/ceph/ebofs/Table.h @@ -537,7 +537,7 @@ class Table { assert( cursor.open[cursor.level].size() == cursor.open[cursor.level].max_items() ); /* can we rotate? */ - if (false) + if (false) // NO! there's a bug in here somewhere, don't to it. if (cursor.level > 0) { if ((cursor.pos[cursor.level-1] > 0 && cursor.rotate_left() >= 0) || -- 2.39.5