Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
md.c File Reference
#include <linux/kthread.h>
#include <linux/blkdev.h>
#include <linux/sysctl.h>
#include <linux/seq_file.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/hdreg.h>
#include <linux/proc_fs.h>
#include <linux/random.h>
#include <linux/module.h>
#include <linux/reboot.h>
#include <linux/file.h>
#include <linux/compat.h>
#include <linux/delay.h>
#include <linux/raid/md_p.h>
#include <linux/raid/md_u.h>
#include <linux/slab.h>
#include "md.h"
#include "bitmap.h"

Go to the source code of this file.

Data Structures

struct  super_type
 
struct  rdev_sysfs_entry
 
struct  detected_devices_node
 

Macros

#define MD_BUG(x...)   { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
 
#define MD_DEFAULT_MAX_CORRECTED_READ_ERRORS   20
 
#define for_each_mddev(_mddev, _tmp)
 
#define SYNC_MARKS   10
 
#define SYNC_MARK_STEP   (3*HZ)
 
#define DO_DEBUG   1
 

Enumerations

enum  array_state {
  clear, inactive, suspended, readonly,
  read_auto, clean, active, write_pending,
  active_idle, bad_word
}
 

Functions

struct bio * bio_alloc_mddev (gfp_t gfp_mask, int nr_iovecs, struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (bio_alloc_mddev)
 
struct bio * bio_clone_mddev (struct bio *bio, gfp_t gfp_mask, struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (bio_clone_mddev)
 
void md_trim_bio (struct bio *bio, int offset, int size)
 
 EXPORT_SYMBOL_GPL (md_trim_bio)
 
void md_new_event (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (md_new_event)
 
void mddev_suspend (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (mddev_suspend)
 
void mddev_resume (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (mddev_resume)
 
int mddev_congested (struct mddev *mddev, int bits)
 
 EXPORT_SYMBOL (mddev_congested)
 
void md_flush_request (struct mddev *mddev, struct bio *bio)
 
 EXPORT_SYMBOL (md_flush_request)
 
void md_unplug (struct blk_plug_cb *cb, bool from_schedule)
 
 EXPORT_SYMBOL (md_unplug)
 
void mddev_init (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (mddev_init)
 
void md_rdev_clear (struct md_rdev *rdev)
 
 EXPORT_SYMBOL_GPL (md_rdev_clear)
 
void md_super_write (struct mddev *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page)
 
void md_super_wait (struct mddev *mddev)
 
int sync_page_io (struct md_rdev *rdev, sector_t sector, int size, struct page *page, int rw, bool metadata_op)
 
 EXPORT_SYMBOL_GPL (sync_page_io)
 
int md_check_no_bitmap (struct mddev *mddev)
 
 EXPORT_SYMBOL (md_check_no_bitmap)
 
int md_integrity_register (struct mddev *mddev)
 
 EXPORT_SYMBOL (md_integrity_register)
 
void md_integrity_add_rdev (struct md_rdev *rdev, struct mddev *mddev)
 
 EXPORT_SYMBOL (md_integrity_add_rdev)
 
void md_autodetect_dev (dev_t dev)
 
int md_rdev_init (struct md_rdev *rdev)
 
 EXPORT_SYMBOL_GPL (md_rdev_init)
 
int strict_strtoul_scaled (const char *cp, unsigned long *res, int scale)
 
int md_run (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (md_run)
 
void restore_bitmap_write_access (struct file *file)
 
void md_stop_writes (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (md_stop_writes)
 
void md_stop (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (md_stop)
 
void md_set_array_sectors (struct mddev *mddev, sector_t array_sectors)
 
 EXPORT_SYMBOL (md_set_array_sectors)
 
void md_wakeup_thread (struct md_thread *thread)
 
struct md_threadmd_register_thread (void(*run)(struct md_thread *), struct mddev *mddev, const char *name)
 
void md_unregister_thread (struct md_thread **threadp)
 
void md_error (struct mddev *mddev, struct md_rdev *rdev)
 
int register_md_personality (struct md_personality *p)
 
int unregister_md_personality (struct md_personality *p)
 
void md_done_sync (struct mddev *mddev, int blocks, int ok)
 
void md_write_start (struct mddev *mddev, struct bio *bi)
 
void md_write_end (struct mddev *mddev)
 
int md_allow_write (struct mddev *mddev)
 
 EXPORT_SYMBOL_GPL (md_allow_write)
 
void md_do_sync (struct md_thread *thread)
 
 EXPORT_SYMBOL_GPL (md_do_sync)
 
void md_check_recovery (struct mddev *mddev)
 
void md_wait_for_blocked_rdev (struct md_rdev *rdev, struct mddev *mddev)
 
 EXPORT_SYMBOL (md_wait_for_blocked_rdev)
 
void md_finish_reshape (struct mddev *mddev)
 
 EXPORT_SYMBOL (md_finish_reshape)
 
int md_is_badblock (struct badblocks *bb, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors)
 
 EXPORT_SYMBOL_GPL (md_is_badblock)
 
int rdev_set_badblocks (struct md_rdev *rdev, sector_t s, int sectors, int is_new)
 
 EXPORT_SYMBOL_GPL (rdev_set_badblocks)
 
int rdev_clear_badblocks (struct md_rdev *rdev, sector_t s, int sectors, int is_new)
 
 EXPORT_SYMBOL_GPL (rdev_clear_badblocks)
 
void md_ack_all_badblocks (struct badblocks *bb)
 
 EXPORT_SYMBOL_GPL (md_ack_all_badblocks)
 
 subsys_initcall (md_init)
 
 module_exit (md_exit)
 
 module_param_call (start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR)
 
 module_param (start_dirty_degraded, int, S_IRUGO|S_IWUSR)
 
 module_param_call (new_array, add_named_array, NULL, NULL, S_IWUSR)
 
 EXPORT_SYMBOL (register_md_personality)
 
 EXPORT_SYMBOL (unregister_md_personality)
 
 EXPORT_SYMBOL (md_error)
 
 EXPORT_SYMBOL (md_done_sync)
 
 EXPORT_SYMBOL (md_write_start)
 
 EXPORT_SYMBOL (md_write_end)
 
 EXPORT_SYMBOL (md_register_thread)
 
 EXPORT_SYMBOL (md_unregister_thread)
 
 EXPORT_SYMBOL (md_wakeup_thread)
 
 EXPORT_SYMBOL (md_check_recovery)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DESCRIPTION ("MD RAID framework")
 
 MODULE_ALIAS ("md")
 
 MODULE_ALIAS_BLOCKDEV_MAJOR (MD_MAJOR)
 

Variables

int mdp_major = 0
 

Macro Definition Documentation

#define DO_DEBUG   1

Definition at line 8374 of file md.c.

#define for_each_mddev (   _mddev,
  _tmp 
)
Value:
\
for (({ spin_lock(&all_mddevs_lock); \
_tmp = all_mddevs.next; \
_mddev = NULL;}); \
({ if (_tmp != &all_mddevs) \
mddev_get(list_entry(_tmp, struct mddev, all_mddevs));\
spin_unlock(&all_mddevs_lock); \
if (_mddev) mddev_put(_mddev); \
_mddev = list_entry(_tmp, struct mddev, all_mddevs); \
_tmp != &all_mddevs;}); \
({ spin_lock(&all_mddevs_lock); \
_tmp = _tmp->next;}) \
)

Definition at line 275 of file md.c.

#define MD_BUG (   x...)    { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }

Definition at line 75 of file md.c.

#define MD_DEFAULT_MAX_CORRECTED_READ_ERRORS   20

Definition at line 82 of file md.c.

#define SYNC_MARK_STEP   (3*HZ)

Definition at line 7283 of file md.c.

#define SYNC_MARKS   10

Definition at line 7282 of file md.c.

Enumeration Type Documentation

Enumerator:
clear 
inactive 
suspended 
readonly 
read_auto 
clean 
active 
write_pending 
active_idle 
bad_word 

Definition at line 3828 of file md.c.

Function Documentation

struct bio* bio_alloc_mddev ( gfp_t  gfp_mask,
int  nr_iovecs,
struct mddev mddev 
)
read

Definition at line 158 of file md.c.

struct bio* bio_clone_mddev ( struct bio *  bio,
gfp_t  gfp_mask,
struct mddev mddev 
)
read

Definition at line 173 of file md.c.

EXPORT_SYMBOL ( mddev_congested  )
EXPORT_SYMBOL ( md_flush_request  )
EXPORT_SYMBOL ( md_unplug  )
EXPORT_SYMBOL ( md_check_no_bitmap  )
EXPORT_SYMBOL ( md_integrity_register  )
EXPORT_SYMBOL ( md_integrity_add_rdev  )
EXPORT_SYMBOL ( md_set_array_sectors  )
EXPORT_SYMBOL ( md_wait_for_blocked_rdev  )
EXPORT_SYMBOL ( md_finish_reshape  )
EXPORT_SYMBOL ( register_md_personality  )
EXPORT_SYMBOL ( unregister_md_personality  )
EXPORT_SYMBOL ( md_error  )
EXPORT_SYMBOL ( md_done_sync  )
EXPORT_SYMBOL ( md_write_start  )
EXPORT_SYMBOL ( md_write_end  )
EXPORT_SYMBOL ( md_register_thread  )
EXPORT_SYMBOL ( md_unregister_thread  )
EXPORT_SYMBOL ( md_wakeup_thread  )
EXPORT_SYMBOL ( md_check_recovery  )
EXPORT_SYMBOL_GPL ( bio_alloc_mddev  )
EXPORT_SYMBOL_GPL ( bio_clone_mddev  )
EXPORT_SYMBOL_GPL ( md_trim_bio  )
EXPORT_SYMBOL_GPL ( md_new_event  )
EXPORT_SYMBOL_GPL ( mddev_suspend  )
EXPORT_SYMBOL_GPL ( mddev_resume  )
EXPORT_SYMBOL_GPL ( mddev_init  )
EXPORT_SYMBOL_GPL ( md_rdev_clear  )
EXPORT_SYMBOL_GPL ( sync_page_io  )
EXPORT_SYMBOL_GPL ( md_rdev_init  )
EXPORT_SYMBOL_GPL ( md_run  )
EXPORT_SYMBOL_GPL ( md_stop_writes  )
EXPORT_SYMBOL_GPL ( md_stop  )
EXPORT_SYMBOL_GPL ( md_allow_write  )
EXPORT_SYMBOL_GPL ( md_do_sync  )
EXPORT_SYMBOL_GPL ( md_is_badblock  )
EXPORT_SYMBOL_GPL ( rdev_set_badblocks  )
EXPORT_SYMBOL_GPL ( rdev_clear_badblocks  )
EXPORT_SYMBOL_GPL ( md_ack_all_badblocks  )
void md_ack_all_badblocks ( struct badblocks *  bb)

Definition at line 8300 of file md.c.

int md_allow_write ( struct mddev mddev)

Definition at line 7252 of file md.c.

void md_autodetect_dev ( dev_t  dev)

Definition at line 8511 of file md.c.

int md_check_no_bitmap ( struct mddev mddev)

Definition at line 1002 of file md.c.

void md_check_recovery ( struct mddev mddev)

Definition at line 7734 of file md.c.

void md_do_sync ( struct md_thread thread)

Definition at line 7284 of file md.c.

void md_done_sync ( struct mddev mddev,
int  blocks,
int  ok 
)

Definition at line 7180 of file md.c.

void md_error ( struct mddev mddev,
struct md_rdev rdev 
)

Definition at line 6772 of file md.c.

void md_finish_reshape ( struct mddev mddev)

Definition at line 7906 of file md.c.

void md_flush_request ( struct mddev mddev,
struct bio *  bio 
)

Definition at line 450 of file md.c.

void md_integrity_add_rdev ( struct md_rdev rdev,
struct mddev mddev 
)

Definition at line 2045 of file md.c.

int md_integrity_register ( struct mddev mddev)

Definition at line 1998 of file md.c.

int md_is_badblock ( struct badblocks *  bb,
sector_t  s,
int  sectors,
sector_t first_bad,
int bad_sectors 
)

Definition at line 7947 of file md.c.

void md_new_event ( struct mddev mddev)

Definition at line 244 of file md.c.

void md_rdev_clear ( struct md_rdev rdev)

Definition at line 743 of file md.c.

int md_rdev_init ( struct md_rdev rdev)

Definition at line 3193 of file md.c.

struct md_thread* md_register_thread ( void(*)(struct md_thread *)  run,
struct mddev mddev,
const char name 
)
read

Definition at line 6730 of file md.c.

int md_run ( struct mddev mddev)

Definition at line 4947 of file md.c.

void md_set_array_sectors ( struct mddev mddev,
sector_t  array_sectors 
)

Definition at line 6105 of file md.c.

void md_stop ( struct mddev mddev)

Definition at line 5308 of file md.c.

void md_stop_writes ( struct mddev mddev)

Definition at line 5289 of file md.c.

void md_super_wait ( struct mddev mddev)

Definition at line 799 of file md.c.

void md_super_write ( struct mddev mddev,
struct md_rdev rdev,
sector_t  sector,
int  size,
struct page page 
)

Definition at line 778 of file md.c.

void md_trim_bio ( struct bio *  bio,
int  offset,
int  size 
)

Definition at line 183 of file md.c.

void md_unplug ( struct blk_plug_cb *  cb,
bool  from_schedule 
)

Definition at line 464 of file md.c.

void md_unregister_thread ( struct md_thread **  threadp)

Definition at line 6755 of file md.c.

void md_wait_for_blocked_rdev ( struct md_rdev rdev,
struct mddev mddev 
)

Definition at line 7895 of file md.c.

void md_wakeup_thread ( struct md_thread thread)

Definition at line 6721 of file md.c.

void md_write_end ( struct mddev mddev)

Definition at line 7233 of file md.c.

void md_write_start ( struct mddev mddev,
struct bio *  bi 
)

Definition at line 7198 of file md.c.

int mddev_congested ( struct mddev mddev,
int  bits 
)

Definition at line 374 of file md.c.

void mddev_init ( struct mddev mddev)

Definition at line 509 of file md.c.

void mddev_resume ( struct mddev mddev)

Definition at line 362 of file md.c.

void mddev_suspend ( struct mddev mddev)

Definition at line 350 of file md.c.

MODULE_ALIAS ( "md"  )
MODULE_ALIAS_BLOCKDEV_MAJOR ( MD_MAJOR  )
MODULE_DESCRIPTION ( "MD RAID framework"  )
module_exit ( md_exit  )

Definition at line 8588 of file md.c.

MODULE_LICENSE ( "GPL"  )
module_param ( start_dirty_degraded  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param_call ( start_ro  ,
set_ro  ,
get_ro  ,
NULL  ,
S_IRUSR S_IWUSR 
)
module_param_call ( new_array  ,
add_named_array  ,
NULL  ,
NULL  ,
S_IWUSR   
)
int rdev_clear_badblocks ( struct md_rdev rdev,
sector_t  s,
int  sectors,
int  is_new 
)

Definition at line 8283 of file md.c.

int rdev_set_badblocks ( struct md_rdev rdev,
sector_t  s,
int  sectors,
int  is_new 
)

Definition at line 8168 of file md.c.

int register_md_personality ( struct md_personality p)

Definition at line 7118 of file md.c.

void restore_bitmap_write_access ( struct file file)

Definition at line 5214 of file md.c.

int strict_strtoul_scaled ( const char cp,
unsigned long res,
int  scale 
)

Definition at line 3378 of file md.c.

subsys_initcall ( md_init  )
int sync_page_io ( struct md_rdev rdev,
sector_t  sector,
int  size,
struct page page,
int  rw,
bool  metadata_op 
)

Definition at line 817 of file md.c.

int unregister_md_personality ( struct md_personality p)

Definition at line 7127 of file md.c.

Variable Documentation

int mdp_major = 0

Definition at line 4792 of file md.c.