]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use set for zonegroup placement target tags
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 29 Nov 2016 22:05:27 +0000 (14:05 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 29 Nov 2016 22:05:27 +0000 (14:05 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.h

index 6d7525fb0ab835bbc21d9a5319ef9e6000eb9edb..3d44e8673c369a35e5943f4710bb54e286122792 100644 (file)
@@ -1179,18 +1179,15 @@ WRITE_CLASS_ENCODER(RGWDefaultZoneGroupInfo)
 
 struct RGWZoneGroupPlacementTarget {
   string name;
-  list<string> tags;
+  set<string> tags;
 
   bool user_permitted(list<string>& user_tags) {
     if (tags.empty()) {
       return true;
     }
-    for (list<string>::iterator uiter = user_tags.begin(); uiter != user_tags.end(); ++uiter) { /* we don't expect many of either, so we can handle this kind of lookup */
-      string& rule = *uiter;
-      for (list<string>::iterator iter = tags.begin(); iter != tags.end(); ++iter) {
-        if (rule == *iter) {
-          return true;
-        }
+    for (auto& rule : user_tags) {
+      if (tags.find(rule) != tags.end()) {
+        return true;
       }
     }
     return false;