Merge branch 'improvement/fix-warnings-if-NDEBUG-enabled' of https://github.com/dpron...
authorJens Axboe <axboe@kernel.dk>
Mon, 3 Jul 2023 14:20:01 +0000 (08:20 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Jul 2023 14:20:01 +0000 (08:20 -0600)
* 'improvement/fix-warnings-if-NDEBUG-enabled' of https://github.com/dpronin/fio:
  fixed compiler warnings if NDEBUG enabled in test code
  fixed compiler warnings if NDEBUG enabled in core code

1  2 
backend.c
helper_thread.c
io_u.c
ioengines.c
rate-submit.c
server.c
t/read-to-pipe-async.c
zbd.c

diff --cc backend.c
Simple merge
diff --cc helper_thread.c
Simple merge
diff --cc io_u.c
Simple merge
diff --cc ioengines.c
Simple merge
diff --cc rate-submit.c
index 103a80aa13f8e671f06d2b568f7fa8bc1cc342df,bc076e869f56ad11cd7f346195ba64c902ed6ad9..6f6d15bd660fbaa1ed504530edd3f3f6b38822aa
@@@ -27,10 -31,13 +30,13 @@@ static void check_overlap(struct io_u *
         * threads as they assess overlap.
         */
        res = pthread_mutex_lock(&overlap_check);
-       assert(res == 0);
+       if (fio_unlikely(res != 0)) {
+               log_err("failed to lock overlap check mutex, err: %i:%s", errno, strerror(errno));
+               abort();
+       }
  
  retry:
 -      for_each_td(td, i) {
 +      for_each_td(td) {
                if (td->runstate <= TD_SETTING_UP ||
                    td->runstate >= TD_FINISHING ||
                    !td->o.serialize_overlap ||
                        continue;
  
                res = pthread_mutex_unlock(&overlap_check);
-               assert(res == 0);
+               if (fio_unlikely(res != 0)) {
+                       log_err("failed to unlock overlap check mutex, err: %i:%s", errno, strerror(errno));
+                       abort();
+               }
                res = pthread_mutex_lock(&overlap_check);
-               assert(res == 0);
+               if (fio_unlikely(res != 0)) {
+                       log_err("failed to lock overlap check mutex, err: %i:%s", errno, strerror(errno));
+                       abort();
+               }
                goto retry;
 -      }
 +      } end_for_each();
  }
  
  static int io_workqueue_fn(struct submit_worker *sw,
diff --cc server.c
Simple merge
index 569fc62ae66f535d96a63ed01a78ec705a25a405,76c64ab9c4e9221faffa3eab445ba9c596a1f5c1..de98d03228f3e3f52134bfda535152512d6a0f94
@@@ -241,14 -257,16 +257,14 @@@ static void *writer_fn(void *data
  {
        struct writer_thread *wt = data;
        struct work_item *work;
-       unsigned int seq = 1;
+       int seq = 1;
  
        work = NULL;
-       while (!wt->thread.exit || !flist_empty(&wt->list)) {
+       while (!(seq < 0) && (!wt->thread.exit || !flist_empty(&wt->list))) {
                pthread_mutex_lock(&wt->thread.lock);
  
 -              if (work) {
 +              if (work)
                        flist_add_tail(&work->list, &wt->done_list);
 -                      work = NULL;
 -              }
        
                work = find_seq(wt, seq);
                if (work)
diff --cc zbd.c
Simple merge