]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter: fold last_force_resend into op_target_t
authorSamuel Just <sjust@redhat.com>
Tue, 10 Jan 2017 02:08:53 +0000 (18:08 -0800)
committerSamuel Just <sjust@redhat.com>
Thu, 12 Jan 2017 20:44:59 +0000 (12:44 -0800)
It's always passed along with op_target_t, this seems simpler.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 410c6646995af03054039449faa7e27696b178bf..7b9b6907f7ee8286c9e71a6414b3d9935d4b1a94 100644 (file)
@@ -860,7 +860,7 @@ void Objecter::_linger_submit(LingerOp *info, shunique_lock& sul)
 
   // Populate Op::target
   OSDSession *s = NULL;
-  _calc_target(&info->target, &info->last_force_resend);
+  _calc_target(&info->target);
 
   // Create LingerOp<->OSDSession relation
   int r = _get_session(info->target.osd, &s, sul);
@@ -1068,7 +1068,7 @@ void Objecter::_scan_requests(OSDSession *s,
     if (pool_full_map)
       force_resend_writes = force_resend_writes ||
        (*pool_full_map)[op->target.base_oloc.pool];
-    int r = _calc_target(&op->target, &op->last_force_resend);
+    int r = _calc_target(&op->target);
     switch (r) {
     case RECALC_OP_TARGET_NO_ACTION:
       if (!force_resend &&
@@ -1296,7 +1296,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
        p != need_resend_linger.end(); ++p) {
     LingerOp *op = *p;
     if (!op->session) {
-      _calc_target(&op->target, &op->last_force_resend);
+      _calc_target(&op->target);
       OSDSession *s = NULL;
       int const r = _get_session(op->target.osd, &s, sul);
       assert(r == 0);
@@ -2296,7 +2296,7 @@ void Objecter::_op_submit(Op *op, shunique_lock& sul, ceph_tid_t *ptid)
   assert(op->session == NULL);
   OSDSession *s = NULL;
 
-  bool check_for_latest_map = _calc_target(&op->target, &op->last_force_resend)
+  bool check_for_latest_map = _calc_target(&op->target)
     == RECALC_OP_TARGET_POOL_DNE;
 
   // Try to get a session, including a retry if we need to take write lock
@@ -2313,7 +2313,7 @@ void Objecter::_op_submit(Op *op, shunique_lock& sul, ceph_tid_t *ptid)
       // map changed; recalculate mapping
       ldout(cct, 10) << __func__ << " relock raced with osdmap, recalc target"
                     << dendl;
-      check_for_latest_map = _calc_target(&op->target, &op->last_force_resend)
+      check_for_latest_map = _calc_target(&op->target)
        == RECALC_OP_TARGET_POOL_DNE;
       if (s) {
        put_session(s);
@@ -2670,8 +2670,7 @@ int64_t Objecter::get_object_pg_hash_position(int64_t pool, const string& key,
   return p->raw_hash_to_pg(p->hash_key(key, ns));
 }
 
-int Objecter::_calc_target(op_target_t *t, epoch_t *last_force_resend,
-                          bool any_change)
+int Objecter::_calc_target(op_target_t *t, bool any_change)
 {
   // rwlock is locked
 
@@ -2687,11 +2686,12 @@ int Objecter::_calc_target(op_target_t *t, epoch_t *last_force_resend,
   bool force_resend = false;
   bool need_check_tiering = false;
   if (osdmap->get_epoch() == pi->last_force_op_resend) {
-    if (last_force_resend && *last_force_resend < pi->last_force_op_resend) {
-      *last_force_resend = pi->last_force_op_resend;
+    if (t->last_force_resend < pi->last_force_op_resend) {
+      t->last_force_resend = pi->last_force_op_resend;
       force_resend = true;
-    } else if (last_force_resend == 0)
+    } else if (t->last_force_resend == 0) {
       force_resend = true;
+    }
   }
   if (t->target_oid.name.empty() || force_resend) {
     t->target_oid = t->base_oid;
@@ -2954,7 +2954,7 @@ int Objecter::_recalc_linger_op_target(LingerOp *linger_op,
 {
   // rwlock is locked unique
 
-  int r = _calc_target(&linger_op->target, &linger_op->last_force_resend,
+  int r = _calc_target(&linger_op->target,
                       true);
   if (r == RECALC_OP_TARGET_NEED_RESEND) {
     ldout(cct, 10) << "recalc_linger_op_target tid " << linger_op->linger_id
index 984fb8959fa996584b4b860d0b1feb264d17c29b..f85bbc4206ea01602fa97a7e919ee930563a8558 100644 (file)
@@ -1190,6 +1190,7 @@ public:
     bool used_replica;
     bool paused;
 
+    epoch_t last_force_resend = 0;
     int osd;      ///< the final target osd, or -1
 
     op_target_t(object_t oid, object_locator_t oloc, int flags)
@@ -1261,8 +1262,6 @@ public:
 
     int *data_offset;
 
-    epoch_t last_force_resend;
-
     osd_reqid_t reqid; // explicitly setting reqid
 
     Op(const object_t& o, const object_locator_t& ol, vector<OSDOp>& op,
@@ -1286,8 +1285,7 @@ public:
       budgeted(false),
       should_resend(true),
       ctx_budgeted(false),
-      data_offset(offset),
-      last_force_resend(0) {
+      data_offset(offset) {
       ops.swap(op);
 
       /* initialize out_* to match op vector */
@@ -1640,8 +1638,6 @@ public:
     ceph_tid_t ping_tid;
     epoch_t map_dne_bound;
 
-    epoch_t last_force_resend;
-
     void _queued_async() {
       // watch_lock ust be locked unique
       watch_pending_async.push_back(ceph::mono_clock::now());
@@ -1667,8 +1663,7 @@ public:
                 session(NULL),
                 register_tid(0),
                 ping_tid(0),
-                map_dne_bound(0),
-                last_force_resend(0) {}
+                map_dne_bound(0) {}
 
     // no copy!
     const LingerOp &operator=(const LingerOp& r);
@@ -1834,7 +1829,7 @@ public:
   bool _osdmap_has_pool_full() const;
 
   bool target_should_be_paused(op_target_t *op);
-  int _calc_target(op_target_t *t, epoch_t *last_force_resend = 0,
+  int _calc_target(op_target_t *t,
                   bool any_change = false);
   int _map_session(op_target_t *op, OSDSession **s,
                   shunique_lock& lc);