diff options
author | Artur Paszkiewicz <artur.paszkiewicz@intel.com> | 2017-03-09 09:59:59 +0100 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-17 00:55:54 +0100 |
commit | 3418d036c81dcb604b7c7c71b209d5890a8418aa (patch) | |
tree | d02a31103e09f82858bf149ebcb511e12ed6065a /drivers/md/raid5-log.h | |
parent | raid5: separate header for log functions (diff) | |
download | linux-3418d036c81dcb604b7c7c71b209d5890a8418aa.tar.xz linux-3418d036c81dcb604b7c7c71b209d5890a8418aa.zip |
raid5-ppl: Partial Parity Log write logging implementation
Implement the calculation of partial parity for a stripe and PPL write
logging functionality. The description of PPL is added to the
documentation. More details can be found in the comments in raid5-ppl.c.
Attach a page for holding the partial parity data to stripe_head.
Allocate it only if mddev has the MD_HAS_PPL flag set.
Partial parity is the xor of not modified data chunks of a stripe and is
calculated as follows:
- reconstruct-write case:
xor data from all not updated disks in a stripe
- read-modify-write case:
xor old data and parity from all updated disks in a stripe
Implement it using the async_tx API and integrate into raid_run_ops().
It must be called when we still have access to old data, so do it when
STRIPE_OP_BIODRAIN is set, but before ops_run_prexor5(). The result is
stored into sh->ppl_page.
Partial parity is not meaningful for full stripe write and is not stored
in the log or used for recovery, so don't attempt to calculate it when
stripe has STRIPE_FULL_WRITE.
Put the PPL metadata structures to md_p.h because userspace tools
(mdadm) will also need to read/write PPL.
Warn about using PPL with enabled disk volatile write-back cache for
now. It can be removed once disk cache flushing before writing PPL is
implemented.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid5-log.h')
-rw-r--r-- | drivers/md/raid5-log.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h index 2da4bd3bbd79..a67fb58513b9 100644 --- a/drivers/md/raid5-log.h +++ b/drivers/md/raid5-log.h @@ -31,6 +31,20 @@ extern struct md_sysfs_entry r5c_journal_mode; extern void r5c_update_on_rdev_error(struct mddev *mddev); extern bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect); +extern struct dma_async_tx_descriptor * +ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, + struct dma_async_tx_descriptor *tx); +extern int ppl_init_log(struct r5conf *conf); +extern void ppl_exit_log(struct r5conf *conf); +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); + +static inline bool raid5_has_ppl(struct r5conf *conf) +{ + return test_bit(MD_HAS_PPL, &conf->mddev->flags); +} + static inline int log_stripe(struct stripe_head *sh, struct stripe_head_state *s) { struct r5conf *conf = sh->raid_conf; @@ -45,6 +59,8 @@ static inline int log_stripe(struct stripe_head *sh, struct stripe_head_state *s /* caching phase */ return r5c_cache_data(conf->log, sh); } + } else if (raid5_has_ppl(conf)) { + return ppl_write_stripe(conf, sh); } return -EAGAIN; @@ -56,24 +72,32 @@ static inline void log_stripe_write_finished(struct stripe_head *sh) if (conf->log) r5l_stripe_write_finished(sh); + else if (raid5_has_ppl(conf)) + ppl_stripe_write_finished(sh); } static inline void log_write_stripe_run(struct r5conf *conf) { if (conf->log) r5l_write_stripe_run(conf->log); + else if (raid5_has_ppl(conf)) + ppl_write_stripe_run(conf); } static inline void log_exit(struct r5conf *conf) { if (conf->log) r5l_exit_log(conf); + else if (raid5_has_ppl(conf)) + ppl_exit_log(conf); } static inline int log_init(struct r5conf *conf, struct md_rdev *journal_dev) { if (journal_dev) return r5l_init_log(conf, journal_dev); + else if (raid5_has_ppl(conf)) + return ppl_init_log(conf); return 0; } |