From d064915aa56aaa945b69af55877c7ac4f01d93a5 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 6 Jul 2017 11:59:05 -0400 Subject: [PATCH] rgw_file: compression fix and cleanup from review A fix and a cleanup from Adam Kupczyk review. Signed-off-by: Matt Benjamin --- src/rgw/rgw_file.cc | 10 +++++----- src/rgw/rgw_file.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 89d53f7dfb9..2e7e9d02f1d 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1258,6 +1258,10 @@ namespace rgw { int RGWWriteRequest::exec_start() { struct req_state* s = get_state(); + auto compression_type = + get_store()->get_zone_params().get_compression_type( + s->bucket_info.placement_rule); + /* not obviously supportable */ assert(! dlo_manifest); assert(! slo_info); @@ -1293,10 +1297,6 @@ namespace rgw { } filter = processor; - - if (compression_type == "none") - compression_type = get_store()->get_zone_params().get_compression_type( - s->bucket_info.placement_rule); if (compression_type != "none") { plugin = Compressor::create(s->cct, compression_type); if (! plugin) { @@ -1371,7 +1371,7 @@ namespace rgw { filter = &*compressor; } - op_ret = put_data_and_throttle(processor, data, ofs, false); + op_ret = put_data_and_throttle(filter, data, ofs, false); if (op_ret < 0) { goto done; } diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 9a07d8340bb..3a1cc00af41 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -2190,7 +2190,6 @@ public: RGWPutObjProcessor* processor; RGWPutObjDataProcessor* filter; boost::optional compressor; - std::string compression_type = "none"; CompressorRef plugin; buffer::list data; uint64_t timer_id; -- 2.39.5