Commit a5d604d7 authored by Nathaniel Clark's avatar Nathaniel Clark Committed by Greg Kroah-Hartman
Browse files

staging: lustre: ldlm: Recalculate interval in ldlm_pool_recalc()



Instead of rechecking a static value, recalculate to see if pool stats
need to be updated.
Add newline so message will print instead of warning about missing
newline.

Signed-off-by: default avatarNathaniel Clark <nathaniel.l.clark@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4536
Reviewed-on: http://review.whamcloud.com/12547


Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJian Yu <jian.yu@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d333597a
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -357,10 +357,10 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl)
	int count;

	recalc_interval_sec = ktime_get_seconds() - pl->pl_recalc_time;
	if (recalc_interval_sec <= 0)
		goto recalc;

	if (recalc_interval_sec > 0) {
		spin_lock(&pl->pl_lock);
		recalc_interval_sec = ktime_get_seconds() - pl->pl_recalc_time;

		if (recalc_interval_sec > 0) {
			/*
			 * Update pool statistics every 1s.
@@ -374,16 +374,22 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl)
			atomic_set(&pl->pl_cancel_rate, 0);
		}
		spin_unlock(&pl->pl_lock);
	}

 recalc:
	if (pl->pl_ops->po_recalc) {
		count = pl->pl_ops->po_recalc(pl);
		lprocfs_counter_add(pl->pl_stats, LDLM_POOL_RECALC_STAT,
				    count);
	}

	recalc_interval_sec = pl->pl_recalc_time - ktime_get_seconds() +
			      pl->pl_recalc_period;
	if (recalc_interval_sec <= 0) {
		/* DEBUG: should be re-removed after LU-4536 is fixed */
		CDEBUG(D_DLMTRACE, "%s: Negative interval(%ld), too short period(%ld)\n",
		       pl->pl_name, (long)recalc_interval_sec,
		       (long)pl->pl_recalc_period);

		/* Prevent too frequent recalculation. */
		recalc_interval_sec = 1;
	}