]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/Server.cc: replace inefficient string::find() w/ compare()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 17 Feb 2016 11:22:28 +0000 (12:22 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 19 Feb 2016 11:50:35 +0000 (12:50 +0100)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mds/Server.cc

index b9f5b0c361a05a5a5ce529e69d7c8a32f3270379..ecd45a321aeb0b33f3f5dcea6eb0cc972a65387d 100644 (file)
@@ -4316,7 +4316,7 @@ void Server::handle_client_setxattr(MDRequestRef& mdr)
   CInode *cur;
 
   ceph_file_layout *dir_layout = NULL;
-  if (name.find("ceph.dir.layout") == 0)
+  if (name.compare(0, 15, "ceph.dir.layout") == 0)
     cur = rdlock_path_pin_ref(mdr, 0, rdlocks, true, false, &dir_layout);
   else
     cur = rdlock_path_pin_ref(mdr, 0, rdlocks, true);
@@ -4331,7 +4331,7 @@ void Server::handle_client_setxattr(MDRequestRef& mdr)
   int flags = req->head.args.setxattr.flags;
 
   // magic ceph.* namespace?
-  if (name.find("ceph.") == 0) {
+  if (name.compare(0, 5, "ceph.") == 0) {
     handle_set_vxattr(mdr, cur, dir_layout, rdlocks, wrlocks, xlocks);
     return;
   }
@@ -4401,7 +4401,7 @@ void Server::handle_client_removexattr(MDRequestRef& mdr)
     return;
   }
 
-  if (name.find("ceph.") == 0) {
+  if (name.compare(0, 5, "ceph.") == 0) {
     handle_remove_vxattr(mdr, cur, rdlocks, wrlocks, xlocks);
     return;
   }