struct delay_class read;
struct delay_class write;
+ struct delay_class flush;
int argc;
};
dm_put_device(ti, dc->read.dev);
if (dc->write.dev)
dm_put_device(ti, dc->write.dev);
+ if (dc->flush.dev)
+ dm_put_device(ti, dc->flush.dev);
mutex_destroy(&dc->timer_lock);
struct delay_c *dc;
int ret;
- if (argc != 3 && argc != 6) {
- ti->error = "Requires exactly 3 or 6 arguments";
+ if (argc != 3 && argc != 6 && argc != 9) {
+ ti->error = "Requires exactly 3, 6 or 9 arguments";
return -EINVAL;
}
if (argc == 3) {
ret = delay_class_ctr(ti, &dc->write, argv);
+ if (ret)
+ goto bad;
+ ret = delay_class_ctr(ti, &dc->flush, argv);
if (ret)
goto bad;
goto out;
ret = delay_class_ctr(ti, &dc->write, argv + 3);
if (ret)
goto bad;
+ if (argc == 6) {
+ ret = delay_class_ctr(ti, &dc->flush, argv + 3);
+ if (ret)
+ goto bad;
+ goto out;
+ }
+
+ ret = delay_class_ctr(ti, &dc->flush, argv + 6);
+ if (ret)
+ goto bad;
out:
dc->kdelayd_wq = alloc_workqueue("kdelayd", WQ_MEM_RECLAIM, 0);
struct dm_delay_info *delayed = dm_per_bio_data(bio, sizeof(struct dm_delay_info));
if (bio_data_dir(bio) == WRITE) {
- c = &dc->write;
+ if (unlikely(bio->bi_opf & REQ_PREFLUSH))
+ c = &dc->flush;
+ else
+ c = &dc->write;
} else {
c = &dc->read;
}
switch (type) {
case STATUSTYPE_INFO:
- DMEMIT("%u %u", dc->read.ops, dc->write.ops);
+ DMEMIT("%u %u %u", dc->read.ops, dc->write.ops, dc->flush.ops);
break;
case STATUSTYPE_TABLE:
DMEMIT(" ");
DMEMIT_DELAY_CLASS(&dc->write);
}
+ if (dc->argc >= 9) {
+ DMEMIT(" ");
+ DMEMIT_DELAY_CLASS(&dc->flush);
+ }
break;
}
}
ret = fn(ti, dc->write.dev, dc->write.start, ti->len, data);
if (ret)
goto out;
+ ret = fn(ti, dc->flush.dev, dc->flush.start, ti->len, data);
+ if (ret)
+ goto out;
out:
return ret;