]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephfs: Switch MIN/MAX for std::min/max and use intarith templates
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 11 Jan 2018 03:24:17 +0000 (22:24 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Sat, 13 Jan 2018 19:05:16 +0000 (14:05 -0500)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/client/Client.cc
src/client/SyntheticClient.cc
src/tools/cephfs/Dumper.cc
src/tools/cephfs/Resetter.cc

index 1ef925903bbd69ad526ea245d7c1c43202e9fdb4..41c53caeded97aed1e52a67e9ccf257a87087d9c 100644 (file)
@@ -7110,7 +7110,7 @@ int Client::fill_stat(Inode *in, struct stat *st, frag_info_t *dirstat, nest_inf
     st->st_size = in->size;
     st->st_blocks = (in->size + 511) >> 9;
   }
-  st->st_blksize = MAX(in->layout.stripe_unit, 4096);
+  st->st_blksize = std::max<uint32_t>(in->layout.stripe_unit, 4096);
 
   if (dirstat)
     *dirstat = in->dirstat;
@@ -7136,7 +7136,7 @@ void Client::fill_statx(Inode *in, unsigned int mask, struct ceph_statx *stx)
 
   /* These are always considered to be available */
   stx->stx_dev = in->snapid;
-  stx->stx_blksize = MAX(in->layout.stripe_unit, 4096);
+  stx->stx_blksize = std::max<uint32_t>(in->layout.stripe_unit, 4096);
 
   /* Type bits are always set, even when CEPH_STATX_MODE is not */
   stx->stx_mode = S_IFMT & in->mode;
@@ -8351,10 +8351,10 @@ Fh *Client::_create_fh(Inode *in, int flags, int cmode, const UserPerm& perms)
   f->readahead.set_min_readahead_size(conf->client_readahead_min);
   uint64_t max_readahead = Readahead::NO_LIMIT;
   if (conf->client_readahead_max_bytes) {
-    max_readahead = MIN(max_readahead, (uint64_t)conf->client_readahead_max_bytes);
+    max_readahead = std::min(max_readahead, (uint64_t)conf->client_readahead_max_bytes);
   }
   if (conf->client_readahead_max_periods) {
-    max_readahead = MIN(max_readahead, in->layout.get_period()*(uint64_t)conf->client_readahead_max_periods);
+    max_readahead = std::min(max_readahead, in->layout.get_period()*(uint64_t)conf->client_readahead_max_periods);
   }
   f->readahead.set_max_readahead_size(max_readahead);
   vector<uint64_t> alignments;
index 89f8498d88885e0306a754d99bf8e31bb2fbe96e..a610f1aebd8749a1d17cf632e4f1d354d36c04c4 100644 (file)
@@ -3366,13 +3366,13 @@ int SyntheticClient::chunk_file(string &filename)
   uint64_t pos = 0;
   bufferlist from_before;
   while (pos < size) {
-    int get = MIN(size-pos, 1048576);
+    int get = std::min<int>(size - pos, 1048576);
 
     Mutex flock("synclient chunk_file lock");
     Cond cond;
     bool done;
     bufferlist bl;
-    
+
     flock.Lock();
     Context *onfinish = new C_SafeCond(&flock, &cond, &done);
     client->filer->read(inode.ino, &inode.layout, CEPH_NOSNAP, pos, get, &bl, 0,
index 2bc379b94f88a10e59fda743e62bdd28ff607fec..22ef544a8f364cdc78b30ba8fcd6ec429214b46d 100644 (file)
@@ -135,7 +135,7 @@ int Dumper::dump(const char *dump_file)
       bufferlist bl;
       dout(10) << "Reading at pos=0x" << std::hex << pos << std::dec << dendl;
 
-      const uint32_t read_size = MIN(chunk_size, end - pos);
+      const uint32_t read_size = std::min<uint64_t>(chunk_size, end - pos);
 
       C_SaferCond cond;
       lock.Lock();
@@ -298,7 +298,7 @@ int Dumper::undump(const char *dump_file)
     // Read
     bufferlist j;
     lseek64(fd, pos, SEEK_SET);
-    uint64_t l = MIN(left, 1024*1024);
+    uint64_t l = std::min<uint64_t>(left, 1024*1024);
     j.read_fd(fd, l);
 
     // Write
index 58465c2ffc79ed3458afe2d90a5cf1f58ddee8cf..32ada622982cacb4f436d634883bd531974495b1 100644 (file)
@@ -78,7 +78,7 @@ int Resetter::reset(mds_role_t role)
   uint64_t old_len = old_end - old_start;
   cout << "old journal was " << old_start << "~" << old_len << std::endl;
 
-  uint64_t new_start = ROUND_UP_TO(old_end+1, journaler.get_layout_period());
+  uint64_t new_start = round_up_to(old_end+1, journaler.get_layout_period());
   cout << "new journal start will be " << new_start
        << " (" << (new_start - old_end) << " bytes past old end)" << std::endl;