string oid;
if (ofs != 0) {
return RGWSI_SysObj_Core::read(obj_ctx, read_state, objv_tracker,
- obj, obl, ofs, end, attrs, true,
+ obj, obl, ofs, end, attrs, raw_attrs,
cache_info, refresh_version);
}
ObjectCacheInfo info;
- uint32_t flags = CACHE_FLAG_DATA;
+ uint32_t flags = (end != 0 ? CACHE_FLAG_DATA : 0);
if (objv_tracker)
flags |= CACHE_FLAG_OBJV;
if (attrs)
if (obl->length() == end + 1) {
/* in this case, most likely object contains more data, we can't cache it */
- return r;
+ flags &= ~CACHE_FLAG_DATA;
+ } else {
+ bufferptr p(r);
+ bufferlist& bl = info.data;
+ bl.clear();
+ bufferlist::iterator o = obl->begin();
+ o.copy_all(bl);
}
- bufferptr p(r);
- bufferlist& bl = info.data;
- bl.clear();
- bufferlist::iterator o = obl->begin();
- o.copy_all(bl);
info.status = 0;
info.flags = flags;
if (objv_tracker) {
map<string, bufferlist> unfiltered_attrset;
if (attrs) {
- op.getxattrs(&unfiltered_attrset, nullptr);
+ if (raw_attrs) {
+ op.getxattrs(attrs, nullptr);
+ } else {
+ op.getxattrs(&unfiltered_attrset, nullptr);
+ }
}
RGWSI_RADOS::Obj rados_obj;
return -ECANCELED;
}
- if (attrs) {
- if (raw_attrs) {
- attrs->swap(unfiltered_attrset);
- } else {
- rgw_filter_attrset(unfiltered_attrset, RGW_ATTR_PREFIX, attrs);
- }
+ if (attrs && !raw_attrs) {
+ rgw_filter_attrset(unfiltered_attrset, RGW_ATTR_PREFIX, attrs);
}
read_state.last_ver = op_ver;