]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: use fmt::format() instead of sstream 45649/head
authorKefu Chai <tchaikov@gmail.com>
Fri, 25 Mar 2022 15:02:59 +0000 (23:02 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 25 Mar 2022 15:49:45 +0000 (23:49 +0800)
for better readability.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/journal/segment_allocator.cc

index 9f3a16efbc038faf5f870af77565c630dc7ae0cf..1d805ce2678e6dbaa7d8b9e77d2e95e95e3446f9 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "segment_allocator.h"
 
-#include <sstream>
+#include <fmt/format.h>
 
 #include "crimson/os/seastore/logging.h"
 #include "crimson/os/seastore/segment_cleaner.h"
@@ -18,14 +18,12 @@ SegmentAllocator::SegmentAllocator(
   SegmentProvider &sp,
   SegmentManager &sm)
   : name{name},
+    print_name{fmt::format("D?_{}", name)},
     type{type},
     segment_provider{sp},
     segment_manager{sm}
 {
   ceph_assert(type != segment_type_t::NULL_SEG);
-  std::ostringstream oss;
-  oss << "D?_" << name;
-  print_name = oss.str();
   reset();
 }
 
@@ -118,9 +116,9 @@ SegmentAllocator::open_ret
 SegmentAllocator::open()
 {
   LOG_PREFIX(SegmentAllocator::open);
-  std::ostringstream oss;
-  oss << "D" << device_id_printer_t{get_device_id()} << "_" << name;
-  print_name = oss.str();
+  print_name = fmt::format("D{}_{}",
+                           device_id_printer_t{get_device_id()},
+                           name);
   INFO("{}", print_name);
   return do_open();
 }