if (offset == length && offset == 0)
length = o->onode.size;
- r = _do_read(o, offset, length, bl, op_flags);
+ r = _do_read(o, offset, length, bl, false, op_flags);
out:
dout(10) << __func__ << " " << ch->cid << " " << oid
uint64_t offset,
size_t length,
bufferlist& bl,
+ bool do_cache,
uint32_t op_flags)
{
int r = 0;
stripe_off = offset % stripe_size;
while (length > 0) {
bufferlist stripe;
- _do_read_stripe(o, offset - stripe_off, &stripe);
+ _do_read_stripe(o, offset - stripe_off, &stripe, do_cache);
dout(30) << __func__ << " stripe " << offset - stripe_off << " got "
<< stripe.length() << dendl;
unsigned swant = std::min<unsigned>(stripe_size - stripe_off, length);
}
}
-void KStore::_do_read_stripe(OnodeRef o, uint64_t offset, bufferlist *pbl)
+void KStore::_do_read_stripe(OnodeRef o, uint64_t offset, bufferlist *pbl, bool do_cache)
{
+ if (!do_cache) {
+ string key;
+ get_data_key(o->onode.nid, offset, &key);
+ db->get(PREFIX_DATA, key, pbl);
+ return;
+ }
+
map<uint64_t,bufferlist>::iterator p = o->pending_stripes.find(offset);
if (p == o->pending_stripes.end()) {
string key;
}
uint64_t stripe_off = offset - offset_rem;
bufferlist prev;
- _do_read_stripe(o, stripe_off, &prev);
+ _do_read_stripe(o, stripe_off, &prev, true);
dout(20) << __func__ << " read previous stripe " << stripe_off
<< ", got " << prev.length() << dendl;
bufferlist bl;
while (pos < offset + length) {
if (stripe_off || end - pos < stripe_size) {
bufferlist stripe;
- _do_read_stripe(o, pos - stripe_off, &stripe);
+ _do_read_stripe(o, pos - stripe_off, &stripe, true);
dout(30) << __func__ << " stripe " << pos - stripe_off << " got "
<< stripe.length() << dendl;
bufferlist bl;
while (pos < o->onode.size) {
if (stripe_off) {
bufferlist stripe;
- _do_read_stripe(o, pos - stripe_off, &stripe);
+ _do_read_stripe(o, pos - stripe_off, &stripe, true);
dout(30) << __func__ << " stripe " << pos - stripe_off << " got "
<< stripe.length() << dendl;
bufferlist t;
// data
oldo->flush();
- r = _do_read(oldo, 0, oldo->onode.size, bl, 0);
+ r = _do_read(oldo, 0, oldo->onode.size, bl, true, 0);
if (r < 0)
goto out;
newo->exists = true;
_assign_nid(txc, newo);
- r = _do_read(oldo, srcoff, length, bl, 0);
+ r = _do_read(oldo, srcoff, length, bl, true, 0);
if (r < 0)
goto out;