From 8898929ce7b838c8f05e14abe215f73942810218 Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 2 Oct 2007 00:08:29 +0000 Subject: [PATCH] fix bug with large bufferlists with > IOV_MAX buffers git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1877 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/mds/ebofs/BlockDevice.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/branches/sage/mds/ebofs/BlockDevice.cc b/branches/sage/mds/ebofs/BlockDevice.cc index 355ae39daa5ac..94c108db2612c 100644 --- a/branches/sage/mds/ebofs/BlockDevice.cc +++ b/branches/sage/mds/ebofs/BlockDevice.cc @@ -155,24 +155,25 @@ int BlockDevice::ElevatorQueue::dequeue_io(list& biols, // allowed? (not already submitted to kernel?) if (block_lock.intersects(bio->start, bio->length)) { - // dout(20) << "dequeue_io " << bio->start << "~" << bio->length - // << " intersects block_lock " << block_lock << dendl; + dout(20) << "dequeue_io " << bio->start << "~" << bio->length + << " intersects block_lock " << block_lock << dendl; break; // stop, or go with what we've got so far } // add to biols int nv = bio->bl.buffers().size(); // how many iov's in this bio's bufferlist? - if (num_iovs + nv >= IOV_MAX) break; // to many //g_conf.bdev_iov_max) break; // too many! + if (num_bio && + num_iovs + nv >= IOV_MAX) break; // to many //g_conf.bdev_iov_max) break; // too many! num_iovs += nv; start = MIN(start, bio->start); length += bio->length; if (el_dir_forward) { - //dout(20) << "dequeue_io fw dequeue io at " << el_pos << " " << *i->second << dendl; + dout(20) << "dequeue_io fw dequeue io at " << el_pos << " " << *i->second << dendl; biols.push_back(bio); // add at back } else { - // dout(20) << "dequeue_io bw dequeue io at " << el_pos << " " << *i->second << dendl; + dout(20) << "dequeue_io bw dequeue io at " << el_pos << " " << *i->second << dendl; biols.push_front(bio); // add at front } num_bio++; @@ -689,7 +690,8 @@ int BlockDevice::_write(int fd, unsigned bno, unsigned num, bufferlist& bl) left -= iov[n].iov_len; n++; - if (left == 0) break; + if (left == 0 || + n == IOV_MAX) break; } int r = ::writev(fd, iov, n); -- 2.39.5