Signed-off-by: Jens Axboe <axboe@fb.com>
+static void drop_data(struct iolog_flush_data *data, int refs)
+{
+ if (!refs) {
+ free(data);
+ pthread_mutex_destroy(&data->lock);
+ pthread_cond_destroy(&data->cv);
+ }
+}
+
/*
* Invoked from our compress helper thread, when logging would have exceeded
* the specified memory limitation. Compresses the previously stored
/*
* Invoked from our compress helper thread, when logging would have exceeded
* the specified memory limitation. Compresses the previously stored
pthread_cond_signal(&data->cv);
refs = --data->refs;
pthread_mutex_unlock(&data->lock);
pthread_cond_signal(&data->cv);
refs = --data->refs;
pthread_mutex_unlock(&data->lock);
- if (!refs)
- free(data);
} else
free(data);
return ret;
} else
free(data);
return ret;
pthread_cond_wait(&data->cv, &data->lock);
refs = --data->refs;
pthread_mutex_unlock(&data->lock);
pthread_cond_wait(&data->cv, &data->lock);
refs = --data->refs;
pthread_mutex_unlock(&data->lock);
- if (!refs)
- free(data);