]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: FileStore, Using stl min | max, MIN | MAX macros instead 19832/head
authorShinobu Kinjo <shinobu@redhat.com>
Mon, 8 Jan 2018 05:14:38 +0000 (14:14 +0900)
committerShinobu Kinjo <shinobu@redhat.com>
Mon, 8 Jan 2018 05:14:38 +0000 (14:14 +0900)
Signed-off-by: Shinobu Kinjo <shinobu@redhat.com>
src/os/filestore/FDCache.h
src/os/filestore/FileJournal.cc
src/os/filestore/FileStore.cc

index 8e037ac78a12604dc6cfb4c6692d63d85ee789ff..723cc722f4b9d797091e7ad2334f23c807c3e612 100644 (file)
@@ -56,14 +56,14 @@ private:
 
 public:
   explicit FDCache(CephContext *cct) : cct(cct),
-  registry_shards(MAX(cct->_conf->filestore_fd_cache_shards, 1)) {
+  registry_shards(std::max<int64_t>(cct->_conf->filestore_fd_cache_shards, 1)) {
     assert(cct);
     cct->_conf->add_observer(this);
     registry = new SharedLRU<ghobject_t, FD>[registry_shards];
     for (int i = 0; i < registry_shards; ++i) {
       registry[i].set_cct(cct);
       registry[i].set_size(
-          MAX((cct->_conf->filestore_fd_cache_size / registry_shards), 1));
+          std::max<int64_t>((cct->_conf->filestore_fd_cache_size / registry_shards), 1));
     }
   }
   ~FDCache() override {
@@ -101,7 +101,7 @@ public:
     if (changed.count("filestore_fd_cache_size")) {
       for (int i = 0; i < registry_shards; ++i)
         registry[i].set_size(
-              MAX((conf->filestore_fd_cache_size / registry_shards), 1));
+              std::max<int64_t>((conf->filestore_fd_cache_size / registry_shards), 1));
     }
   }
 
index 1b8c1bd63d9eefd2441d97ea2796299528385c9b..abd48c1b26b5057ad49b46562b594c9b3217953c 100644 (file)
@@ -1228,7 +1228,7 @@ void FileJournal::write_thread_entry()
       // flight if we hit this limit to ensure we keep the device
       // saturated.
       while (aio_num > 0) {
-       int exp = MIN(aio_num * 2, 24);
+       int exp = std::min<int>(aio_num * 2, 24);
        long unsigned min_new = 1ull << exp;
        uint64_t cur = aio_write_queue_bytes;
        dout(20) << "write_thread_entry aio throttle: aio num " << aio_num << " bytes " << aio_bytes
@@ -1380,7 +1380,7 @@ int FileJournal::write_aio_bl(off64_t& pos, bufferlist& bl, uint64_t seq)
   dout(20) << "write_aio_bl " << pos << "~" << bl.length() << " seq " << seq << dendl;
 
   while (bl.length() > 0) {
-    int max = MIN(bl.get_num_buffers(), IOV_MAX-1);
+    int max = std::min<int>(bl.get_num_buffers(), IOV_MAX-1);
     iovec *iov = new iovec[max];
     int n = 0;
     unsigned len = 0;
index 2320eb770b513100cb0d7b66b3b0c066a084aec1..8e9ed56d660ed78c2cec3e5d6631857df73caade 100644 (file)
@@ -3810,7 +3810,7 @@ int FileStore::_do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, u
 
     loff_t dstpos = dstoff;
     while (pos < end) {
-      int l = MIN(end-pos, buflen);
+      int l = std::min<int>(end-pos, buflen);
       r = safe_splice(from, &pos, pipefd[1], nullptr, l, SPLICE_F_NONBLOCK);
       dout(10) << "  safe_splice read from " << pos << "~" << l << " got " << r << dendl;
       if (r < 0) {
@@ -3863,7 +3863,7 @@ int FileStore::_do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, u
 
     char buf[buflen];
     while (pos < end) {
-      int l = MIN(end-pos, buflen);
+      int l = std::min<int>(end-pos, buflen);
       r = ::read(from, buf, l);
       dout(25) << "  read from " << pos << "~" << l << " got " << r << dendl;
       if (r < 0) {
@@ -5724,7 +5724,7 @@ int FileStore::_set_alloc_hint(const coll_t& cid, const ghobject_t& oid,
 
   {
     // TODO: a more elaborate hint calculation
-    uint64_t hint = MIN(expected_write_size, m_filestore_max_alloc_hint_size);
+    uint64_t hint = std::min<uint64_t>(expected_write_size, m_filestore_max_alloc_hint_size);
 
     ret = backend->set_alloc_hint(**fd, hint);
     dout(20) << __FUNC__ << ": hint " << hint << " ret " << ret << dendl;