#ifndef _MD_MD_H
#define _MD_MD_H
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/badblocks.h>
#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <trace/events/block.h>
#include "md-cluster.h"
#define MaxSector …
#define MD_FAILFAST …
enum sync_action { … };
struct serial_in_rdev { … };
struct md_rdev { … };
enum flag_bits { … };
static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
sector_t *first_bad, int *bad_sectors)
{ … }
static inline int rdev_has_badblock(struct md_rdev *rdev, sector_t s,
int sectors)
{ … }
extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
int is_new);
extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
int is_new);
struct md_cluster_info;
enum mddev_flags { … };
enum mddev_sb_flags { … };
#define NR_SERIAL_INFOS …
struct serial_info { … };
enum { … };
struct mddev { … };
enum recovery_flags { … };
enum md_ro_state { … };
static inline bool md_is_rdwr(struct mddev *mddev)
{ … }
static inline bool reshape_interrupted(struct mddev *mddev)
{ … }
static inline int __must_check mddev_lock(struct mddev *mddev)
{ … }
static inline void mddev_lock_nointr(struct mddev *mddev)
{ … }
static inline int mddev_trylock(struct mddev *mddev)
{ … }
extern void mddev_unlock(struct mddev *mddev);
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
{ … }
static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
{ … }
struct md_personality
{ … };
struct md_sysfs_entry { … };
extern const struct attribute_group md_bitmap_group;
static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name)
{ … }
static inline void sysfs_notify_dirent_safe(struct kernfs_node *sd)
{ … }
static inline char * mdname (struct mddev * mddev)
{ … }
static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev)
{ … }
static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev)
{ … }
#define rdev_for_each_list(rdev, tmp, head) …
#define rdev_for_each(rdev, mddev) …
#define rdev_for_each_safe(rdev, tmp, mddev) …
#define rdev_for_each_rcu(rdev, mddev) …
struct md_thread { … };
struct md_io_clone { … };
#define THREAD_WAKEUP …
static inline void safe_put_page(struct page *p)
{ … }
extern int register_md_personality(struct md_personality *p);
extern int unregister_md_personality(struct md_personality *p);
extern int register_md_cluster_operations(const struct md_cluster_operations *ops,
struct module *module);
extern int unregister_md_cluster_operations(void);
extern int md_setup_cluster(struct mddev *mddev, int nodes);
extern void md_cluster_stop(struct mddev *mddev);
extern struct md_thread *md_register_thread(
void (*run)(struct md_thread *thread),
struct mddev *mddev,
const char *name);
extern void md_unregister_thread(struct mddev *mddev, struct md_thread __rcu **threadp);
extern void md_wakeup_thread(struct md_thread __rcu *thread);
extern void md_check_recovery(struct mddev *mddev);
extern void md_reap_sync_thread(struct mddev *mddev);
extern enum sync_action md_sync_action(struct mddev *mddev);
extern enum sync_action md_sync_action_by_name(const char *page);
extern const char *md_sync_action_name(enum sync_action action);
extern void md_write_start(struct mddev *mddev, struct bio *bi);
extern void md_write_inc(struct mddev *mddev, struct bio *bi);
extern void md_write_end(struct mddev *mddev);
extern void md_done_sync(struct mddev *mddev, int blocks, int ok);
extern void md_error(struct mddev *mddev, struct md_rdev *rdev);
extern void md_finish_reshape(struct mddev *mddev);
void md_submit_discard_bio(struct mddev *mddev, struct md_rdev *rdev,
struct bio *bio, sector_t start, sector_t size);
void md_account_bio(struct mddev *mddev, struct bio **bio);
void md_free_cloned_bio(struct bio *bio);
extern bool __must_check md_flush_request(struct mddev *mddev, struct bio *bio);
extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
sector_t sector, int size, struct page *page);
extern int md_super_wait(struct mddev *mddev);
extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
struct page *page, blk_opf_t opf, bool metadata_op);
extern void md_do_sync(struct md_thread *thread);
extern void md_new_event(void);
extern void md_allow_write(struct mddev *mddev);
extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev);
extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors);
extern int md_check_no_bitmap(struct mddev *mddev);
extern int md_integrity_register(struct mddev *mddev);
extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
extern int mddev_init(struct mddev *mddev);
extern void mddev_destroy(struct mddev *mddev);
void md_init_stacking_limits(struct queue_limits *lim);
struct mddev *md_alloc(dev_t dev, char *name);
void mddev_put(struct mddev *mddev);
extern int md_run(struct mddev *mddev);
extern int md_start(struct mddev *mddev);
extern void md_stop(struct mddev *mddev);
extern void md_stop_writes(struct mddev *mddev);
extern int md_rdev_init(struct md_rdev *rdev);
extern void md_rdev_clear(struct md_rdev *rdev);
extern bool md_handle_request(struct mddev *mddev, struct bio *bio);
extern int mddev_suspend(struct mddev *mddev, bool interruptible);
extern void mddev_resume(struct mddev *mddev);
extern void md_idle_sync_thread(struct mddev *mddev);
extern void md_frozen_sync_thread(struct mddev *mddev);
extern void md_unfrozen_sync_thread(struct mddev *mddev);
extern void md_reload_sb(struct mddev *mddev, int raid_disk);
extern void md_update_sb(struct mddev *mddev, int force);
extern void mddev_create_serial_pool(struct mddev *mddev, struct md_rdev *rdev);
extern void mddev_destroy_serial_pool(struct mddev *mddev,
struct md_rdev *rdev);
struct md_rdev *md_find_rdev_nr_rcu(struct mddev *mddev, int nr);
struct md_rdev *md_find_rdev_rcu(struct mddev *mddev, dev_t dev);
static inline bool is_rdev_broken(struct md_rdev *rdev)
{ … }
static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
{ … }
extern const struct md_cluster_operations *md_cluster_ops;
static inline int mddev_is_clustered(struct mddev *mddev)
{ … }
static inline void mddev_clear_unsupported_flags(struct mddev *mddev,
unsigned long unsupported_flags)
{ … }
static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio)
{ … }
static inline int mddev_suspend_and_lock(struct mddev *mddev)
{ … }
static inline void mddev_suspend_and_lock_nointr(struct mddev *mddev)
{ … }
static inline void mddev_unlock_and_resume(struct mddev *mddev)
{ … }
struct mdu_array_info_s;
struct mdu_disk_info_s;
extern int mdp_major;
extern struct workqueue_struct *md_bitmap_wq;
void md_autostart_arrays(int part);
int md_set_array_info(struct mddev *mddev, struct mdu_array_info_s *info);
int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info);
int do_md_run(struct mddev *mddev);
#define MDDEV_STACK_INTEGRITY …
int mddev_stack_rdev_limits(struct mddev *mddev, struct queue_limits *lim,
unsigned int flags);
int mddev_stack_new_rdev(struct mddev *mddev, struct md_rdev *rdev);
void mddev_update_io_opt(struct mddev *mddev, unsigned int nr_stripes);
extern const struct block_device_operations md_fops;
static inline bool mddev_is_dm(struct mddev *mddev)
{ … }
static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio,
sector_t sector)
{ … }
#define mddev_add_trace_msg(mddev, fmt, args...) …
#endif