]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/clock.c
Update upstream source from tag 'v1.6.3'
[bcachefs-tools-debian] / libbcachefs / clock.c
index f3ffdbc38485baacb66cdd39097e4018440b0fd0..3636444511064b51e5a004b953eacf94e7c70d12 100644 (file)
@@ -109,7 +109,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock,
        if (cpu_timeout != MAX_SCHEDULE_TIMEOUT)
                mod_timer(&wait.cpu_timer, cpu_timeout + jiffies);
 
-       while (1) {
+       do {
                set_current_state(TASK_INTERRUPTIBLE);
                if (kthread && kthread_should_stop())
                        break;
@@ -119,10 +119,10 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock,
 
                schedule();
                try_to_freeze();
-       }
+       } while (0);
 
        __set_current_state(TASK_RUNNING);
-       del_singleshot_timer_sync(&wait.cpu_timer);
+       del_timer_sync(&wait.cpu_timer);
        destroy_timer_on_stack(&wait.cpu_timer);
        bch2_io_timer_del(clock, &wait.io_timer);
 }
@@ -157,6 +157,7 @@ void bch2_io_timers_to_text(struct printbuf *out, struct io_clock *clock)
        unsigned long now;
        unsigned i;
 
+       out->atomic++;
        spin_lock(&clock->timer_lock);
        now = atomic64_read(&clock->now);
 
@@ -165,6 +166,7 @@ void bch2_io_timers_to_text(struct printbuf *out, struct io_clock *clock)
                       clock->timers.data[i]->fn,
                       clock->timers.data[i]->expire - now);
        spin_unlock(&clock->timer_lock);
+       --out->atomic;
 }
 
 void bch2_io_clock_exit(struct io_clock *clock)
@@ -182,10 +184,10 @@ int bch2_io_clock_init(struct io_clock *clock)
 
        clock->pcpu_buf = alloc_percpu(*clock->pcpu_buf);
        if (!clock->pcpu_buf)
-               return -ENOMEM;
+               return -BCH_ERR_ENOMEM_io_clock_init;
 
        if (!init_heap(&clock->timers, NR_IO_TIMERS, GFP_KERNEL))
-               return -ENOMEM;
+               return -BCH_ERR_ENOMEM_io_clock_init;
 
        return 0;
 }