diff --git a/src/plugins/burst_buffer/cray/burst_buffer_cray.c b/src/plugins/burst_buffer/cray/burst_buffer_cray.c
index cad5313288856d8fe1a0051646fa553556111257..9667dd70d2c82f3559f73edc6335aaa0db8d2faf 100644
--- a/src/plugins/burst_buffer/cray/burst_buffer_cray.c
+++ b/src/plugins/burst_buffer/cray/burst_buffer_cray.c
@@ -491,11 +491,8 @@ static bb_job_t *_get_bb_job(struct job_record *job_ptr)
 	bb_job->account = xstrdup(job_ptr->account);
 	if (job_ptr->part_ptr)
 		bb_job->partition = xstrdup(job_ptr->part_ptr->name);
-	if (job_ptr->qos_ptr) {
-		slurmdb_qos_rec_t *qos_ptr =
-			(slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-		bb_job->qos = xstrdup(qos_ptr->name);
-	}
+	if (job_ptr->qos_ptr)
+		bb_job->qos = xstrdup(job_ptr->qos_ptr->name);
 	bb_job->state = BB_STATE_PENDING;
 	bb_job->user_id = job_ptr->user_id;
 	bb_specs = xstrdup(job_ptr->burst_buffer);
@@ -4492,8 +4489,7 @@ static void *_create_persistent(void *x)
 					",%u,", assoc->id);
 			}
 			if (job_ptr->qos_ptr) {
-				slurmdb_qos_rec_t *qos_ptr =
-					(slurmdb_qos_rec_t *)job_ptr->qos_ptr;
+				slurmdb_qos_rec_t *qos_ptr = job_ptr->qos_ptr;
 				bb_alloc->qos_ptr = qos_ptr;
 				bb_alloc->qos = xstrdup(qos_ptr->name);
 			}
diff --git a/src/plugins/job_submit/lua/job_submit_lua.c b/src/plugins/job_submit/lua/job_submit_lua.c
index 8b90a07b6594c07fbed57635a143166e1410a68e..130e5ff56fad27842ea2dc8ee764ceb2c08810dd 100644
--- a/src/plugins/job_submit/lua/job_submit_lua.c
+++ b/src/plugins/job_submit/lua/job_submit_lua.c
@@ -366,9 +366,7 @@ static int _job_rec_field(const struct job_record *job_ptr,
 		lua_pushnumber (L, job_ptr->priority);
 	} else if (!xstrcmp(name, "qos")) {
 		if (job_ptr->qos_ptr) {
-			slurmdb_qos_rec_t *qos_ptr =
-				(slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-			lua_pushstring (L, qos_ptr->name);
+			lua_pushstring (L, job_ptr->qos_ptr->name);
 		} else {
 			lua_pushnil (L);
 		}
diff --git a/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c b/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
index cd62ecdd5e9420902a3767643ecfed0e3370a324..cc9717c5e9a2f586df6caf811f339be033d0c75c 100644
--- a/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
+++ b/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
@@ -728,15 +728,12 @@ extern int slurm_jobcomp_log_record(struct job_record *job_ptr)
 	}
 
 	if (job_ptr->assoc_ptr != NULL) {
-		cluster = ((slurmdb_assoc_rec_t *) job_ptr->assoc_ptr)->cluster;
-		xstrfmtcat(buffer, ",\"cluster\":\"%s\"", cluster);
+		xstrfmtcat(buffer, ",\"cluster\":\"%s\"",
+			   job_ptr->assoc_ptr->cluster);
 	}
 
 	if (job_ptr->qos_ptr != NULL) {
-		slurmdb_qos_rec_t *assoc =
-			(slurmdb_qos_rec_t *) job_ptr->qos_ptr;
-		qos = assoc->name;
-		xstrfmtcat(buffer, ",\"qos\":\"%s\"", qos);
+		xstrfmtcat(buffer, ",\"qos\":\"%s\"", job_ptr->qos_ptr->name);
 	}
 
 	if (job_ptr->details && (job_ptr->details->num_tasks != NO_VAL)) {
diff --git a/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c b/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c
index 03da3f948b5b41785c1a7e54a65f613ea857716b..72db3fc7692d2e1ba2ea952edc3f2be464eb3702 100644
--- a/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c
+++ b/src/plugins/jobcomp/filetxt/jobcomp_filetxt.c
@@ -318,9 +318,7 @@ extern int slurm_jobcomp_log_record ( struct job_record *job_ptr )
 		account = "";
 
 	if (job_ptr->qos_ptr != NULL) {
-		slurmdb_qos_rec_t *assoc =
-			(slurmdb_qos_rec_t *) job_ptr->qos_ptr;
-		qos = assoc->name;
+		qos = job_ptr->qos_ptr->name;
 	} else
 		qos = "";
 
@@ -330,7 +328,7 @@ extern int slurm_jobcomp_log_record ( struct job_record *job_ptr )
 		wckey = "";
 
 	if (job_ptr->assoc_ptr != NULL)
-		cluster = ((slurmdb_assoc_rec_t *) job_ptr->assoc_ptr)->cluster;
+		cluster = job_ptr->assoc_ptr->cluster;
 	else
 		cluster = "unknown";
 
diff --git a/src/plugins/preempt/job_prio/preempt_job_prio.c b/src/plugins/preempt/job_prio/preempt_job_prio.c
index 43e8c34368b594adaeb062af327eeaf970c152d7..8e4e987d7ca994f4edab95b75e5d4cd0808fd26e 100644
--- a/src/plugins/preempt/job_prio/preempt_job_prio.c
+++ b/src/plugins/preempt/job_prio/preempt_job_prio.c
@@ -107,10 +107,8 @@ static bool _account_preemptable(struct job_record *preemptor_job_ptr,
 	bool is_from_same_account = false;
 	int i;
 
-	preemptor_assoc =
-		(slurmdb_assoc_rec_t *)preemptor_job_ptr->assoc_ptr;
-	preemptee_assoc =
-		(slurmdb_assoc_rec_t *)preemptee_job_ptr->assoc_ptr;
+	preemptor_assoc = preemptor_job_ptr->assoc_ptr;
+	preemptee_assoc = preemptee_job_ptr->assoc_ptr;
 	if (!preemptor_assoc || !preemptee_assoc)
 		return false;
 
@@ -347,8 +345,7 @@ static int _get_nb_cpus(struct job_record *job_ptr)
 static slurmdb_assoc_rec_t *_get_job_fs_ass(char *job_type,
 					    struct job_record *job_ptr)
 {
-	slurmdb_assoc_rec_t *temp_fs_ass =
-		(slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	slurmdb_assoc_rec_t *temp_fs_ass = job_ptr->assoc_ptr;
 
 	if (slurm_get_debug_flags() & DEBUG_FLAG_PRIO) {
 		info("%s: Pre %s JobID:%u ParentAcct:%s MyAcct:%s "
@@ -407,8 +404,7 @@ static void _account_under_alloc(struct job_record *preemptor_job_ptr,
 	acct_usage_element_t *found_acct_usage_ptr = NULL;
 	char *share_type;
 
-	preemptor_assoc = (slurmdb_assoc_rec_t *)
-			  preemptor_job_ptr->assoc_ptr;
+	preemptor_assoc = preemptor_job_ptr->assoc_ptr;
 	preemptor_temp_fs_ass = _get_job_fs_ass("preemptor", preemptor_job_ptr);
 	preemptor_grp_used_cpu = preemptor_temp_fs_ass->usage->
 		grp_used_tres[TRES_ARRAY_CPU];
@@ -420,8 +416,7 @@ static void _account_under_alloc(struct job_record *preemptor_job_ptr,
 	}
 
 	while ((preemptee_job_ptr = (struct job_record *) list_next(it))) {
-		preemptee_assoc = ((slurmdb_assoc_rec_t *)
-				   preemptee_job_ptr->assoc_ptr);
+		preemptee_assoc = preemptee_job_ptr->assoc_ptr;
 		preemptee_assoc_id = preemptee_assoc->id;
 		preemptee_temp_fs_ass = _get_job_fs_ass("preemptee",
 							preemptee_job_ptr);
@@ -520,8 +515,7 @@ static void _account_under_alloc(struct job_record *preemptor_job_ptr,
 		preemptee_current_usage =
 			(long)(preemptee_acct_usage_ptr->current_usage*EPSILON);
 		if (((xstrcmp(preemptor_assoc->acct,
-			      ((slurmdb_assoc_rec_t *)
-			       preemptee_job_ptr->assoc_ptr)->acct) != 0) &&
+			      preemptee_job_ptr->assoc_ptr->acct) != 0) &&
 		    (preemptor_new_usage >= preemptee_acct_usage_ptr->current_usage ||
 		     preemptee_acct_usage_ptr->current_cpu_count <= 0)) &&
 		    (preemptee_acct_usage_ptr->current_usage > 0)) {
@@ -539,11 +533,9 @@ static void _account_under_alloc(struct job_record *preemptor_job_ptr,
 				      preemptor_new_usage,
 				      preemptee_current_usage,
 				      preemptor_new_usage_long,
-				      ((slurmdb_assoc_rec_t*)
-				       preemptee_job_ptr->assoc_ptr)->acct,
-				      ((slurmdb_assoc_rec_t*)
-				       preemptee_job_ptr->assoc_ptr)->
-				       parent_acct);
+				      preemptee_job_ptr->assoc_ptr->acct,
+				      preemptee_job_ptr->assoc_ptr->
+				      parent_acct);
 			}
 			preemptee_acct_usage_ptr->current_usage +=
 				((double)preemptee_cpu_cnt) /
@@ -582,8 +574,8 @@ static int _overalloc_test(struct job_record *preemptor,
 	cpu_cnt_preemptee = _get_nb_cpus(preemptee);
 	cpu_cnt_preemptor = _get_nb_cpus(preemptor);
 
-	assoc_preemptee = (slurmdb_assoc_rec_t *)preemptee->assoc_ptr;
-	assoc_preemptor = (slurmdb_assoc_rec_t *)preemptor->assoc_ptr;
+	assoc_preemptee = preemptee->assoc_ptr;
+	assoc_preemptor = preemptor->assoc_ptr;
 
 	if (!assoc_preemptee || !assoc_preemptee->usage ||
 	    !assoc_preemptor || !assoc_preemptor->usage) {
@@ -844,9 +836,8 @@ extern uint16_t job_preempt_mode(struct job_record *job_ptr)
 {
 	uint16_t mode;
 
-	if (job_ptr->qos_ptr &&
-	   ((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->preempt_mode) {
-		mode = ((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->preempt_mode;
+	if (job_ptr->qos_ptr && job_ptr->qos_ptr->preempt_mode) {
+		mode = job_ptr->qos_ptr->preempt_mode;
 		if (slurm_get_debug_flags() & DEBUG_FLAG_PRIO) {
 			info("%s: in job_preempt_mode return = %s",
 			     plugin_type, preempt_mode_string(mode));
diff --git a/src/plugins/preempt/qos/preempt_qos.c b/src/plugins/preempt/qos/preempt_qos.c
index 9e6c990ecf6bddc5c4f9f9d3810a19f9ebf14c01..6c5210193bc0b9a96409a3bc4e6ae6d0879df498 100644
--- a/src/plugins/preempt/qos/preempt_qos.c
+++ b/src/plugins/preempt/qos/preempt_qos.c
@@ -215,9 +215,8 @@ static int _sort_by_youngest(void *x, void *y)
 
 extern uint16_t job_preempt_mode(struct job_record *job_ptr)
 {
-	if (job_ptr->qos_ptr &&
-	    ((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->preempt_mode)
-		return ((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->preempt_mode;
+	if (job_ptr->qos_ptr && job_ptr->qos_ptr->preempt_mode)
+		return job_ptr->qos_ptr->preempt_mode;
 
 	return (slurm_get_preempt_mode() & (~PREEMPT_MODE_GANG));
 }
diff --git a/src/plugins/priority/basic/priority_basic.c b/src/plugins/priority/basic/priority_basic.c
index a86ce3fe277ec5e4d416e0bb483656635c3d71db..42c81d6b5626540dd0efc3dbf12e03adc545ac10 100644
--- a/src/plugins/priority/basic/priority_basic.c
+++ b/src/plugins/priority/basic/priority_basic.c
@@ -180,8 +180,7 @@ extern void priority_p_job_end(struct job_record *job_ptr)
 
 	assoc_mgr_lock(&locks);
 	if (job_ptr->qos_ptr) {
-		slurmdb_qos_rec_t *qos_ptr =
-			(slurmdb_qos_rec_t *)job_ptr->qos_ptr;
+		slurmdb_qos_rec_t *qos_ptr = job_ptr->qos_ptr;
 		for (i=0; i<slurmctld_tres_cnt; i++) {
 			if (unused_tres_run_secs[i] >
 			    qos_ptr->usage->grp_used_tres_run_secs[i]) {
@@ -196,7 +195,7 @@ extern void priority_p_job_end(struct job_record *job_ptr)
 					unused_tres_run_secs[i];
 		}
 	}
-	assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	assoc_ptr = job_ptr->assoc_ptr;
 	while (assoc_ptr) {
 		/* If the job finished early remove the extra time now. */
 		for (i=0; i<slurmctld_tres_cnt; i++) {
diff --git a/src/plugins/priority/multifactor/priority_multifactor.c b/src/plugins/priority/multifactor/priority_multifactor.c
index 108c123f3dde0cb0f028908060d812facf2d6c1e..a4f9d9ba42f93b757629de64d74051c540e0f710 100644
--- a/src/plugins/priority/multifactor/priority_multifactor.c
+++ b/src/plugins/priority/multifactor/priority_multifactor.c
@@ -443,7 +443,7 @@ static double _get_fairshare_priority(struct job_record *job_ptr)
 
 	assoc_mgr_lock(&locks);
 
-	job_assoc = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	job_assoc = job_ptr->assoc_ptr;
 
 	if (!job_assoc) {
 		assoc_mgr_unlock(&locks);
@@ -887,7 +887,7 @@ static void _handle_tres_run_secs(uint64_t *tres_run_delta,
 				  struct job_record *job_ptr)
 {
 
-	slurmdb_assoc_rec_t *assoc = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	slurmdb_assoc_rec_t *assoc = job_ptr->assoc_ptr;
 
 	_handle_qos_tres_run_secs(NULL, tres_run_delta,
 				  job_ptr->job_id, job_ptr->qos_ptr);
@@ -1094,8 +1094,8 @@ static int _apply_new_usage(struct job_record *job_ptr,
 	   changed make sure we get it again
 	   here.
 	*/
-	qos = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-	assoc = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	qos = job_ptr->qos_ptr;
+	assoc = job_ptr->assoc_ptr;
 
 	/* now apply the usage factor for this qos */
 	if (qos) {
@@ -1123,7 +1123,7 @@ static int _apply_new_usage(struct job_record *job_ptr,
 	/* sanity check, there should always be a part_ptr here, but only do
 	 * the qos if it isn't the same qos as the job is using */
 	if (job_ptr->part_ptr && (job_ptr->part_ptr->qos_ptr != qos))
-		qos = (slurmdb_qos_rec_t *)job_ptr->part_ptr->qos_ptr;
+		qos = job_ptr->part_ptr->qos_ptr;
 	else
 		qos = NULL;
 
@@ -2064,7 +2064,7 @@ extern void set_priority_factors(time_t start_time, struct job_record *job_ptr)
 		       sizeof(priority_factors_object_t));
 	}
 
-	qos_ptr = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
+	qos_ptr = job_ptr->qos_ptr;
 
 	if (weight_age) {
 		uint32_t diff = 0;
diff --git a/src/plugins/sched/backfill/backfill.c b/src/plugins/sched/backfill/backfill.c
index 5c6dab653f09bf0888b7a7d8e6216b67b55d09ca..787cc8a707d671c5cf89d4a4f5e7c2f0969f635c 100644
--- a/src/plugins/sched/backfill/backfill.c
+++ b/src/plugins/sched/backfill/backfill.c
@@ -913,7 +913,6 @@ static int _attempt_backfill(void)
 	DEF_TIMERS;
 	List job_queue;
 	job_queue_rec_t *job_queue_rec;
-	slurmdb_qos_rec_t *qos_ptr = NULL;
 	int bb, i, j, k, node_space_recs, mcs_select = 0;
 	struct job_record *job_ptr;
 	struct part_record *part_ptr, **bf_part_ptr = NULL;
@@ -1145,7 +1144,6 @@ static int _attempt_backfill(void)
 
 			if (!assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 						    accounting_enforce,
-						    (slurmdb_assoc_rec_t **)
 						     &job_ptr->assoc_ptr,
 						     false)) {
 				job_ptr->state_reason = WAIT_NO_REASON;
@@ -1163,17 +1161,15 @@ static int _attempt_backfill(void)
 		}
 
 		if (job_ptr->qos_id) {
-			slurmdb_assoc_rec_t *assoc_ptr;
 			assoc_mgr_lock_t locks = {
 				READ_LOCK, NO_LOCK, READ_LOCK, NO_LOCK,
 				NO_LOCK, NO_LOCK, NO_LOCK };
 
 			assoc_mgr_lock(&locks);
-			assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
-			if (assoc_ptr
+			if (job_ptr->assoc_ptr
 			    && (accounting_enforce & ACCOUNTING_ENFORCE_QOS)
 			    && ((job_ptr->qos_id >= g_qos_count) ||
-				!bit_test(assoc_ptr->usage->valid_qos,
+				!bit_test(job_ptr->assoc_ptr->usage->valid_qos,
 					  job_ptr->qos_id))
 			    && !job_ptr->limit_set.qos) {
 				debug("backfill: JobId=%u has invalid QOS",
@@ -1192,11 +1188,10 @@ static int _attempt_backfill(void)
 		}
 
 		assoc_mgr_lock(&qos_read_lock);
-		qos_ptr = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-		if (qos_ptr)
-			qos_flags = qos_ptr->flags;
-		if (part_policy_valid_qos(job_ptr->part_ptr, qos_ptr) !=
-		    SLURM_SUCCESS) {
+		if (job_ptr->qos_ptr)
+			qos_flags = job_ptr->qos_ptr->flags;
+		if (part_policy_valid_qos(job_ptr->part_ptr,
+					  job_ptr->qos_ptr) != SLURM_SUCCESS) {
 			assoc_mgr_unlock(&qos_read_lock);
 			xfree(job_ptr->state_desc);
 			job_ptr->state_reason = WAIT_QOS;
diff --git a/src/plugins/select/bluegene/bg_record_functions.c b/src/plugins/select/bluegene/bg_record_functions.c
index 22b38d0774a293a49f4a95dac9e61a063d30a34d..78098e2812aa8f2bf26efe5dde4229c4290062bb 100644
--- a/src/plugins/select/bluegene/bg_record_functions.c
+++ b/src/plugins/select/bluegene/bg_record_functions.c
@@ -1816,7 +1816,7 @@ extern void bg_record_hw_failure(bg_record_t *bg_record, List *ret_kill_list)
 		if (jobinfo->cleaning || !IS_JOB_RUNNING(found_job_ptr))
 			continue;
 
-		qos_ptr = (slurmdb_qos_rec_t *)found_job_ptr->qos_ptr;
+		qos_ptr = found_job_ptr->qos_ptr;
 		if (qos_ptr) {
 			/* If we ever get one that
 			   isn't set correctly then we
diff --git a/src/plugins/slurmctld/nonstop/do_work.c b/src/plugins/slurmctld/nonstop/do_work.c
index b9acccb6839a19937fc09c8d5d04bada54bafe16..fac3e9c6be60e09a1485a578c63235f7d04bc38c 100644
--- a/src/plugins/slurmctld/nonstop/do_work.c
+++ b/src/plugins/slurmctld/nonstop/do_work.c
@@ -1249,11 +1249,8 @@ extern char *replace_node(char *cmd_ptr, uid_t cmd_uid,
 	job_alloc_req.network	= xstrdup(job_ptr->network);
 	job_alloc_req.partition	= xstrdup(job_ptr->partition);
 	job_alloc_req.priority	= NO_VAL - 1;
-	if (job_ptr->qos_ptr) {
-		slurmdb_qos_rec_t *qos_ptr;
-		qos_ptr = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-		job_alloc_req.qos = xstrdup(qos_ptr->name);
-	}
+	if (job_ptr->qos_ptr)
+		job_alloc_req.qos = xstrdup(job_ptr->qos_ptr->name);
 
 	/* Without unlock, the job_begin_callback() function will deadlock.
 	 * Not a great solution, but perhaps the least bad solution. */
diff --git a/src/slurmctld/acct_policy.c b/src/slurmctld/acct_policy.c
index e3f5c57897462fde669000c2fc1e01bb23082b2b..d2dd61655989b75dae5b989b44864e784af0f9cd 100644
--- a/src/slurmctld/acct_policy.c
+++ b/src/slurmctld/acct_policy.c
@@ -329,8 +329,7 @@ static void _set_qos_order(struct job_record *job_ptr,
 			 * partition then use that otherwise use the
 			 * partition's QOS as the king.
 			 */
-			if (((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->flags
-			    & QOS_FLAG_OVER_PART_QOS) {
+			if (job_ptr->qos_ptr->flags & QOS_FLAG_OVER_PART_QOS) {
 				*qos_ptr_1 = job_ptr->qos_ptr;
 				*qos_ptr_2 = job_ptr->part_ptr->qos_ptr;
 			} else {
@@ -438,12 +437,11 @@ static slurmdb_used_limits_t *_get_user_used_limits(
 
 static bool _valid_job_assoc(struct job_record *job_ptr)
 {
-	slurmdb_assoc_rec_t assoc_rec, *assoc_ptr;
+	slurmdb_assoc_rec_t assoc_rec;
 
-	assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
-	if ((assoc_ptr == NULL) ||
-	    (assoc_ptr->id  != job_ptr->assoc_id) ||
-	    (assoc_ptr->uid != job_ptr->user_id)) {
+	if ((job_ptr->assoc_ptr == NULL) ||
+	    (job_ptr->assoc_ptr->id  != job_ptr->assoc_id) ||
+	    (job_ptr->assoc_ptr->uid != job_ptr->user_id)) {
 		error("Invalid assoc_ptr for jobid=%u", job_ptr->job_id);
 		memset(&assoc_rec, 0, sizeof(slurmdb_assoc_rec_t));
 
@@ -454,7 +452,6 @@ static bool _valid_job_assoc(struct job_record *job_ptr)
 
 		if (assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 					    accounting_enforce,
-					    (slurmdb_assoc_rec_t **)
 					    &job_ptr->assoc_ptr, false)) {
 			info("_validate_job_assoc: invalid account or "
 			     "partition for uid=%u jobid=%u",
@@ -472,14 +469,13 @@ static void _qos_adjust_limit_usage(int type, struct job_record *job_ptr,
 				    uint32_t job_cnt)
 {
 	slurmdb_used_limits_t *used_limits = NULL, *used_limits_a = NULL;
-	slurmdb_assoc_rec_t *assoc_ptr = job_ptr->assoc_ptr;
 	int i;
 
-	if (!qos_ptr || !assoc_ptr)
+	if (!qos_ptr || !job_ptr->assoc_ptr)
 		return;
 
 	used_limits_a =	_get_acct_used_limits(&qos_ptr->usage->acct_limit_list,
-					      assoc_ptr->acct);
+					      job_ptr->assoc_ptr->acct);
 
 	used_limits = _get_user_used_limits(&qos_ptr->usage->user_limit_list,
 					    job_ptr->user_id);
@@ -661,7 +657,7 @@ static void _adjust_limit_usage(int type, struct job_record *job_ptr)
 	_qos_adjust_limit_usage(type, job_ptr, qos_ptr_2,
 				used_tres_run_secs, job_cnt);
 
-	assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	assoc_ptr = job_ptr->assoc_ptr;
 	while (assoc_ptr) {
 		switch(type) {
 		case ACCT_POLICY_ADD_SUBMIT:
@@ -2421,7 +2417,7 @@ extern void acct_policy_alter_job(struct job_record *job_ptr,
 	_qos_alter_job(job_ptr, qos_ptr_2,
 		       used_tres_run_secs, new_used_tres_run_secs);
 
-	assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	assoc_ptr = job_ptr->assoc_ptr;
 	while (assoc_ptr) {
 		for (i=0; i<slurmctld_tres_cnt; i++) {
 			if (used_tres_run_secs[i] == new_used_tres_run_secs[i])
@@ -3648,7 +3644,7 @@ extern bool acct_policy_job_time_out(struct job_record *job_ptr)
 
 	_set_qos_order(job_ptr, &qos_ptr_1, &qos_ptr_2);
 
-	assoc =	(slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
+	assoc =	job_ptr->assoc_ptr;
 
 	now = time(NULL);
 
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index b0ed3c7e579a2d313f2ecb4675d997099b154c8b..f54d6ccbc92860585e4d48e0eec13c014f37dc76 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -2193,7 +2193,6 @@ static int _load_job_state(Buf buffer, uint16_t protocol_version)
 
 	if (assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 				    accounting_enforce,
-				    (slurmdb_assoc_rec_t **)
 				    &job_ptr->assoc_ptr, true) &&
 	    (accounting_enforce & ACCOUNTING_ENFORCE_ASSOCS)
 	    && (!IS_JOB_FINISHED(job_ptr))) {
@@ -11037,7 +11036,6 @@ static int _update_job(struct job_record *job_ptr, job_desc_msg_t * job_specs,
 			if (assoc_mgr_fill_in_assoc(
 				    acct_db_conn, &assoc_rec,
 				    accounting_enforce,
-				    (slurmdb_assoc_rec_t **)
 				    &job_ptr->assoc_ptr, false)) {
 				info("job_update: invalid account %s "
 				     "for job %u",
@@ -11510,7 +11508,7 @@ static int _update_job(struct job_record *job_ptr, job_desc_msg_t * job_specs,
 				struct part_record *part_ptr =
 					job_ptr->part_ptr;
 				slurmdb_qos_rec_t *qos_ptr =
-					(slurmdb_qos_rec_t *)job_ptr->qos_ptr;
+					job_ptr->qos_ptr;
 
 				if (part_ptr
 				    && part_ptr->flags & PART_FLAG_REQ_RESV)
@@ -13890,7 +13888,6 @@ extern void job_completion_logger(struct job_record *job_ptr, bool requeue)
 
 		if (!(assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 					      accounting_enforce,
-					      (slurmdb_assoc_rec_t **)
 					      &job_ptr->assoc_ptr, false))) {
 			job_ptr->assoc_id = assoc_rec.id;
 			/* we have to call job start again because the
@@ -15321,12 +15318,10 @@ extern int job_hold_by_assoc_id(uint32_t assoc_id)
 			}
 
 			job_ptr->assoc_ptr =
-				((slurmdb_assoc_rec_t *)
-				 job_ptr->assoc_ptr)->usage->parent_assoc_ptr;
+				job_ptr->assoc_ptr->usage->parent_assoc_ptr;
 			if (job_ptr->assoc_ptr)
 				job_ptr->assoc_id =
-					((slurmdb_assoc_rec_t *)
-					 job_ptr->assoc_ptr)->id;
+					job_ptr->assoc_ptr->id;
 		}
 
 		if (IS_JOB_FINISHED(job_ptr))
@@ -15420,7 +15415,6 @@ extern int update_job_account(char *module, struct job_record *job_ptr,
 	assoc_rec.uid       = job_ptr->user_id;
 	if (assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 				    accounting_enforce,
-				    (slurmdb_assoc_rec_t **)
 				    &job_ptr->assoc_ptr, false)) {
 		info("%s: invalid account %s for job_id %u",
 		     module, new_account, job_ptr->job_id);
@@ -15435,7 +15429,6 @@ extern int update_job_account(char *module, struct job_record *job_ptr,
 		assoc_rec.acct = NULL;
 		assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 					accounting_enforce,
-					(slurmdb_assoc_rec_t **)
 					&job_ptr->assoc_ptr, false);
 		if (!job_ptr->assoc_ptr) {
 			debug("%s: we didn't have an association for account "
@@ -15554,7 +15547,6 @@ extern int send_jobs_to_accounting(void)
 			if (assoc_mgr_fill_in_assoc(
 				   acct_db_conn, &assoc_rec,
 				   accounting_enforce,
-				   (slurmdb_assoc_rec_t **)
 				   &job_ptr->assoc_ptr, false) &&
 			    (accounting_enforce & ACCOUNTING_ENFORCE_ASSOCS)
 			    && (!IS_JOB_FINISHED(job_ptr))) {
@@ -15893,11 +15885,8 @@ extern job_desc_msg_t *copy_job_record_to_job_desc(struct job_record *job_ptr)
 	job_desc->partition         = xstrdup(job_ptr->partition);
 	job_desc->plane_size        = details->plane_size;
 	job_desc->priority          = job_ptr->priority;
-	if (job_ptr->qos_ptr) {
-		slurmdb_qos_rec_t *qos_ptr =
-			(slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-		job_desc->qos       = xstrdup(qos_ptr->name);
-	}
+	if (job_ptr->qos_ptr)
+		job_desc->qos       = xstrdup(job_ptr->qos_ptr->name);
 	job_desc->resp_host         = xstrdup(job_ptr->resp_host);
 	job_desc->req_nodes         = xstrdup(details->req_nodes);
 	job_desc->requeue           = details->requeue;
diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c
index cc58612cdf2ba4f7e2e2d584d3229d326b9b3706..a9e3a5ee92ea475ca1951f2c12816c01c9d5e03b 100644
--- a/src/slurmctld/job_scheduler.c
+++ b/src/slurmctld/job_scheduler.c
@@ -793,7 +793,6 @@ next_part:		part_ptr = (struct part_record *)
 
 			if (!assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
 						     accounting_enforce,
-						     (slurmdb_assoc_rec_t **)
 						     &job_ptr->assoc_ptr,
 						     false)) {
 				job_ptr->state_reason = WAIT_NO_REASON;
@@ -805,16 +804,14 @@ next_part:		part_ptr = (struct part_record *)
 			}
 		}
 		if (job_ptr->qos_id) {
-			slurmdb_assoc_rec_t *assoc_ptr =
-				(slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
 			assoc_mgr_lock_t locks = {
 				READ_LOCK, NO_LOCK, READ_LOCK, NO_LOCK,
 				NO_LOCK, NO_LOCK, NO_LOCK };
 
 			assoc_mgr_lock(&locks);
-			if (assoc_ptr &&
+			if (job_ptr->assoc_ptr &&
 			    ((job_ptr->qos_id >= g_qos_count) ||
-			     !bit_test(assoc_ptr->usage->valid_qos,
+			     !bit_test(job_ptr->assoc_ptr->usage->valid_qos,
 				       job_ptr->qos_id)) &&
 			    !job_ptr->limit_set.qos) {
 				info("sched: JobId=%u has invalid QOS",
@@ -1679,8 +1676,7 @@ next_task:
 			assoc_rec.uid       = job_ptr->user_id;
 
 			if (!assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
-						    accounting_enforce,
-						    (slurmdb_assoc_rec_t **)
+						     accounting_enforce,
 						     &job_ptr->assoc_ptr,
 						     false)) {
 				job_ptr->state_reason = WAIT_NO_REASON;
@@ -1697,17 +1693,15 @@ next_task:
 			}
 		}
 		if (job_ptr->qos_id) {
-			slurmdb_assoc_rec_t *assoc_ptr;
 			assoc_mgr_lock_t locks = {
 				READ_LOCK, NO_LOCK, READ_LOCK, NO_LOCK,
 				NO_LOCK, NO_LOCK, NO_LOCK };
 
 			assoc_mgr_lock(&locks);
-			assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
-			if (assoc_ptr
+			if (job_ptr->assoc_ptr
 			    && (accounting_enforce & ACCOUNTING_ENFORCE_QOS)
 			    && ((job_ptr->qos_id >= g_qos_count) ||
-				!bit_test(assoc_ptr->usage->valid_qos,
+				!bit_test(job_ptr->assoc_ptr->usage->valid_qos,
 					  job_ptr->qos_id))
 			    && !job_ptr->limit_set.qos) {
 				debug("sched: JobId=%u has invalid QOS",
@@ -2311,13 +2305,12 @@ extern batch_job_launch_msg_t *build_launch_job_msg(struct job_record *job_ptr,
 		launch_msg_ptr->account = xstrdup(job_ptr->account);
 	}
 	if (job_ptr->qos_ptr) {
-		slurmdb_qos_rec_t *qos;
-
-		qos = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-		if (xstrcmp(qos->description, "Normal QOS default") == 0)
+		if (!xstrcmp(job_ptr->qos_ptr->description,
+			     "Normal QOS default"))
 			launch_msg_ptr->qos = xstrdup("normal");
 		else
-			launch_msg_ptr->qos = xstrdup(qos->description);
+			launch_msg_ptr->qos = xstrdup(
+				job_ptr->qos_ptr->description);
 	}
 	if (job_ptr->resv_name) {
 		launch_msg_ptr->resv_name = xstrdup(job_ptr->resv_name);
diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c
index 23398724de978ed16289f2512eb719cd07503f03..ec14741b25144cf577243156460e54af0f26179f 100644
--- a/src/slurmctld/node_scheduler.c
+++ b/src/slurmctld/node_scheduler.c
@@ -2186,8 +2186,6 @@ extern int select_nodes(struct job_record *job_ptr, bool test_only,
 	time_t now = time(NULL);
 	bool configuring = false;
 	List preemptee_job_list = NULL;
-	slurmdb_qos_rec_t *qos_ptr = NULL;
-	slurmdb_assoc_rec_t *assoc_ptr = NULL;
 	uint32_t selected_node_cnt = NO_VAL;
 	uint64_t tres_req_cnt[slurmctld_tres_cnt];
 	bool can_reboot;
@@ -2217,11 +2215,10 @@ extern int select_nodes(struct job_record *job_ptr, bool test_only,
 	/* Quick check to see if this QOS is allowed on this
 	 * partition. */
 	assoc_mgr_lock(&qos_read_lock);
-	qos_ptr = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-	if (qos_ptr)
-		qos_flags = qos_ptr->flags;
+	if (job_ptr->qos_ptr)
+		qos_flags = job_ptr->qos_ptr->flags;
 	if ((error_code = part_policy_valid_qos(
-		     job_ptr->part_ptr, qos_ptr)) != SLURM_SUCCESS) {
+		     job_ptr->part_ptr, job_ptr->qos_ptr)) != SLURM_SUCCESS) {
 		assoc_mgr_unlock(&qos_read_lock);
 		xfree(job_ptr->state_desc);
 		job_ptr->state_reason = WAIT_QOS;
@@ -2231,10 +2228,9 @@ extern int select_nodes(struct job_record *job_ptr, bool test_only,
 
 	/* Quick check to see if this account is allowed on
 	 * this partition. */
-	assoc_ptr = (slurmdb_assoc_rec_t *)job_ptr->assoc_ptr;
 	if ((error_code = part_policy_valid_acct(
 		     job_ptr->part_ptr,
-		     assoc_ptr ? assoc_ptr->acct : NULL))
+		     job_ptr->assoc_ptr ? job_ptr->assoc_ptr->acct : NULL))
 	    != SLURM_SUCCESS) {
 		assoc_mgr_unlock(&qos_read_lock);
 		xfree(job_ptr->state_desc);
diff --git a/src/slurmctld/preempt.c b/src/slurmctld/preempt.c
index d46ff97f327d2ae45df95e1a2b23bbe1cfe08b1f..a0f7a5b5dea413d69c143ecc67081be4bd55e47d 100644
--- a/src/slurmctld/preempt.c
+++ b/src/slurmctld/preempt.c
@@ -115,9 +115,11 @@ extern int slurm_job_check_grace(struct job_record *job_ptr, uint32_t preemptor)
 	if (preempt_mode == 1)
 		grace_time = job_ptr->part_ptr->grace_time;
 	else if (preempt_mode == 2) {
-		slurmdb_qos_rec_t *qos_ptr = (slurmdb_qos_rec_t *)
-					     job_ptr->qos_ptr;
-		grace_time = qos_ptr->grace_time;
+		if (!job_ptr->qos_ptr)
+			error("%s: Job %u has no QOS ptr!  This should never happen",
+			      __func__, job_ptr->job_id);
+		else
+			grace_time = job_ptr->qos_ptr->grace_time;
 	}
 
 	if (grace_time) {
diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c
index d85e83f622676d75cbae7e8ebef3d0ed508e54c6..829c568c0e4000080f22b7162bb91f2f0a187d63 100644
--- a/src/slurmctld/proc_req.c
+++ b/src/slurmctld/proc_req.c
@@ -1184,11 +1184,8 @@ send_msg:
 		}
 		if (job_ptr->account)
 			alloc_msg.account = xstrdup(job_ptr->account);
-		if (job_ptr->qos_ptr) {
-			slurmdb_qos_rec_t *qos;
-			qos = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-			alloc_msg.qos = xstrdup(qos->name);
-		}
+		if (job_ptr->qos_ptr)
+			alloc_msg.qos = xstrdup(job_ptr->qos_ptr->name);
 		if (job_ptr->resv_name)
 			alloc_msg.resv_name = xstrdup(job_ptr->resv_name);
 
@@ -2730,11 +2727,8 @@ static void _slurm_rpc_job_alloc_info(slurm_msg_t * msg)
 					    job_info_msg->req_cluster);
 
 		job_info_resp_msg.partition      = xstrdup(job_ptr->partition);
-		if (job_ptr->qos_ptr) {
-			slurmdb_qos_rec_t *qos;
-			qos = (slurmdb_qos_rec_t *)job_ptr->qos_ptr;
-			job_info_resp_msg.qos = xstrdup(qos->name);
-		}
+		if (job_ptr->qos_ptr)
+			job_info_resp_msg.qos = xstrdup(job_ptr->qos_ptr->name);
 		job_info_resp_msg.resv_name      = xstrdup(job_ptr->resv_name);
 		job_info_resp_msg.select_jobinfo =
 			select_g_select_jobinfo_copy(job_ptr->select_jobinfo);
diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h
index 23a655f5ec86ce51605ac4d973d7187a061e0dd0..0836c77c8fe921f9eb08e1282e3c127e29f495eb 100644
--- a/src/slurmctld/slurmctld.h
+++ b/src/slurmctld/slurmctld.h
@@ -351,11 +351,9 @@ struct part_record {
 	uint16_t priority_job_factor;	/* job priority weight factor */
 	uint16_t priority_tier;	/* tier for scheduling and preemption */
 	char *qos_char;         /* requested QOS from slurm.conf */
-	void *qos_ptr;          /* pointer to the quality of
-				 * service record attached to this
-				 * partition, it is void* because of
-				 * interdependencies in the header
-				 * files, confirm the value before use */
+	slurmdb_qos_rec_t *qos_ptr; /* pointer to the quality of
+				     * service record attached to this
+				     * partition confirm the value before use */
 	uint16_t state_up;	/* See PARTITION_* states in slurm.h */
 	uint32_t total_nodes;	/* total number of nodes in the partition */
 	uint32_t total_cpus;	/* total number of cpus in the partition */
@@ -589,9 +587,7 @@ struct job_record {
 	job_array_struct_t *array_recs;	/* job array details,
 					 * only in meta-job record */
 	uint32_t assoc_id;              /* used for accounting plugins */
-	void    *assoc_ptr;		/* job's assoc record ptr, it is
-					 * void* because of interdependencies
-					 * in the header files, confirm the
+	slurmdb_assoc_rec_t *assoc_ptr; /* job's assoc record ptr confirm the
 					 * value before use */
 	uint16_t batch_flag;		/* 1 or 2 if batch job (with script),
 					 * 2 indicates retry mode (one retry) */
@@ -718,11 +714,9 @@ struct job_record {
 						  * by sprio command */
 	uint32_t profile;		/* Acct_gather_profile option */
 	uint32_t qos_id;		/* quality of service id */
-	void *qos_ptr;			/* pointer to the quality of
+	slurmdb_qos_rec_t *qos_ptr;	/* pointer to the quality of
 					 * service record used for
-					 * this job, it is
-					 * void* because of interdependencies
-					 * in the header files, confirm the
+					 * this job, confirm the
 					 * value before use */
 	uint8_t reboot;			/* node reboot requested before start */
 	uint16_t restart_cnt;		/* count of restarts */