summaryrefslogtreecommitdiff
path: root/repo/ceph/32-PurgeQueue.cc-cast.patch
blob: 19a0719c4adf3ca9d33a2f0ae40a0319058319ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Submitted as: https://github.com/ceph/ceph/pull/41235

commit 953e7dc0f911f84a4bb377aee45b22e2ffad6867
Author: Duncan Bellamy <dunk@denkimushi.com>
Date:   Sat May 8 11:52:35 2021 +0100

    mds: PurgeQueue.cc add static cast for 32bit compilation
    
    files_high_water is defined as uint64_t but when compiling on 32bit these max functions
    fail as they are both not considered uint64_t by gcc 10 even though they are
    
      files_high_water = std::max(files_high_water,
                                   static_cast<uint64_t>(in_flight.size()));
    
    Fixes: https://tracker.ceph.com/issues/50707
    
    Signed-off-by: Duncan Bellamy <dunk@denkimushi.com>

diff --git a/src/mds/PurgeQueue.cc b/src/mds/PurgeQueue.cc
index 977be2c118..3104a3ccc4 100644
--- a/src/mds/PurgeQueue.cc
+++ b/src/mds/PurgeQueue.cc
@@ -7,9 +7,9 @@
  *
  * This is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
+ * License version 2.1, as published by the Free Software
  * Foundation.  See file COPYING.
- * 
+ *
  */
 
 #include "common/debug.h"
@@ -594,8 +594,8 @@ void PurgeQueue::_execute_item(
 
   in_flight[expire_to] = item;
   logger->set(l_pq_executing, in_flight.size());
-  files_high_water = std::max(files_high_water,
-                              static_cast<uint64_t>(in_flight.size()));
+  files_high_water = std::max<uint64_t>(files_high_water,
+                              in_flight.size());
   logger->set(l_pq_executing_high_water, files_high_water);
   auto ops = _calculate_ops(item);
   ops_in_flight += ops;
@@ -662,8 +662,8 @@ void PurgeQueue::_execute_item(
     logger->set(l_pq_executing_ops_high_water, ops_high_water);
     in_flight.erase(expire_to);
     logger->set(l_pq_executing, in_flight.size());
-    files_high_water = std::max(files_high_water,
-                                static_cast<uint64_t>(in_flight.size()));
+    files_high_water = std::max<uint64_t>(files_high_water,
+                                in_flight.size());
     logger->set(l_pq_executing_high_water, files_high_water);
     return;
   }
@@ -716,19 +716,19 @@ void PurgeQueue::_execute_item_complete(
 
   in_flight.erase(iter);
   logger->set(l_pq_executing, in_flight.size());
-  files_high_water = std::max(files_high_water,
-                              static_cast<uint64_t>(in_flight.size()));
+  files_high_water = std::max<uint64_t>(files_high_water,
+                              in_flight.size());
   logger->set(l_pq_executing_high_water, files_high_water);
   dout(10) << "in_flight.size() now " << in_flight.size() << dendl;
 
-  uint64_t write_pos = journaler.get_write_pos(); 
-  uint64_t read_pos = journaler.get_read_pos(); 
-  uint64_t expire_pos = journaler.get_expire_pos(); 
-  uint64_t item_num = (write_pos - (in_flight.size() ? expire_pos : read_pos)) 
+  uint64_t write_pos = journaler.get_write_pos();
+  uint64_t read_pos = journaler.get_read_pos();
+  uint64_t expire_pos = journaler.get_expire_pos();
+  uint64_t item_num = (write_pos - (in_flight.size() ? expire_pos : read_pos))
 		      / purge_item_journal_size;
-  dout(10) << "left purge items in journal: " << item_num 
-    << " (purge_item_journal_size/write_pos/read_pos/expire_pos) now at " 
-    << "(" << purge_item_journal_size << "/" << write_pos << "/" << read_pos 
+  dout(10) << "left purge items in journal: " << item_num
+    << " (purge_item_journal_size/write_pos/read_pos/expire_pos) now at "
+    << "(" << purge_item_journal_size << "/" << write_pos << "/" << read_pos
     << "/" << expire_pos << ")" << dendl;
 
   logger->set(l_pq_item_in_journal, item_num);