raid5-ppl: PPL support for disks with write-back cache enabled
[sfrench/cifs-2.6.git] / drivers / md / raid5-log.h
index 284578b0a349c7acf5d6398b19fa4196854cdff0..0c76bcedfc1cbd8b0af33008652095e3862f22c9 100644 (file)
@@ -32,6 +32,7 @@ extern struct md_sysfs_entry r5c_journal_mode;
 extern void r5c_update_on_rdev_error(struct mddev *mddev,
                                     struct md_rdev *rdev);
 extern bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect);
+extern int r5l_start(struct r5l_log *log);
 
 extern struct dma_async_tx_descriptor *
 ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu,
@@ -42,6 +43,7 @@ extern int ppl_write_stripe(struct r5conf *conf, struct stripe_head *sh);
 extern void ppl_write_stripe_run(struct r5conf *conf);
 extern void ppl_stripe_write_finished(struct stripe_head *sh);
 extern int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add);
+extern void ppl_quiesce(struct r5conf *conf, int quiesce);
 
 static inline bool raid5_has_ppl(struct r5conf *conf)
 {
@@ -87,6 +89,34 @@ static inline void log_write_stripe_run(struct r5conf *conf)
                ppl_write_stripe_run(conf);
 }
 
+static inline void log_flush_stripe_to_raid(struct r5conf *conf)
+{
+       if (conf->log)
+               r5l_flush_stripe_to_raid(conf->log);
+       else if (raid5_has_ppl(conf))
+               ppl_write_stripe_run(conf);
+}
+
+static inline int log_handle_flush_request(struct r5conf *conf, struct bio *bio)
+{
+       int ret = -ENODEV;
+
+       if (conf->log)
+               ret = r5l_handle_flush_request(conf->log, bio);
+       else if (raid5_has_ppl(conf))
+               ret = 0;
+
+       return ret;
+}
+
+static inline void log_quiesce(struct r5conf *conf, int quiesce)
+{
+       if (conf->log)
+               r5l_quiesce(conf->log, quiesce);
+       else if (raid5_has_ppl(conf))
+               ppl_quiesce(conf, quiesce);
+}
+
 static inline void log_exit(struct r5conf *conf)
 {
        if (conf->log)