Skip to content

Commit

Permalink
stress-sigxfsz: add some UNLIKELY branch hints
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
  • Loading branch information
ColinIanKing committed Jan 29, 2025
1 parent bb6c649 commit 9869651
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stress-sigxfsz.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static int stress_sigxfsz(stress_args_t *args)

limit.rlim_cur = stress_mwc32modn(max_sz);
if (setrlimit(RLIMIT_FSIZE, &limit) < 0) {
if (errno == EINVAL) {
if (LIKELY(errno == EINVAL)) {
max_sz >>= 1;
if (max_sz > 512)
continue;
Expand All @@ -104,7 +104,7 @@ static int stress_sigxfsz(stress_args_t *args)
#if defined(HAVE_PWRITE)
wret = pwrite(fd, buffer, sizeof(buffer), (off_t)limit.rlim_cur);
#else
if (lseek(fd, (off_t)limit.rlim_cur, SEEK_SET) < 0) {
if (UNLIKELY(lseek(fd, (off_t)limit.rlim_cur, SEEK_SET) < 0)) {
pr_inf("%s: seek to start of file failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
rc = EXIT_FAILURE;
Expand Down

0 comments on commit 9869651

Please sign in to comment.