Skip to content

Commit ddc8323

Browse files
authored
Merge pull request ceph#62787 from dang/wip-dang-getattrs
RGW - zipper - Remove target from get_obj_attrs() Reviewed-by: Casey Bodley <[email protected]>
2 parents a8184d5 + b8079bd commit ddc8323

File tree

12 files changed

+43
-48
lines changed

12 files changed

+43
-48
lines changed

src/rgw/driver/d4n/rgw_sal_d4n.cc

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,7 @@ bool D4NFilterObject::check_head_exists_in_cache_get_oid(const DoutPrefixProvide
14821482
return found_in_cache;
14831483
}
14841484

1485-
int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
1486-
rgw_obj* target_obj)
1485+
int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
14871486
{
14881487
bool is_latest_version = true;
14891488
if (this->have_instance()) {
@@ -1502,17 +1501,14 @@ int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* d
15021501
rgw::sal::Attrs attrs;
15031502
std::string version;
15041503
ldpp_dout(dpp, 10) << "D4NFilterObject::" << __func__ << "(): Fetching attrs from backend store." << dendl;
1505-
auto ret = next->get_obj_attrs(y, dpp, target_obj);
1506-
if (ret < 0 || !target_obj) {
1507-
if (!target_obj) {
1508-
ret = -ENOENT;
1509-
}
1504+
auto ret = next->get_obj_attrs(y, dpp);
1505+
if (ret < 0) {
15101506
ldpp_dout(dpp, 0) << "D4NFilterObject::" << __func__ << "(): Failed to fetching attrs from backend store with ret: " << ret << dendl;
15111507
return ret;
15121508
}
15131509

15141510
this->load_obj_state(dpp, y);
1515-
this->obj = *target_obj;
1511+
this->obj = next->get_obj();
15161512
if (!this->obj.key.instance.empty()) {
15171513
this->set_instance(this->obj.key.instance);
15181514
}
@@ -2099,8 +2095,7 @@ int D4NFilterObject::D4NFilterReadOp::get_attr(const DoutPrefixProvider* dpp, co
20992095
{
21002096
rgw::sal::Attrs& attrs = source->get_attrs();
21012097
if (attrs.empty()) {
2102-
rgw_obj obj = source->get_obj();
2103-
auto ret = source->get_obj_attrs(y, dpp, &obj);
2098+
auto ret = source->get_obj_attrs(y, dpp);
21042099
if (ret < 0) {
21052100
ldpp_dout(dpp, 0) << "D4NFilterObject::" << __func__ << "(): Error: failed to fetch attrs, ret=" << ret << dendl;
21062101
return ret;

src/rgw/driver/d4n/rgw_sal_d4n.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ class D4NFilterObject : public FilterObject {
264264
bool follow_olh = true) override;
265265
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
266266
Attrs* delattrs, optional_yield y, uint32_t flags) override;
267-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
268-
rgw_obj* target_obj = NULL) override;
267+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
269268
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val,
270269
optional_yield y, const DoutPrefixProvider* dpp,
271270
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;

src/rgw/driver/posix/rgw_sal_posix.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,8 +3129,7 @@ int POSIXObject::set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
31293129
return 0;
31303130
}
31313131

3132-
int POSIXObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
3133-
rgw_obj* target_obj)
3132+
int POSIXObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
31343133
{
31353134
//int fd;
31363135

src/rgw/driver/posix/rgw_sal_posix.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,7 @@ class POSIXObject : public StoreObject {
10501050
virtual int load_obj_state(const DoutPrefixProvider* dpp, optional_yield y, bool follow_olh = true) override;
10511051
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
10521052
Attrs* delattrs, optional_yield y, uint32_t flags) override;
1053-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
1054-
rgw_obj* target_obj = NULL) override;
1053+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
10551054
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val,
10561055
optional_yield y, const DoutPrefixProvider* dpp,
10571056
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,19 +2843,30 @@ int RadosObject::set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, A
28432843
y, log_op, mtime);
28442844
}
28452845

2846-
int RadosObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj)
2846+
int RadosObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
28472847
{
28482848
RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rados_ctx, get_obj());
28492849
RGWRados::Object::Read read_op(&op_target);
2850+
rgw_obj target = get_obj();
2851+
2852+
int r = read_attrs(dpp, read_op, y, &target);
2853+
if (r < 0) {
2854+
return r;
2855+
}
28502856

2851-
return read_attrs(dpp, read_op, y, target_obj);
2857+
set_instance(target.key.instance);
2858+
2859+
return 0;
28522860
}
28532861

28542862
int RadosObject::modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp, uint32_t flags)
28552863
{
28562864
rgw_obj target = get_obj();
28572865
rgw_obj save = get_obj();
2858-
int r = get_obj_attrs(y, dpp, &target);
2866+
RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rados_ctx, get_obj());
2867+
RGWRados::Object::Read read_op(&op_target);
2868+
2869+
int r = read_attrs(dpp, read_op, y, &target);
28592870
if (r < 0) {
28602871
return r;
28612872
}

src/rgw/driver/rados/rgw_sal_rados.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class RadosObject : public StoreObject {
612612
optional_yield y) override;
613613

614614
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, Attrs* delattrs, optional_yield y, uint32_t flags) override;
615-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj = NULL) override;
615+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
616616
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp,
617617
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;
618618
virtual int delete_obj_attrs(const DoutPrefixProvider* dpp, const char* attr_name, optional_yield y) override;

src/rgw/rgw_sal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ class Object {
12481248
* deleted. @note the attribute APIs may be revisited in the future. */
12491249
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, Attrs* delattrs, optional_yield y, uint32_t flags) = 0;
12501250
/** Get attributes for this object */
1251-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj = NULL) = 0;
1251+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) = 0;
12521252
/** Modify attributes for this object. */
12531253
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp,
12541254
uint32_t flags = rgw::sal::FLAG_LOG_OP) = 0;

src/rgw/rgw_sal_dbstore.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,21 @@ namespace rgw::sal {
546546
return op_target.set_attrs(dpp, setattrs ? *setattrs : empty, delattrs);
547547
}
548548

549-
int DBObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj)
549+
int DBObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
550550
{
551551
DB::Object op_target(store->getDB(), get_bucket()->get_info(), get_obj());
552552
DB::Object::Read read_op(&op_target);
553553

554-
return read_attrs(dpp, read_op, y, target_obj);
554+
return read_attrs(dpp, read_op, y, nullptr);
555555
}
556556

557557
int DBObject::modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp, uint32_t flags)
558558
{
559559
rgw_obj target = get_obj();
560-
int r = get_obj_attrs(y, dpp, &target);
560+
DB::Object op_target(store->getDB(), get_bucket()->get_info(), get_obj());
561+
DB::Object::Read read_op(&op_target);
562+
563+
int r = read_attrs(dpp, read_op, y, &target);
561564
if (r < 0) {
562565
return r;
563566
}

src/rgw/rgw_sal_dbstore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ class DBNotification : public StoreNotification {
574574
bool is_sync_completed(const DoutPrefixProvider* dpp, optional_yield y,
575575
const ceph::real_time& obj_mtime) override;
576576
virtual int load_obj_state(const DoutPrefixProvider* dpp, optional_yield y, bool follow_olh = true) override;
577-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj = NULL) override;
577+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
578578
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp,
579579
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;
580580
virtual int delete_obj_attrs(const DoutPrefixProvider* dpp, const char* attr_name, optional_yield y) override;

src/rgw/rgw_sal_filter.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,10 +1086,9 @@ int FilterObject::set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
10861086
return next->set_obj_attrs(dpp, setattrs, delattrs, y, flags);
10871087
}
10881088

1089-
int FilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
1090-
rgw_obj* target_obj)
1089+
int FilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
10911090
{
1092-
return next->get_obj_attrs(y, dpp, target_obj);
1091+
return next->get_obj_attrs(y, dpp);
10931092
}
10941093

10951094
int FilterObject::modify_obj_attrs(const char* attr_name, bufferlist& attr_val,

0 commit comments

Comments
 (0)