for (p++; p != data.end(); p++) {
// past?
- if (p->first < start+len) break;
+ if (p->first >= start+len) break;
const version_t v = p->second->get_version();
if (low > v) low = v;
// FIXME: waiters?
+ dout(20) << "split left is " << *orig << endl;
+ dout(20) << "split right is " << *right << endl;
+
+
return right;
}
bool BufferCache::bh_cancel_read(BufferHead *bh)
{
- assert(bh->rx_ioh);
- if (dev.cancel_io(bh->rx_ioh) >= 0) {
+ if (bh->rx_ioh && dev.cancel_io(bh->rx_ioh) >= 0) {
dout(10) << "bh_cancel_read on " << *bh << endl;
bh->rx_ioh = 0;
mark_missing(bh);
bool BufferCache::bh_cancel_write(BufferHead *bh)
{
- assert(bh->tx_ioh);
- if (dev.cancel_io(bh->tx_ioh) >= 0) {
+ if (bh->tx_ioh && dev.cancel_io(bh->tx_ioh) >= 0) {
dout(10) << "bh_cancel_write on " << *bh << endl;
bh->tx_ioh = 0;
mark_dirty(bh);
srand(0);
for (int i=0; i<100; i++) {
off_t off = rand() % 1000000;
- size_t len = 100;
+ size_t len = rand() % 10000;
cout << endl << "writing bit at " << off << " len " << len << endl;
fs.write(10, len, off, bl, (Context*)0);
}
- if (0) {
+ if (1) {
// read
srand(0);
for (int i=0; i<100; i++) {
bufferlist bl;
off_t off = rand() % 1000000;
- size_t len = 100;
+ size_t len = rand() % 1000;
cout << endl << "read bit at " << off << " len " << len << endl;
int r = fs.read(10, len, off, bl);
assert(bl.length() == len);
fs.trim_buffer_cache();
//fs.trim_buffer_cache();
- if (0) {
+ if (1) {
// read again
srand(0);
for (int i=0; i<100; i++) {