From: Matt Benjamin Date: Wed, 4 Feb 2026 02:05:47 +0000 (-0500) Subject: posixdriver: add provisional manifest X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aa20363b225a69d0348a0ad2784f17bc255f0776;p=ceph.git posixdriver: add provisional manifest initially, it is just used to remember the multipart layout, but likely will see other use. Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/driver/posix/rgw_sal_posix.cc b/src/rgw/driver/posix/rgw_sal_posix.cc index 6c6475daaca1..461beef03353 100644 --- a/src/rgw/driver/posix/rgw_sal_posix.cc +++ b/src/rgw/driver/posix/rgw_sal_posix.cc @@ -35,6 +35,7 @@ const std::string ATTR_PREFIX = "user.X-RGW-"; #define RGW_POSIX_ATTR_MPUPLOAD "POSIX-Multipart-Upload" #define RGW_POSIX_ATTR_OWNER "POSIX-Owner" #define RGW_POSIX_ATTR_OBJECT_TYPE "POSIX-Object-Type" +#define RGW_POSIX_ATTR_MANIFEST "POSIX-Manifest" const std::string mp_ns = "multipart"; const std::string MP_OBJ_PART_PFX = "part-"; const std::string MP_OBJ_HEAD_NAME = MP_OBJ_PART_PFX + "00000"; @@ -3496,6 +3497,20 @@ int POSIXObject::POSIXReadOp::prepare(optional_yield y, const DoutPrefixProvider return -EINVAL; } + buffer::list manifest_bl; + if (source->get_attr(RGW_POSIX_ATTR_MANIFEST, manifest_bl)) { + POSIXManifest manifest; + auto iter = manifest_bl.cbegin(); + try { + manifest.decode(iter); + if (manifest.multipart_part_count > 0) { + params.parts_count = manifest.multipart_part_count; + } + } catch (buffer::error& err) { + // pass + } + } + #if 0 // WIP if (params.mod_ptr || params.unmod_ptr) { obj_time_weight src_weight; @@ -4047,6 +4062,12 @@ int POSIXMultipartUpload::complete(const DoutPrefixProvider *dpp, attrs[RGW_ATTR_COMPRESSION] = tmp; } + POSIXManifest manifest; + manifest.multipart_part_count = total_parts; + buffer::list manifest_bl; + manifest.encode(manifest_bl); + attrs[RGW_POSIX_ATTR_MANIFEST] = manifest_bl; + ret = shadow->merge_and_store_attrs(dpp, attrs, y); if (ret < 0) { return ret; diff --git a/src/rgw/driver/posix/rgw_sal_posix.h b/src/rgw/driver/posix/rgw_sal_posix.h index 227d7967c66c..b26a48315091 100644 --- a/src/rgw/driver/posix/rgw_sal_posix.h +++ b/src/rgw/driver/posix/rgw_sal_posix.h @@ -964,6 +964,23 @@ private: int write_attrs(const DoutPrefixProvider *dpp, optional_yield y); }; /* POSIXBucket */ +struct POSIXManifest { + int64_t multipart_part_count{-1}; + + void encode(bufferlist &bl) const { + ENCODE_START(1, 1, bl); + encode(multipart_part_count, bl); + ENCODE_FINISH(bl); + } + + void decode(bufferlist::const_iterator &bl) { + DECODE_START(1, bl); + decode(multipart_part_count, bl); + DECODE_FINISH(bl); + } +}; +WRITE_CLASS_ENCODER(POSIXManifest); + class POSIXObject : public StoreObject { public: private: