From: Yehuda Sadeh Date: Thu, 10 Jan 2019 15:58:59 +0000 (-0800) Subject: rgw: putobj processor: fix to allow different head sizes X-Git-Tag: v14.1.0~314^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=426659bc039f8f12ad149ff84c3c8e558fdd5eb1;p=ceph.git rgw: putobj processor: fix to allow different head sizes Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_putobj.h b/src/rgw/rgw_putobj.h index 4d8114a3269c..367bc5c0c2fc 100644 --- a/src/rgw/rgw_putobj.h +++ b/src/rgw/rgw_putobj.h @@ -69,8 +69,8 @@ class StripeProcessor : public Pipe { std::pair bounds; // bounds of current stripe public: StripeProcessor(DataProcessor *next, StripeGenerator *gen, - uint64_t stripe_size) - : Pipe(next), gen(gen), bounds(0, stripe_size) + uint64_t first_stripe_size) + : Pipe(next), gen(gen), bounds(0, first_stripe_size) {} int process(bufferlist&& data, uint64_t data_offset) override; diff --git a/src/rgw/rgw_putobj_processor.cc b/src/rgw/rgw_putobj_processor.cc index 801419cbe736..7705c367cf5b 100644 --- a/src/rgw/rgw_putobj_processor.cc +++ b/src/rgw/rgw_putobj_processor.cc @@ -27,7 +27,7 @@ int HeadObjectProcessor::process(bufferlist&& data, uint64_t logical_offset) const bool flush = (data.length() == 0); // capture the first chunk for special handling - if (data_offset < head_chunk_size) { + if (data_offset < head_chunk_size || data_offset == 0) { if (flush) { // flush partial chunk return process_first_chunk(std::move(head_data), &processor); @@ -207,7 +207,8 @@ int AtomicObjectProcessor::prepare() return r; } const uint64_t default_stripe_size = store->ctx()->_conf->rgw_obj_stripe_size; - manifest.set_trivial_rule(max_chunk_size, default_stripe_size); + uint64_t head_max_size = max_chunk_size; + manifest.set_trivial_rule(head_max_size, default_stripe_size); r = manifest_gen.create_begin(store->ctx(), &manifest, bucket_info.placement_rule, @@ -228,13 +229,11 @@ int AtomicObjectProcessor::prepare() if (r < 0) { return r; } - // only the first chunk goes to the head object - uint64_t stripe_size = chunk_size; - set_head_chunk_size(chunk_size); + set_head_chunk_size(head_max_size); // initialize the processors chunk = ChunkProcessor(&writer, chunk_size); - stripe = StripeProcessor(&chunk, this, stripe_size); + stripe = StripeProcessor(&chunk, this, head_max_size); return 0; } @@ -356,7 +355,7 @@ int MultipartObjectProcessor::prepare_head() set_head_chunk_size(max_head_size); chunk = ChunkProcessor(&writer, chunk_size); - stripe = StripeProcessor(&chunk, this, stripe_size); + stripe = StripeProcessor(&chunk, this, max_head_size); return 0; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 23d0f96f51bc..c11976343b13 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -667,10 +667,6 @@ public: return head_size; } - void set_max_head_size(uint64_t s) { - max_head_size = s; - } - uint64_t get_max_head_size() { return max_head_size; }