Commit e990f1c6 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman
Browse files

staging: lustre: libcfs: discard cfs_time_shift().



This function simply multiplies by HZ and adds jiffies.
This is simple enough to be opencoded, and doing so
makes the code easier to read.

Same for cfs_time_shift_64()

Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b0fdb570
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -50,11 +50,6 @@ static inline int cfs_time_aftereq(unsigned long t1, unsigned long t2)
	return time_before_eq(t2, t1);
}

static inline unsigned long cfs_time_shift(int seconds)
{
	return jiffies + seconds * HZ;
}

/*
 * return valid time-out based on user supplied one. Currently we only check
 * that time-out is not shorted than allowed.
+0 −5
Original line number Diff line number Diff line
@@ -65,11 +65,6 @@ static inline long cfs_duration_sec(long d)
	return d / msecs_to_jiffies(MSEC_PER_SEC);
}

static inline u64 cfs_time_shift_64(int seconds)
{
	return get_jiffies_64() + (u64)seconds * HZ;
}

static inline int cfs_time_before_64(u64 t1, u64 t2)
{
	return (__s64)t2 - (__s64)t1 > 0;
+6 −6
Original line number Diff line number Diff line
@@ -1446,7 +1446,7 @@ static int kiblnd_create_fmr_pool(struct kib_fmr_poolset *fps,
	if (rc)
		goto out_fpo;

	fpo->fpo_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
	fpo->fpo_deadline = jiffies + IBLND_POOL_DEADLINE * HZ;
	fpo->fpo_owner = fps;
	*pp_fpo = fpo;

@@ -1619,7 +1619,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx,
	spin_lock(&fps->fps_lock);
	version = fps->fps_version;
	list_for_each_entry(fpo, &fps->fps_pool_list, fpo_list) {
		fpo->fpo_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
		fpo->fpo_deadline = jiffies + IBLND_POOL_DEADLINE * HZ;
		fpo->fpo_map_count++;

		if (fpo->fpo_is_fmr) {
@@ -1743,7 +1743,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx,
		fps->fps_version++;
		list_add_tail(&fpo->fpo_list, &fps->fps_pool_list);
	} else {
		fps->fps_next_retry = cfs_time_shift(IBLND_POOL_RETRY);
		fps->fps_next_retry = jiffies + IBLND_POOL_RETRY * HZ;
	}
	spin_unlock(&fps->fps_lock);

@@ -1764,7 +1764,7 @@ static void kiblnd_init_pool(struct kib_poolset *ps, struct kib_pool *pool, int

	memset(pool, 0, sizeof(*pool));
	INIT_LIST_HEAD(&pool->po_free_list);
	pool->po_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
	pool->po_deadline = jiffies + IBLND_POOL_DEADLINE * HZ;
	pool->po_owner    = ps;
	pool->po_size     = size;
}
@@ -1899,7 +1899,7 @@ struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps)
			continue;

		pool->po_allocated++;
		pool->po_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
		pool->po_deadline = jiffies + IBLND_POOL_DEADLINE * HZ;
		node = pool->po_free_list.next;
		list_del(node);

@@ -1947,7 +1947,7 @@ struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps)
	if (!rc) {
		list_add_tail(&pool->po_list, &ps->ps_pool_list);
	} else {
		ps->ps_next_retry = cfs_time_shift(IBLND_POOL_RETRY);
		ps->ps_next_retry = jiffies + IBLND_POOL_RETRY * HZ;
		CERROR("Can't allocate new %s pool because out of memory\n",
		       ps->ps_name);
	}
+2 −2
Original line number Diff line number Diff line
@@ -3700,13 +3700,13 @@ kiblnd_failover_thread(void *arg)
			LASSERT(dev->ibd_failover);
			dev->ibd_failover = 0;
			if (rc >= 0) { /* Device is OK or failover succeed */
				dev->ibd_next_failover = cfs_time_shift(3);
				dev->ibd_next_failover = jiffies + 3 * HZ;
				continue;
			}

			/* failed to failover, retry later */
			dev->ibd_next_failover =
				cfs_time_shift(min(dev->ibd_failed_failover, 10));
				jiffies + min(dev->ibd_failed_failover, 10) * HZ;
			if (kiblnd_dev_can_failover(dev)) {
				list_add_tail(&dev->ibd_fail_list,
					      &kiblnd_data.kib_failed_devs);
+2 −2
Original line number Diff line number Diff line
@@ -1287,7 +1287,7 @@ ksocknal_create_conn(struct lnet_ni *ni, struct ksock_route *route,
	conn->ksnc_tx_last_post = jiffies;
	/* Set the deadline for the outgoing HELLO to drain */
	conn->ksnc_tx_bufnob = sock->sk->sk_wmem_queued;
	conn->ksnc_tx_deadline = cfs_time_shift(*ksocknal_tunables.ksnd_timeout);
	conn->ksnc_tx_deadline = jiffies + *ksocknal_tunables.ksnd_timeout * HZ;
	mb();   /* order with adding to peer's conn list */

	list_add(&conn->ksnc_list, &peer->ksnp_conns);
@@ -1852,7 +1852,7 @@ ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when)
			if (bufnob < conn->ksnc_tx_bufnob) {
				/* something got ACKed */
				conn->ksnc_tx_deadline =
					cfs_time_shift(*ksocknal_tunables.ksnd_timeout);
					jiffies + *ksocknal_tunables.ksnd_timeout * HZ;
				peer->ksnp_last_alive = now;
				conn->ksnc_tx_bufnob = bufnob;
			}
Loading