os: FileStore, Using stl min | max, MIN | MAX macros instead

Signed-off-by: Shinobu Kinjo <shinobu@redhat.com>
This commit is contained in:
Shinobu Kinjo 2018-01-08 14:14:38 +09:00
parent 158f3173de
commit b338154b15
3 changed files with 8 additions and 8 deletions

View 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));
}
}

View 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;

View 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;