]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 03:48:00 +0000 (11:48 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 04:23:35 +0000 (12:23 +0800)
* add "std::" prefix in headers
* add "using" declarations in .cc files.

so we don't rely on "using namespace std" in one or more included
headers.

Signed-off-by: Kefu Chai <kchai@redhat.com>
33 files changed:
src/common/options/rbd.yaml.in
src/librbd/BlockGuard.h
src/librbd/ImageCtx.h
src/librbd/Utils.cc
src/librbd/Watcher.h
src/librbd/api/DiffIterate.cc
src/librbd/api/Group.cc
src/librbd/api/Image.cc
src/librbd/api/Mirror.cc
src/librbd/api/Namespace.cc
src/librbd/api/Snapshot.cc
src/librbd/api/Trash.cc
src/librbd/cache/ObjectCacherWriteback.cc
src/librbd/cache/ParentCacheObjectDispatch.cc
src/librbd/cache/pwl/AbstractWriteLog.cc
src/librbd/cache/pwl/ImageCacheState.cc
src/librbd/cache/pwl/LogOperation.cc
src/librbd/cache/pwl/Request.cc
src/librbd/cache/pwl/Request.h
src/librbd/cache/pwl/Types.cc
src/librbd/cache/pwl/Types.h
src/librbd/cache/pwl/rwl/WriteLog.cc
src/librbd/cache/pwl/ssd/Types.h
src/librbd/cache/pwl/ssd/WriteLog.cc
src/librbd/image/CreateRequest.cc
src/librbd/internal.cc
src/librbd/internal.h
src/librbd/io/QosImageDispatch.cc
src/librbd/journal/Types.h
src/librbd/librbd.cc
src/librbd/managed_lock/ReleaseRequest.cc
src/librbd/operation/SnapshotRemoveRequest.cc
src/librbd/operation/TrimRequest.cc

index e8f5d0d2555a6289815a788dd9e513e651b7c2ea..e7b2f2e6048d9cb0fe1ed58585e604f399461cbc 100644 (file)
@@ -57,7 +57,7 @@ options:
   - runtime
   validator: |
     [](std::string *value, std::string *error_message) {
-      stringstream ss;
+      std::stringstream ss;
       uint64_t features = librbd::rbd_features_from_string(*value, &ss);
       // Leave this in integer form to avoid breaking Cinder.  Someday
       // we would like to present this in string form instead...
@@ -748,7 +748,7 @@ options:
   - runtime
   validator: |
     [](std::string *value, std::string *error_message) {
-        ostringstream ss;
+        std::ostringstream ss;
         uint64_t exclude_ops = librbd::io::rbd_io_operations_from_string(*value, &ss);
         // Leave this in integer form to avoid breaking Cinder.  Someday
         // we would like to present this in string form instead...
index 2474e3c022abdd220259b3cf0e9fe50af52073f3..1fbbc05c8e9aa9ea26225d2a70275787d43df3d3 100644 (file)
@@ -31,7 +31,7 @@ struct BlockExtent {
     : block_start(block_start), block_end(block_end) {
   }
 
-  friend ostream& operator<< (ostream& os, const BlockExtent& block_extent) {
+  friend std::ostream& operator<< (std::ostream& os, const BlockExtent& block_extent) {
     os << "[block_start = " << block_extent.block_start << ", "
        << "block_end = " << block_extent.block_end << ")";
     return os;
index ba44d314c86c8eb7df60783a061f5f034dce3c29..2fe67c408ede7d92a19d8d326f7dfe41d2c9d6df 100644 (file)
@@ -83,7 +83,7 @@ namespace librbd {
       }
     };
 
-    static const string METADATA_CONF_PREFIX;
+    static const std::string METADATA_CONF_PREFIX;
 
     CephContext *cct;
     ConfigProxy config;
@@ -281,7 +281,7 @@ namespace librbd {
 
     uint64_t get_current_size() const;
     uint64_t get_object_size() const;
-    string get_object_name(uint64_t num) const;
+    std::string get_object_name(uint64_t num) const;
     uint64_t get_stripe_unit() const;
     uint64_t get_stripe_count() const;
     uint64_t get_stripe_period() const;
@@ -324,7 +324,7 @@ namespace librbd {
     int get_parent_overlap(librados::snap_t in_snap_id,
                           uint64_t *overlap) const;
     void register_watch(Context *on_finish);
-    uint64_t prune_parent_extents(vector<pair<uint64_t,uint64_t> >& objectx,
+    uint64_t prune_parent_extents(std::vector<std::pair<uint64_t,uint64_t> >& objectx,
                                  uint64_t overlap);
 
     void cancel_async_requests();
index dadf6ab8126ae35c7b8afb86e9955226dcab87aa..112f342bd0262a7925a27b6476e43d3ee4cdeed0 100644 (file)
@@ -67,7 +67,7 @@ std::string generate_image_id(librados::IoCtx &ioctx) {
   std::uniform_int_distribution<uint32_t> distribution{0, 0xFFFFFFFF};
   uint32_t extra = distribution(generator);
 
-  ostringstream bid_ss;
+  std::ostringstream bid_ss;
   bid_ss << std::hex << bid << std::hex << extra;
   std::string id = bid_ss.str();
 
index 96ecda7d0e7bff4d063f42d5b19dd3cf3e971e98..e029430c5b7d7a9939e92e2293de2f2816d36a16 100644 (file)
@@ -44,7 +44,7 @@ public:
   void unblock_notifies();
 
   std::string get_oid() const;
-  void set_oid(const string& oid);
+  void set_oid(const std::string& oid);
 
   uint64_t get_watch_handle() const {
     std::shared_lock watch_locker{m_watch_lock};
index dcd07ea56a3dde924aeec10b48c5a5dcf2fe514f..c73610df309691a6ba138f95dbc60fdfc48e9e58 100644 (file)
@@ -263,11 +263,11 @@ int DiffIterate<I>::execute() {
 
   while (left > 0) {
     uint64_t period_off = off - (off % period);
-    uint64_t read_len = min(period_off + period - off, left);
+    uint64_t read_len = std::min(period_off + period - off, left);
 
     if (fast_diff_enabled) {
       // map to extents
-      map<object_t,vector<ObjectExtent> > object_extents;
+      std::map<object_t,std::vector<ObjectExtent> > object_extents;
       Striper::file_to_extents(cct, m_image_ctx.format_string,
                                &m_image_ctx.layout, off, read_len, 0,
                                object_extents, 0);
index 512df799791ff0409aa136fab340932bea40f46a..cb6b44e8d5a0d1f1c7765fac7c60c60bc22322e8 100644 (file)
@@ -59,7 +59,7 @@ string generate_uuid(librados::IoCtx& io_ctx)
   uint64_t bid = rados.get_instance_id();
 
   uint32_t extra = rand() % 0xFFFFFFFF;
-  ostringstream bid_ss;
+  std::ostringstream bid_ss;
   bid_ss << std::hex << bid << std::hex << extra;
   return bid_ss.str();
 }
index 7df0f4fc69e2e85e04a40e46131ed5abdb0b6ed5..eab7efdb2647d2cc2e452b2f6c442707946be024 100644 (file)
@@ -32,6 +32,8 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "librbd::api::Image: " << __func__ << ": "
 
+using std::map;
+using std::string;
 using librados::snap_t;
 
 namespace librbd {
index 825d430bc05b8d4ba1d1ef33c3afaa10bbb10956..51716ff3698799290c685577f505c7877ec18efe 100644 (file)
@@ -538,7 +538,7 @@ int Mirror<I>::image_disable(I *ictx, bool force) {
   };
 
   std::unique_lock image_locker{ictx->image_lock};
-  map<librados::snap_t, SnapInfo> snap_info = ictx->snap_info;
+  std::map<librados::snap_t, SnapInfo> snap_info = ictx->snap_info;
   for (auto &info : snap_info) {
     cls::rbd::ParentImageSpec parent_spec{ictx->md_ctx.get_id(),
                                           ictx->md_ctx.get_namespace(),
@@ -1115,7 +1115,7 @@ int Mirror<I>::mode_set(librados::IoCtx& io_ctx,
   }
 
   if (next_mirror_mode == cls::rbd::MIRROR_MODE_POOL) {
-    map<string, string> images;
+    std::map<std::string, std::string> images;
     r = Image<I>::list_images_v2(io_ctx, &images);
     if (r < 0) {
       lderr(cct) << "failed listing images: " << cpp_strerror(r) << dendl;
@@ -1552,7 +1552,7 @@ int Mirror<I>::peer_site_remove(librados::IoCtx& io_ctx,
     return r;
   }
 
-  vector<string> names;
+  std::vector<std::string> names;
   r = Namespace<I>::list(io_ctx, &names);
   if (r < 0) {
     return r;
@@ -1829,9 +1829,9 @@ int Mirror<I>::image_global_status_list(
   CephContext *cct = reinterpret_cast<CephContext *>(io_ctx.cct());
   int r;
 
-  map<string, string> id_to_name;
+  std::map<std::string, std::string> id_to_name;
   {
-    map<string, string> name_to_id;
+    std::map<std::string, std::string> name_to_id;
     r = Image<I>::list_images_v2(io_ctx, &name_to_id);
     if (r < 0) {
       return r;
@@ -1841,8 +1841,8 @@ int Mirror<I>::image_global_status_list(
     }
   }
 
-  map<std::string, cls::rbd::MirrorImage> images_;
-  map<std::string, cls::rbd::MirrorImageStatus> statuses_;
+  std::map<std::string, cls::rbd::MirrorImage> images_;
+  std::map<std::string, cls::rbd::MirrorImageStatus> statuses_;
 
   r = librbd::cls_client::mirror_image_status_list(&io_ctx, start_id, max,
                                                   &images_, &statuses_);
@@ -1969,8 +1969,8 @@ int Mirror<I>::image_info_list(
   entries->clear();
 
   while (entries->size() < max) {
-    map<std::string, cls::rbd::MirrorImage> images;
-    map<std::string, cls::rbd::MirrorImageStatus> statuses;
+    std::map<std::string, cls::rbd::MirrorImage> images;
+    std::map<std::string, cls::rbd::MirrorImageStatus> statuses;
 
     int r = librbd::cls_client::mirror_image_status_list(&io_ctx, last_read,
                                                          max, &images,
index 6c5ac7fda3145dc44d140f7a032202819df08c44..86ed70c06acec84caa80b9330a118897dd500163 100644 (file)
@@ -169,7 +169,7 @@ rollback:
 }
 
 template <typename I>
-int Namespace<I>::list(IoCtx& io_ctx, vector<string> *names)
+int Namespace<I>::list(IoCtx& io_ctx, std::vector<std::string> *names)
 {
   CephContext *cct = (CephContext *)io_ctx.cct();
   ldout(cct, 5) << dendl;
index 88f22694cf28d4e85c6beeb14e2e894fef8ea479..c175808bdc24049b4d4836d4a18b704e7b648bcf 100644 (file)
@@ -62,7 +62,7 @@ public:
       return r;
     }
 
-    string group_header_oid = util::group_header_name(snap_namespace.group_id);
+    std::string group_header_oid = util::group_header_name(snap_namespace.group_id);
     r = cls_client::group_snap_get_by_id(&group_ioctx,
                                         group_header_oid,
                                         snap_namespace.group_snapshot_id,
@@ -277,7 +277,7 @@ int Snapshot<I>::get_id(I *ictx, const std::string& snap_name, uint64_t *snap_id
   }
 
 template <typename I>
-int Snapshot<I>::list(I *ictx, vector<snap_info_t>& snaps) {
+int Snapshot<I>::list(I *ictx, std::vector<snap_info_t>& snaps) {
   ldout(ictx->cct, 20) << "snap_list " << ictx << dendl;
 
   int r = ictx->state->refresh_if_required();
index 7285e9e990c136e2b72ce509c814c157e5a0e11e..d8189e8a73d2faa45c0fc7d6c91f0455732549a4 100644 (file)
@@ -119,7 +119,7 @@ int list_trash_image_specs(
   uint32_t max_read = 1024;
   std::string last_read;
   do {
-    std::map<string, cls::rbd::TrashImageSpec> trash_entries;
+    std::map<std::string, cls::rbd::TrashImageSpec> trash_entries;
     int r = cls_client::trash_list(&io_ctx, last_read, max_read,
                                    &trash_entries);
     if (r < 0 && r != -ENOENT) {
@@ -347,7 +347,7 @@ int Trash<I>::get(IoCtx &io_ctx, const std::string &id,
 }
 
 template <typename I>
-int Trash<I>::list(IoCtx &io_ctx, vector<trash_image_info_t> &entries,
+int Trash<I>::list(IoCtx &io_ctx, std::vector<trash_image_info_t> &entries,
                    bool exclude_user_remove_source) {
   CephContext *cct((CephContext *)io_ctx.cct());
   ldout(cct, 20) << __func__ << " " << &io_ctx << dendl;
index 9f3d5c8953e21459f503c7861d7876868c30ef07..8c0aaa7bcda59cd4ccf85282837213358755d252 100644 (file)
@@ -32,6 +32,8 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "librbd::cache::ObjectCacherWriteback: "
 
+using namespace std;
+
 namespace librbd {
 namespace cache {
 
index 5953dceca01896093af163a823b5ab1b2464a98c..d42a3b88bff63a52b5051c3dc0a4f9504ad4946d 100644 (file)
@@ -20,6 +20,7 @@
 #define dout_prefix *_dout << "librbd::cache::ParentCacheObjectDispatch: " \
                            << this << " " << __func__ << ": "
 
+using namespace std;
 using namespace ceph::immutable_obj_cache;
 using librbd::util::data_object_name;
 
index ab69c073238932b5573206c573f3246b667c5714..8ad905ad2f7bcfd6688c07cac17b0532c4e1d005 100644 (file)
@@ -31,6 +31,7 @@ namespace librbd {
 namespace cache {
 namespace pwl {
 
+using namespace std;
 using namespace librbd::cache::pwl;
 
 typedef AbstractWriteLog<ImageCtx>::Extent Extent;
index 11074befb57da642198b7055422e5c0a0dbf4e8b..65de7b70f4e0e671ef5aa98aa0c461f8429c5994 100644 (file)
@@ -22,6 +22,8 @@ namespace librbd {
 namespace cache {
 namespace pwl {
 
+using namespace std;
+
 namespace {
 bool get_json_format(const std::string& s, JSONFormattable *f) {
   JSONParser p;
index 54da5a2e002d65212020cfedd642dbf74cba53c8..ee90df41baaee2e5637bea3d50e497c986c713b7 100644 (file)
@@ -205,7 +205,7 @@ void WriteLogOperation::init(bool has_data, std::vector<WriteBufferAllocation>::
 }
 
 std::ostream &WriteLogOperation::format(std::ostream &os) const {
-  string op_name = is_writesame ? "(Write Same) " : "(Write) ";
+  std::string op_name = is_writesame ? "(Write Same) " : "(Write) ";
   os << op_name;
   GenericWriteLogOperation::format(os);
   os << ", ";
index 5288af9d01ae4e64e95e3b117dd12b008708a556..4770e498fba543962eac75960317b94b8f9035eb 100644 (file)
@@ -11,6 +11,8 @@
 #define dout_prefix *_dout << "librbd::cache::pwl::Request: " << this << " " \
                            <<  __func__ << ": "
 
+using namespace std;
+
 namespace librbd {
 namespace cache {
 namespace pwl {
index 8d5a0b4742a722d55ac56d8dbaaa592c8dc49290..86dd0f880ad18ace1c88ad702a9cc248dcfdd33e 100644 (file)
@@ -136,7 +136,7 @@ public:
   bufferlist cmp_bl;
   bufferlist read_bl;
   bool is_comp_and_write = false;
-  unique_ptr<WriteLogOperationSet> op_set = nullptr;
+  std::unique_ptr<WriteLogOperationSet> op_set = nullptr;
 
   C_WriteRequest(T &pwl, const utime_t arrived, io::Extents &&image_extents,
                  bufferlist&& bl, const int fadvise_flags, ceph::mutex &lock,
index 827125c31f8ff005fa494bf86ca15e0dac70a64d..c218c5773ea7b63f3984ddabd50eebe3d694922c 100644 (file)
@@ -70,7 +70,7 @@ void WriteLogCacheEntry::dump(Formatter *f) const {
   f->dump_unsigned("entry_index", entry_index);
 }
 
-void WriteLogCacheEntry::generate_test_instances(list<WriteLogCacheEntry*>& ls) {
+void WriteLogCacheEntry::generate_test_instances(std::list<WriteLogCacheEntry*>& ls) {
   ls.push_back(new WriteLogCacheEntry);
   ls.push_back(new WriteLogCacheEntry);
   ls.back()->sync_gen_number = 1;
@@ -98,7 +98,7 @@ void WriteLogPoolRoot::dump(Formatter *f) const {
   f->dump_unsigned("first_free_entry", first_free_entry);
   f->dump_unsigned("first_valid_entry", first_valid_entry); }
 
-void WriteLogPoolRoot::generate_test_instances(list<WriteLogPoolRoot*>& ls) {
+void WriteLogPoolRoot::generate_test_instances(std::list<WriteLogPoolRoot*>& ls) {
   ls.push_back(new WriteLogPoolRoot);
   ls.push_back(new WriteLogPoolRoot);
   ls.back()->layout_version = 2;
index 530c6df9ef758ebafd108181dce15f3136d1a2ce..c62096a84576c02c7d4836781c44c26c8d03f243 100644 (file)
@@ -274,7 +274,7 @@ struct WriteLogCacheEntry {
   }
   #endif
   void dump(ceph::Formatter *f) const;
-  static void generate_test_instances(list<WriteLogCacheEntry*>& ls);
+  static void generate_test_instances(std::list<WriteLogCacheEntry*>& ls);
 };
 
 struct WriteLogPoolRoot {
@@ -315,7 +315,7 @@ struct WriteLogPoolRoot {
   #endif
 
   void dump(ceph::Formatter *f) const;
-  static void generate_test_instances(list<WriteLogPoolRoot*>& ls);
+  static void generate_test_instances(std::list<WriteLogPoolRoot*>& ls);
 };
 
 struct WriteBufferAllocation {
index a725d05f092a25b61bf5914b0732e7c782cd8307..dcb036693e5ed915c09c66f6b7452f11c38c042c 100644 (file)
@@ -29,6 +29,7 @@
 namespace librbd {
 namespace cache {
 namespace pwl {
+using namespace std;
 using namespace librbd::cache::pwl;
 namespace rwl {
 
index e34b7516684c4b3296317ce16f063ba1112df2bd..fe82dee9edf770a46443e083f000cf5a7cc08563 100644 (file)
@@ -27,7 +27,7 @@ struct SuperBlock{
     f->dump_object("super", root);
   }
 
-  static void generate_test_instances(list<SuperBlock*>& ls) {
+  static void generate_test_instances(std::list<SuperBlock*>& ls) {
     ls.push_back(new SuperBlock);
     ls.push_back(new SuperBlock);
     ls.back()->root.first_valid_entry = 2;
index efe482287fa0dd81d80b12d0a523978aa05078e0..8258a3de8ef6f670a8a3f8f9ddd725219f6608a8 100644 (file)
@@ -30,6 +30,7 @@ namespace cache {
 namespace pwl {
 namespace ssd {
 
+using namespace std;
 using namespace librbd::cache::pwl;
 
 // SSD: this number can be updated later
@@ -76,7 +77,7 @@ void WriteLog<I>::collect_read_extents(
   // Make a bl for this hit extent. This will add references to the
   // write_entry->cache_bl */
   ldout(m_image_ctx.cct, 5) << dendl;
-  auto write_entry = static_pointer_cast<WriteLogEntry>(map_entry.log_entry);
+  auto write_entry = std::static_pointer_cast<WriteLogEntry>(map_entry.log_entry);
   buffer::list hit_bl;
   hit_bl = write_entry->get_cache_bl();
   bool writesame = write_entry->is_writesame_entry();
index 3d7c905a2c020027490b55904918c9f4b18c970a..dd0ab2fff8f0adb66ce49fc9e74f3e8ebd380e81 100644 (file)
@@ -432,7 +432,7 @@ void CreateRequest<I>::create_image() {
   ldout(m_cct, 15) << dendl;
   ceph_assert(m_data_pool.empty() || m_data_pool_id != -1);
 
-  ostringstream oss;
+  std::ostringstream oss;
   oss << RBD_DATA_PREFIX;
   if (m_data_pool_id != -1) {
     oss << stringify(m_io_ctx.get_id()) << ".";
index db780956b561911c3f5f584a2ef139287008c97c..dba15bdf23a18d091af2235392debeebf3a8e1e6 100644 (file)
@@ -68,6 +68,7 @@
 
 #define rbd_howmany(x, y)  (((x) + (y) - 1) / (y))
 
+using std::istringstream;
 using std::map;
 using std::pair;
 using std::set;
@@ -1325,7 +1326,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
         }
       }
 
-      uint64_t len = min(period, src_size - offset);
+      uint64_t len = std::min(period, src_size - offset);
       bufferlist *bl = new bufferlist();
       auto ctx = new C_CopyRead(&throttle, dest, offset, bl, sparse_size);
       auto comp = io::AioCompletion::create_and_start<Context>(
@@ -1536,7 +1537,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     start_time = coarse_mono_clock::now();
     while (left > 0) {
       uint64_t period_off = off - (off % period);
-      uint64_t read_len = min(period_off + period - off, left);
+      uint64_t read_len = std::min(period_off + period - off, left);
 
       bufferlist bl;
 
index 9bd03228a54ebade4065daba05b893fa854a3b8d..2b2400b8c8cfe5c26059d78105063f823f97afab 100644 (file)
@@ -132,7 +132,8 @@ namespace librbd {
 
   int invalidate_cache(ImageCtx *ictx);
   int poll_io_events(ImageCtx *ictx, io::AioCompletion **comps, int numcomp);
-  int metadata_list(ImageCtx *ictx, const string &last, uint64_t max, map<string, bufferlist> *pairs);
+  int metadata_list(ImageCtx *ictx, const std::string &last, uint64_t max,
+                   std::map<std::string, bufferlist> *pairs);
   int metadata_get(ImageCtx *ictx, const std::string &key, std::string *value);
 
   int list_watchers(ImageCtx *ictx, std::list<librbd::image_watcher_t> &watchers);
index 324c670fe1fb44841ea4c2df1464db102250908b..ba7b37049851151778de42cc5a7b7bfa14526f58 100644 (file)
@@ -56,10 +56,10 @@ QosImageDispatch<I>::QosImageDispatch(I* image_ctx)
   SafeTimer *timer;
   ceph::mutex *timer_lock;
   ImageCtx::get_timer_instance(cct, &timer, &timer_lock);
-  for (auto flag : throttle_flags) {
-    m_throttles.push_back(make_pair(
-      flag.first,
-      new TokenBucketThrottle(cct, flag.second, 0, 0, timer, timer_lock)));
+  for (auto [flag, name] : throttle_flags) {
+    m_throttles.emplace_back(
+      flag,
+      new TokenBucketThrottle(cct, name, 0, 0, timer, timer_lock));
   }
 }
 
index ae5681ade0677b31f5c19bef9616ab9b63f5ca58..d57858a159005886236ac1392ac8799151d738f5 100644 (file)
@@ -372,12 +372,12 @@ struct UpdateFeaturesEvent : public OpEventBase {
 struct MetadataSetEvent : public OpEventBase {
   static const EventType TYPE = EVENT_TYPE_METADATA_SET;
 
-  string key;
-  string value;
+  std::string key;
+  std::string value;
 
   MetadataSetEvent() {
   }
-  MetadataSetEvent(uint64_t op_tid, const string &_key, const string &_value)
+  MetadataSetEvent(uint64_t op_tid, const std::string &_key, const std::string &_value)
     : OpEventBase(op_tid), key(_key), value(_value) {
   }
 
@@ -389,11 +389,11 @@ struct MetadataSetEvent : public OpEventBase {
 struct MetadataRemoveEvent : public OpEventBase {
   static const EventType TYPE = EVENT_TYPE_METADATA_REMOVE;
 
-  string key;
+  std::string key;
 
   MetadataRemoveEvent() {
   }
-  MetadataRemoveEvent(uint64_t op_tid, const string &_key)
+  MetadataRemoveEvent(uint64_t op_tid, const std::string &_key)
     : OpEventBase(op_tid), key(_key) {
   }
 
index a803b7db7f25e108d1b7222d04c2a922fae07b5c..4557b2c7558ed2b56cbadf0b682ff31ea0d99f22 100644 (file)
 #undef dout_prefix
 #define dout_prefix *_dout << "librbd: "
 
+using std::list;
+using std::map;
+using std::pair;
+using std::set;
 using std::string;
 using std::vector;
 
index 598ececab0518807f9599447b22769c7af91708f..6707a149f4fc6e838728c433985e0125bb0cda8f 100644 (file)
@@ -16,6 +16,8 @@
 #define dout_prefix *_dout << "librbd::managed_lock::ReleaseRequest: " \
                             << this << " " << __func__ << ": "
 
+using std::string;
+
 namespace librbd {
 namespace managed_lock {
 
index b78be8a0af6bb4fb403d52a9139ea31d263d5ca3..cc975d176350c340a3d56d94e397b7975d254495 100644 (file)
@@ -481,7 +481,7 @@ int SnapshotRemoveRequest<I>::scan_for_parents(
   ceph_assert(ceph_mutex_is_locked(image_ctx.image_lock));
 
   if (pspec.pool_id != -1) {
-    map<uint64_t, SnapInfo>::iterator it;
+    std::map<uint64_t, SnapInfo>::iterator it;
     for (it = image_ctx.snap_info.begin();
          it != image_ctx.snap_info.end(); ++it) {
       // skip our snap id (if checking base image, CEPH_NOSNAP won't match)
index b8ecf10acf1c1576538269c55e1123bde12d4965..6fda48aa769f4e99d5855ede2840227a69187eb1 100644 (file)
@@ -42,7 +42,7 @@ public:
     ceph_assert(image_ctx.exclusive_lock == nullptr ||
                 image_ctx.exclusive_lock->is_lock_owner());
 
-    string oid = image_ctx.get_object_name(m_object_no);
+    std::string oid = image_ctx.get_object_name(m_object_no);
     ldout(image_ctx.cct, 10) << "removing (with copyup) " << oid << dendl;
 
     auto object_dispatch_spec = io::ObjectDispatchSpec::create_discard(
@@ -80,7 +80,7 @@ public:
       }
     }
 
-    string oid = image_ctx.get_object_name(m_object_no);
+    std::string oid = image_ctx.get_object_name(m_object_no);
     ldout(image_ctx.cct, 10) << "removing " << oid << dendl;
 
     librados::AioCompletion *rados_completion =
@@ -343,19 +343,18 @@ void TrimRequest<I>::send_clean_boundary() {
 
   ContextCompletion *completion =
     new ContextCompletion(this->create_async_callback_context(), true);
-  for (vector<ObjectExtent>::iterator p = extents.begin();
-       p != extents.end(); ++p) {
-    ldout(cct, 20) << " ex " << *p << dendl;
+  for (auto& extent : extents) {
+    ldout(cct, 20) << " ex " << extent << dendl;
     Context *req_comp = new C_ContextCompletion(*completion);
 
-    if (p->offset == 0) {
+    if (extent.offset == 0) {
       // treat as a full object delete on the boundary
-      p->length = image_ctx.layout.object_size;
+      extent.length = image_ctx.layout.object_size;
     }
 
     auto object_dispatch_spec = io::ObjectDispatchSpec::create_discard(
-      &image_ctx, io::OBJECT_DISPATCH_LAYER_NONE, p->objectno, p->offset,
-      p->length, io_context, 0, 0, {}, req_comp);
+      &image_ctx, io::OBJECT_DISPATCH_LAYER_NONE, extent.objectno, extent.offset,
+      extent.length, io_context, 0, 0, {}, req_comp);
     object_dispatch_spec->send();
   }
   completion->finish_adding_requests();