]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: putobj processor: fix to allow different head sizes
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 10 Jan 2019 15:58:59 +0000 (07:58 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 16 Jan 2019 19:49:51 +0000 (11:49 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_putobj.h
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_rados.h

index 4d8114a3269cd41de8ab0061bb3a9785cc807381..367bc5c0c2fcb31d2cb626460c2ca4cdf96d67f9 100644 (file)
@@ -69,8 +69,8 @@ class StripeProcessor : public Pipe {
   std::pair<uint64_t, uint64_t> 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;
index 801419cbe73675819f69105ddc86e9b6c0dc096e..7705c367cf5ba7f09e4cf9129c4375c45d5f8117 100644 (file)
@@ -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;
 }
 
index 23d0f96f51bc2bd474b41175a6dd97397397a430..c11976343b13d731ef4764ed4b10352bb8296333 100644 (file)
@@ -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;
   }