"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-lease.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-lease.c  (stress-ng-0.12.09.tar.xz):stress-lease.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 189 skipping to change at line 189
/* /*
* stress_lease * stress_lease
* stress fcntl lease activity * stress fcntl lease activity
*/ */
static int stress_lease(const stress_args_t *args) static int stress_lease(const stress_args_t *args)
{ {
char filename[PATH_MAX]; char filename[PATH_MAX];
int ret, fd, status; int ret, fd, status;
pid_t l_pids[MAX_LEASE_BREAKERS]; pid_t l_pids[MAX_LEASE_BREAKERS];
uint64_t i, lease_breakers = DEFAULT_LEASE_BREAKERS; uint64_t i, lease_breakers = DEFAULT_LEASE_BREAKERS;
double t1 = 0.0, t2 = 0.0, dt;
if (!stress_get_setting("lease-breakers", &lease_breakers)) { if (!stress_get_setting("lease-breakers", &lease_breakers)) {
if (g_opt_flags & OPT_FLAGS_MAXIMIZE) if (g_opt_flags & OPT_FLAGS_MAXIMIZE)
lease_breakers = MAX_LEASE_BREAKERS; lease_breakers = MAX_LEASE_BREAKERS;
if (g_opt_flags & OPT_FLAGS_MINIMIZE) if (g_opt_flags & OPT_FLAGS_MINIMIZE)
lease_breakers = MIN_LEASE_BREAKERS; lease_breakers = MIN_LEASE_BREAKERS;
} }
(void)memset(l_pids, 0, sizeof(l_pids)); (void)memset(l_pids, 0, sizeof(l_pids));
skipping to change at line 231 skipping to change at line 232
for (i = 0; i < lease_breakers; i++) { for (i = 0; i < lease_breakers; i++) {
l_pids[i] = stress_lease_spawn(args, filename); l_pids[i] = stress_lease_spawn(args, filename);
if (l_pids[i] < 0) { if (l_pids[i] < 0) {
pr_err("%s: failed to start all the lease breaker process es\n", args->name); pr_err("%s: failed to start all the lease breaker process es\n", args->name);
goto reap; goto reap;
} }
} }
stress_set_proc_state(args->name, STRESS_STATE_RUN); stress_set_proc_state(args->name, STRESS_STATE_RUN);
t1 = stress_time_now();
do { do {
ret = stress_try_lease(args, filename, O_WRONLY | O_APPEND, F_WRL CK); ret = stress_try_lease(args, filename, O_WRONLY | O_APPEND, F_WRL CK);
if (ret != EXIT_SUCCESS) if (ret != EXIT_SUCCESS)
break; break;
ret = stress_try_lease(args, filename, O_RDONLY, F_RDLCK); ret = stress_try_lease(args, filename, O_RDONLY, F_RDLCK);
if (ret != EXIT_SUCCESS) if (ret != EXIT_SUCCESS)
break; break;
} while (keep_stressing(args)); } while (keep_stressing(args));
t2 = stress_time_now();
reap: reap:
stress_set_proc_state(args->name, STRESS_STATE_DEINIT); stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
for (i = 0; i < lease_breakers; i++) { for (i = 0; i < lease_breakers; i++) {
if (l_pids[i]) { if (l_pids[i]) {
(void)kill(l_pids[i], SIGKILL); (void)kill(l_pids[i], SIGKILL);
(void)shim_waitpid(l_pids[i], &status, 0); (void)shim_waitpid(l_pids[i], &status, 0);
} }
} }
(void)unlink(filename); (void)unlink(filename);
(void)stress_temp_dir_rm_args(args); (void)stress_temp_dir_rm_args(args);
pr_dbg("%s: %" PRIu64 " lease sigio interrupts caught\n", args->name, lea se_sigio); pr_dbg("%s: %" PRIu64 " lease sigio interrupts caught\n", args->name, lea se_sigio);
dt = t2 - t1;
if (dt > 0.0) {
stress_misc_stats_set(args->misc_stats, 0, "lease sigio interrupt
s per sec",
(double)lease_sigio / dt);
}
return ret; return ret;
} }
stressor_info_t stress_lease_info = { stressor_info_t stress_lease_info = {
.stressor = stress_lease, .stressor = stress_lease,
.class = CLASS_FILESYSTEM | CLASS_OS, .class = CLASS_FILESYSTEM | CLASS_OS,
.opt_set_funcs = opt_set_funcs, .opt_set_funcs = opt_set_funcs,
.help = help .help = help
}; };
 End of changes. 4 change blocks. 
0 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)