summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-04-09 16:00:41 -0700
committerGreg Farnum <greg@inktank.com>2013-04-09 16:00:41 -0700
commit8eb5465c10840d047a894d1a4f079ff8b8d608b5 (patch)
tree47620f9c9b859122b6789094ff935722509d3bfd
parent95374c628b2df020b9236b6373440d99545e4b1e (diff)
parent4cb18b5a6f17f6fd412d36e079de990a99ea5da3 (diff)
downloadceph-8eb5465c10840d047a894d1a4f079ff8b8d608b5.tar.gz
Merge branch 'wip-journaler-4618' into next
Reviewed-by: Sam Lang <sam.lang@inktank.com>
-rw-r--r--src/osdc/Journaler.cc18
-rw-r--r--src/osdc/Journaler.h4
2 files changed, 13 insertions, 9 deletions
diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc
index 544ac8c49c4..cd9b9edc4c7 100644
--- a/src/osdc/Journaler.cc
+++ b/src/osdc/Journaler.cc
@@ -64,7 +64,6 @@ void Journaler::set_layout(ceph_file_layout *l)
if (periods < 2)
periods = 2; // we need at least 2 periods to make progress.
fetch_len = layout.fl_stripe_count * layout.fl_object_size * periods;
- prefetch_from = fetch_len / 2;
}
@@ -835,6 +834,7 @@ void Journaler::_issue_read(uint64_t len)
void Journaler::_prefetch()
{
+ ldout(cct, 10) << "_prefetch" << dendl;
// prefetch
uint64_t pf;
if (temp_fetch_len) {
@@ -847,9 +847,11 @@ void Journaler::_prefetch()
uint64_t raw_target = read_pos + pf;
- // only read full log segments
+ // read full log segments, so increase if necessary
uint64_t period = get_layout_period();
- uint64_t target = raw_target - (raw_target % period);
+ uint64_t remainder = raw_target % period;
+ uint64_t adjustment = remainder ? period - remainder : 0;
+ uint64_t target = raw_target + adjustment;
// don't read past the log tail
if (target > write_pos)
@@ -883,7 +885,9 @@ bool Journaler::_is_readable()
read_buf.length() >= sizeof(s) + s)
return true; // yep, next entry is ready.
- // darn it!
+ ldout (cct, 10) << "_is_readable read_buf.length() == " << read_buf.length()
+ << ", but need " << s + sizeof(s)
+ << " for next entry; fetch_len is " << fetch_len << dendl;
// partial fragment at the end?
if (received_pos == write_pos) {
@@ -902,12 +906,14 @@ bool Journaler::_is_readable()
return false;
}
- uint64_t need = (sizeof(s)+s-read_buf.length());
+ uint64_t need = sizeof(s) + s;
if (need > fetch_len) {
+ temp_fetch_len = sizeof(s) + s;
ldout(cct, 10) << "_is_readable noting temp_fetch_len " << temp_fetch_len
<< " for len " << s << " entry" << dendl;
- temp_fetch_len = need;
}
+
+ ldout(cct, 10) << "_is_readable: not readable, returning false" << dendl;
return false;
}
diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h
index 81a39d21a5b..dfc2115c18b 100644
--- a/src/osdc/Journaler.h
+++ b/src/osdc/Journaler.h
@@ -194,7 +194,6 @@ private:
uint64_t fetch_len; // how much to read at a time
uint64_t temp_fetch_len;
- uint64_t prefetch_from; // how far from end do we read next chunk
// for wait_for_readable()
Context *on_readable;
@@ -251,7 +250,7 @@ public:
prezeroing_pos(0), prezero_pos(0), write_pos(0), flush_pos(0), safe_pos(0),
waiting_for_zero(false),
read_pos(0), requested_pos(0), received_pos(0),
- fetch_len(0), temp_fetch_len(0), prefetch_from(0),
+ fetch_len(0), temp_fetch_len(0),
on_readable(0), on_write_error(NULL),
expire_pos(0), trimming_pos(0), trimmed_pos(0)
{
@@ -273,7 +272,6 @@ public:
requested_pos = 0;
received_pos = 0;
fetch_len = 0;
- prefetch_from = 0;
assert(!on_readable);
expire_pos = 0;
trimming_pos = 0;