Signed-off-by: Jens Axboe <axboe@fb.com>
* if the queue is full, we MUST reap at least 1 event
*/
min_evts = min(td->o.iodepth_batch_complete_min, td->cur_depth);
* if the queue is full, we MUST reap at least 1 event
*/
min_evts = min(td->o.iodepth_batch_complete_min, td->cur_depth);
- if ((full && !min_evts) || !td->o.iodepth_batch_complete_min)
+ if ((full && !min_evts) || !td->o.iodepth_batch_complete_min)
min_evts = 1;
if (time && (__should_check_rate(td, DDIR_READ) ||
min_evts = 1;
if (time && (__should_check_rate(td, DDIR_READ) ||
#include "lib/axmap.h"
#include "err.h"
#include "lib/pow2.h"
#include "lib/axmap.h"
#include "err.h"
#include "lib/pow2.h"
struct io_completion_data {
int nr; /* input */
struct io_completion_data {
int nr; /* input */
min_write = min(min_write, left);
if (perc) {
min_write = min(min_write, left);
if (perc) {
- this_write = min(min_write, td->o.compress_chunk);
- if (!this_write)
- this_write = min_write;
+ this_write = min_not_zero(min_write,
+ td->o.compress_chunk);
fill_random_buf_percentage(rs, buf, perc,
this_write, this_write,
fill_random_buf_percentage(rs, buf, perc,
this_write, this_write,
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
- len = min(len, sizeof(buffer) - 1);
- return buf_output_add(buf, buffer, len);
+ return buf_output_add(buf, buffer, min(len, sizeof(buffer) - 1));
}
int log_info_flush(void)
}
int log_info_flush(void)
_x > _y ? _x : _y; })
#endif
_x > _y ? _x : _y; })
#endif
+#define min_not_zero(x, y) ({ \
+ typeof(x) __x = (x); \
+ typeof(y) __y = (y); \
+ __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
+