1
0
mirror of https://github.com/ceph/ceph synced 2025-03-30 23:40:09 +00:00

Merge PR into master

* refs/pull/19911/head:
	cephfs: Switch MIN/MAX for std::min/max and use intarith templates

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2018-01-16 20:06:12 -08:00
commit 4412c6b541
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
4 changed files with 9 additions and 9 deletions

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

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

View 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

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