RGWObjVersionTracker *objv_tracker,
const rgw_raw_obj& obj,
bufferlist *obl, off_t ofs, off_t end,
+ ceph::real_time* pmtime, uint64_t* psize,
map<string, bufferlist> *attrs,
bool raw_attrs,
rgw_cache_entry_info *cache_info,
rgw_pool pool;
string oid;
if (ofs != 0) {
- return RGWSI_SysObj_Core::read(dpp, read_state, objv_tracker,
- obj, obl, ofs, end, attrs, raw_attrs,
+ return RGWSI_SysObj_Core::read(dpp, read_state, objv_tracker, obj, obl,
+ ofs, end, pmtime, psize, attrs, raw_attrs,
cache_info, refresh_version, y);
}
uint32_t flags = (end != 0 ? CACHE_FLAG_DATA : 0);
if (objv_tracker)
flags |= CACHE_FLAG_OBJV;
+ if (pmtime || psize)
+ flags |= CACHE_FLAG_META;
if (attrs)
flags |= CACHE_FLAG_XATTRS;
i.copy_all(*obl);
if (objv_tracker)
objv_tracker->read_version = info.version;
+ if (pmtime) {
+ *pmtime = info.meta.mtime;
+ }
+ if (psize) {
+ *psize = info.meta.size;
+ }
if (attrs) {
if (raw_attrs) {
*attrs = info.xattrs;
if(r == -ENODATA)
return -ENOENT;
+ // if we only ask for one of mtime or size, ask for the other too so we can
+ // satisfy CACHE_FLAG_META
+ uint64_t size = 0;
+ real_time mtime;
+ if (pmtime) {
+ if (!psize) {
+ psize = &size;
+ }
+ } else if (psize) {
+ if (!pmtime) {
+ pmtime = &mtime;
+ }
+ }
+
map<string, bufferlist> unfiltered_attrset;
r = RGWSI_SysObj_Core::read(dpp, read_state, objv_tracker,
- obj, obl, ofs, end,
+ obj, obl, ofs, end, pmtime, psize,
(attrs ? &unfiltered_attrset : nullptr),
true, /* cache unfiltered attrs */
cache_info,
if (objv_tracker) {
info.version = objv_tracker->read_version;
}
+ if (pmtime) {
+ info.meta.mtime = *pmtime;
+ }
+ if (psize) {
+ info.meta.size = *psize;
+ }
if (attrs) {
info.xattrs = std::move(unfiltered_attrset);
if (raw_attrs) {
RGWObjVersionTracker *objv_tracker,
const rgw_raw_obj& obj,
bufferlist *bl, off_t ofs, off_t end,
+ ceph::real_time* pmtime, uint64_t* psize,
map<string, bufferlist> *attrs,
bool raw_attrs,
rgw_cache_entry_info *cache_info,
auto& read_state = static_cast<GetObjState&>(_read_state);
uint64_t len;
+ struct timespec mtime_ts;
librados::ObjectReadOperation op;
if (end < 0)
if (objv_tracker) {
objv_tracker->prepare_op_for_read(&op);
}
+ if (psize || pmtime) {
+ op.stat2(psize, &mtime_ts, nullptr);
+ }
ldpp_dout(dpp, 20) << "rados->read ofs=" << ofs << " len=" << len << dendl;
op.read(ofs, len, bl, nullptr);
return -ECANCELED;
}
+ if (pmtime) {
+ *pmtime = ceph::real_clock::from_timespec(mtime_ts);
+ }
if (attrs && !raw_attrs) {
rgw_filter_attrset(unfiltered_attrset, RGW_ATTR_PREFIX, attrs);
}