]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Striper: specialize std::min<>
authorKefu Chai <kchai@redhat.com>
Tue, 25 Jun 2019 06:50:47 +0000 (14:50 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Jul 2019 06:03:51 +0000 (14:03 +0800)
on armhf, `unsigned int` is 32bit, and `size_t` is defined as `unsigned
int`, so `std::min(a_size_t, a_uint32_t)` is not able to deduce the
template parameter, so we need to either use a single type or specialize
this template.

because `actual` will eventually used as a parameter of
`buffer::list::splice(unsigned, unsigned, buffer::list)`, it's at least
not worse to use `std::min<size_t>()` on a 32-bit system. on a LP64
system, `actual` will be casted to `unsigned` when calling
`bl.splice()` with or without this change.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osdc/Striper.cc

index 5c5b4cb7d72e90d93cc15fb85fc1e2e526a761da..e8232f125c1dc751415cd588300675eee079c5ea 100644 (file)
@@ -406,7 +406,7 @@ void Striper::StripedReadResult::add_partial_sparse_result(
 
     ceph_assert(s->first <= *bl_off);
     size_t left = (s->first + s->second) - *bl_off;
-    size_t actual = std::min(left, tlen);
+    size_t actual = std::min<size_t>(left, tlen);
 
     if (actual > 0) {
       ldout(cct, 20) << "  s has " << actual << ", copying" << dendl;