Skip to content

Commit

Permalink
mxqd: Move df_scratch up one level
Browse files Browse the repository at this point in the history
Hoist up df_scratch one calllevel.
  • Loading branch information
donald committed Mar 20, 2022
1 parent 7dc503a commit 1a33ee8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,14 +1428,12 @@ static int can_start_job(struct mxq_group_list *group, unsigned long df_scratch,
return 1;
}

unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start)
unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start, unsigned long df_scratch)
{
struct mxq_server *server;
struct mxq_group_list *glist;
struct mxq_group *group;

unsigned long df_scratch;

assert(ulist);
assert(ulist->server);
assert(ulist->groups);
Expand All @@ -1449,8 +1447,6 @@ unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start)
mx_log_debug(" user=%s(%d) slots_to_start=%ld :: trying to start jobs for user.",
group->user_name, group->user_uid, slots_to_start);

df_scratch=mx_df(MXQ_JOB_TMPDIR_FS "/.");

for (glist = ulist->groups; glist ; glist = glist->next) {

group = &glist->group;
Expand Down Expand Up @@ -1494,6 +1490,7 @@ long start_user_with_least_running_global_slot_count(struct mxq_server *server)
unsigned long slots_free;
unsigned long global_slots_per_user;
int waiting = 0;
unsigned long df_scratch;

assert(server);

Expand All @@ -1508,6 +1505,8 @@ long start_user_with_least_running_global_slot_count(struct mxq_server *server)

global_slots_per_user = server->global_slots_running / server->user_cnt;

df_scratch=mx_df(MXQ_JOB_TMPDIR_FS "/.");

for (ulist = server->users; ulist; ulist = ulist->next) {
/* if a previous users is waiting for free resources, don't start jobs
* for later users. */
Expand All @@ -1516,7 +1515,7 @@ long start_user_with_least_running_global_slot_count(struct mxq_server *server)
* database to WAITING, which is just informational. */
return -1;

slots_started = start_user(ulist, slots_free);
slots_started = start_user(ulist, slots_free, df_scratch);
if (slots_started)
return slots_started;

Expand Down

0 comments on commit 1a33ee8

Please sign in to comment.