diff options
author | Artur Paszkiewicz <artur.paszkiewicz@intel.com> | 2017-03-09 03:59:58 -0500 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-16 19:55:54 -0400 |
commit | ff875738edd44e3bc892d378deacc50bccc9d70c (patch) | |
tree | 9c831895576861c9ae3c30fca2702d673b6f4eaf /drivers/md/raid5-log.h | |
parent | ea0213e0c7cc1c1b52badf27bd7db4f50a67baaa (diff) |
raid5: separate header for log functions
Move raid5-cache declarations from raid5.h to raid5-log.h, add inline
wrappers for functions which will be shared with ppl and use them in
raid5 core instead of direct calls to raid5-cache.
Remove unused parameter from r5c_cache_data(), move two duplicated
pr_debug() calls to r5l_init_log().
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 | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h new file mode 100644 index 000000000000..2da4bd3bbd79 --- /dev/null +++ b/drivers/md/raid5-log.h | |||
@@ -0,0 +1,81 @@ | |||
1 | #ifndef _RAID5_LOG_H | ||
2 | #define _RAID5_LOG_H | ||
3 | |||
4 | extern int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev); | ||
5 | extern void r5l_exit_log(struct r5conf *conf); | ||
6 | extern int r5l_write_stripe(struct r5l_log *log, struct stripe_head *head_sh); | ||
7 | extern void r5l_write_stripe_run(struct r5l_log *log); | ||
8 | extern void r5l_flush_stripe_to_raid(struct r5l_log *log); | ||
9 | extern void r5l_stripe_write_finished(struct stripe_head *sh); | ||
10 | extern int r5l_handle_flush_request(struct r5l_log *log, struct bio *bio); | ||
11 | extern void r5l_quiesce(struct r5l_log *log, int state); | ||
12 | extern bool r5l_log_disk_error(struct r5conf *conf); | ||
13 | extern bool r5c_is_writeback(struct r5l_log *log); | ||
14 | extern int | ||
15 | r5c_try_caching_write(struct r5conf *conf, struct stripe_head *sh, | ||
16 | struct stripe_head_state *s, int disks); | ||
17 | extern void | ||
18 | r5c_finish_stripe_write_out(struct r5conf *conf, struct stripe_head *sh, | ||
19 | struct stripe_head_state *s); | ||
20 | extern void r5c_release_extra_page(struct stripe_head *sh); | ||
21 | extern void r5c_use_extra_page(struct stripe_head *sh); | ||
22 | extern void r5l_wake_reclaim(struct r5l_log *log, sector_t space); | ||
23 | extern void r5c_handle_cached_data_endio(struct r5conf *conf, | ||
24 | struct stripe_head *sh, int disks, struct bio_list *return_bi); | ||
25 | extern int r5c_cache_data(struct r5l_log *log, struct stripe_head *sh); | ||
26 | extern void r5c_make_stripe_write_out(struct stripe_head *sh); | ||
27 | extern void r5c_flush_cache(struct r5conf *conf, int num); | ||
28 | extern void r5c_check_stripe_cache_usage(struct r5conf *conf); | ||
29 | extern void r5c_check_cached_full_stripe(struct r5conf *conf); | ||
30 | extern struct md_sysfs_entry r5c_journal_mode; | ||
31 | extern void r5c_update_on_rdev_error(struct mddev *mddev); | ||
32 | extern bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect); | ||
33 | |||
34 | static inline int log_stripe(struct stripe_head *sh, struct stripe_head_state *s) | ||
35 | { | ||
36 | struct r5conf *conf = sh->raid_conf; | ||
37 | |||
38 | if (conf->log) { | ||
39 | if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) { | ||
40 | /* writing out phase */ | ||
41 | if (s->waiting_extra_page) | ||
42 | return 0; | ||
43 | return r5l_write_stripe(conf->log, sh); | ||
44 | } else if (test_bit(STRIPE_LOG_TRAPPED, &sh->state)) { | ||
45 | /* caching phase */ | ||
46 | return r5c_cache_data(conf->log, sh); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | return -EAGAIN; | ||
51 | } | ||
52 | |||
53 | static inline void log_stripe_write_finished(struct stripe_head *sh) | ||
54 | { | ||
55 | struct r5conf *conf = sh->raid_conf; | ||
56 | |||
57 | if (conf->log) | ||
58 | r5l_stripe_write_finished(sh); | ||
59 | } | ||
60 | |||
61 | static inline void log_write_stripe_run(struct r5conf *conf) | ||
62 | { | ||
63 | if (conf->log) | ||
64 | r5l_write_stripe_run(conf->log); | ||
65 | } | ||
66 | |||
67 | static inline void log_exit(struct r5conf *conf) | ||
68 | { | ||
69 | if (conf->log) | ||
70 | r5l_exit_log(conf); | ||
71 | } | ||
72 | |||
73 | static inline int log_init(struct r5conf *conf, struct md_rdev *journal_dev) | ||
74 | { | ||
75 | if (journal_dev) | ||
76 | return r5l_init_log(conf, journal_dev); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | #endif | ||