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.h File Reference
#include <linux/blkdev.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>

Go to the source code of this file.

Data Structures

struct  md_rdev
 
struct  md_rdev::badblocks
 
struct  mddev
 
struct  md_personality
 
struct  md_sysfs_entry
 
struct  md_thread
 

Macros

#define MaxSector   (~(sector_t)0)
 
#define MD_MAX_BADBLOCKS   (PAGE_SIZE/8)
 
#define BB_LEN_MASK   (0x00000000000001FFULL)
 
#define BB_OFFSET_MASK   (0x7FFFFFFFFFFFFE00ULL)
 
#define BB_ACK_MASK   (0x8000000000000000ULL)
 
#define BB_MAX_LEN   512
 
#define BB_OFFSET(x)   (((x) & BB_OFFSET_MASK) >> 9)
 
#define BB_LEN(x)   (((x) & BB_LEN_MASK) + 1)
 
#define BB_ACK(x)   (!!((x) & BB_ACK_MASK))
 
#define BB_MAKE(a, l, ack)   (((a)<<9) | ((l)-1) | ((u64)(!!(ack)) << 63))
 
#define MD_CHANGE_DEVS   0 /* Some device status has changed */
 
#define MD_CHANGE_CLEAN   1 /* transition to or from 'clean' */
 
#define MD_CHANGE_PENDING   2 /* switch from 'clean' to 'active' in progress */
 
#define MD_ARRAY_FIRST_USE   3 /* First use of array, needs initialization */
 
#define UNTIL_IOCTL   1
 
#define UNTIL_STOP   2
 
#define MD_RECOVERY_RUNNING   0
 
#define MD_RECOVERY_SYNC   1
 
#define MD_RECOVERY_RECOVER   2
 
#define MD_RECOVERY_INTR   3
 
#define MD_RECOVERY_DONE   4
 
#define MD_RECOVERY_NEEDED   5
 
#define MD_RECOVERY_REQUESTED   6
 
#define MD_RECOVERY_CHECK   7
 
#define MD_RECOVERY_RESHAPE   8
 
#define MD_RECOVERY_FROZEN   9
 
#define rdev_for_each_list(rdev, tmp, head)   list_for_each_entry_safe(rdev, tmp, head, same_set)
 
#define rdev_for_each(rdev, mddev)   list_for_each_entry(rdev, &((mddev)->disks), same_set)
 
#define rdev_for_each_safe(rdev, tmp, mddev)   list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
 
#define rdev_for_each_rcu(rdev, mddev)   list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
 
#define THREAD_WAKEUP   0
 
#define __wait_event_lock_irq(wq, condition, lock, cmd)
 
#define wait_event_lock_irq(wq, condition, lock, cmd)
 

Enumerations

enum  flag_bits {
  Faulty, In_sync, Unmerged, WriteMostly,
  AutoDetected, Blocked, WriteErrorSeen, FaultRecorded,
  BlockedBadBlocks, WantReplacement, Replacement
}
 

Functions

int md_is_badblock (struct badblocks *bb, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors)
 
int rdev_set_badblocks (struct md_rdev *rdev, sector_t s, int sectors, int is_new)
 
int rdev_clear_badblocks (struct md_rdev *rdev, sector_t s, int sectors, int is_new)
 
void md_ack_all_badblocks (struct badblocks *bb)
 
int register_md_personality (struct md_personality *p)
 
int unregister_md_personality (struct md_personality *p)
 
struct md_threadmd_register_thread (void(*run)(struct md_thread *thread), struct mddev *mddev, const char *name)
 
void md_unregister_thread (struct md_thread **threadp)
 
void md_wakeup_thread (struct md_thread *thread)
 
void md_check_recovery (struct mddev *mddev)
 
void md_write_start (struct mddev *mddev, struct bio *bi)
 
void md_write_end (struct mddev *mddev)
 
void md_done_sync (struct mddev *mddev, int blocks, int ok)
 
void md_error (struct mddev *mddev, struct md_rdev *rdev)
 
void md_finish_reshape (struct mddev *mddev)
 
int mddev_congested (struct mddev *mddev, int bits)
 
void md_flush_request (struct mddev *mddev, struct bio *bio)
 
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)
 
void md_do_sync (struct md_thread *thread)
 
void md_new_event (struct mddev *mddev)
 
int md_allow_write (struct mddev *mddev)
 
void md_wait_for_blocked_rdev (struct md_rdev *rdev, struct mddev *mddev)
 
void md_set_array_sectors (struct mddev *mddev, sector_t array_sectors)
 
int md_check_no_bitmap (struct mddev *mddev)
 
int md_integrity_register (struct mddev *mddev)
 
void md_integrity_add_rdev (struct md_rdev *rdev, struct mddev *mddev)
 
int strict_strtoul_scaled (const char *cp, unsigned long *res, int scale)
 
void restore_bitmap_write_access (struct file *file)
 
void mddev_init (struct mddev *mddev)
 
int md_run (struct mddev *mddev)
 
void md_stop (struct mddev *mddev)
 
void md_stop_writes (struct mddev *mddev)
 
int md_rdev_init (struct md_rdev *rdev)
 
void md_rdev_clear (struct md_rdev *rdev)
 
void mddev_suspend (struct mddev *mddev)
 
void mddev_resume (struct mddev *mddev)
 
struct bio * bio_clone_mddev (struct bio *bio, gfp_t gfp_mask, struct mddev *mddev)
 
struct bio * bio_alloc_mddev (gfp_t gfp_mask, int nr_iovecs, struct mddev *mddev)
 
void md_trim_bio (struct bio *bio, int offset, int size)
 
void md_unplug (struct blk_plug_cb *cb, bool from_schedule)
 

Variables

struct attribute_group md_bitmap_group
 

Macro Definition Documentation

#define __wait_event_lock_irq (   wq,
  condition,
  lock,
  cmd 
)
Value:
do { \
wait_queue_t __wait; \
init_waitqueue_entry(&__wait, current); \
add_wait_queue(&wq, &__wait); \
for (;;) { \
set_current_state(TASK_UNINTERRUPTIBLE); \
if (condition) \
break; \
spin_unlock_irq(&lock); \
cmd; \
schedule(); \
spin_lock_irq(&lock); \
} \
current->state = TASK_RUNNING; \
remove_wait_queue(&wq, &__wait); \
} while (0)

Definition at line 554 of file md.h.

#define BB_ACK (   x)    (!!((x) & BB_ACK_MASK))

Definition at line 178 of file md.h.

#define BB_ACK_MASK   (0x8000000000000000ULL)

Definition at line 174 of file md.h.

#define BB_LEN (   x)    (((x) & BB_LEN_MASK) + 1)

Definition at line 177 of file md.h.

#define BB_LEN_MASK   (0x00000000000001FFULL)

Definition at line 172 of file md.h.

#define BB_MAKE (   a,
  l,
  ack 
)    (((a)<<9) | ((l)-1) | ((u64)(!!(ack)) << 63))

Definition at line 179 of file md.h.

#define BB_MAX_LEN   512

Definition at line 175 of file md.h.

#define BB_OFFSET (   x)    (((x) & BB_OFFSET_MASK) >> 9)

Definition at line 176 of file md.h.

#define BB_OFFSET_MASK   (0x7FFFFFFFFFFFFE00ULL)

Definition at line 173 of file md.h.

#define MaxSector   (~(sector_t)0)

Definition at line 27 of file md.h.

#define MD_ARRAY_FIRST_USE   3 /* First use of array, needs initialization */

Definition at line 212 of file md.h.

#define MD_CHANGE_CLEAN   1 /* transition to or from 'clean' */

Definition at line 210 of file md.h.

#define MD_CHANGE_DEVS   0 /* Some device status has changed */

Definition at line 209 of file md.h.

#define MD_CHANGE_PENDING   2 /* switch from 'clean' to 'active' in progress */

Definition at line 211 of file md.h.

#define MD_MAX_BADBLOCKS   (PAGE_SIZE/8)

Definition at line 34 of file md.h.

#define MD_RECOVERY_CHECK   7

Definition at line 320 of file md.h.

#define MD_RECOVERY_DONE   4

Definition at line 317 of file md.h.

#define MD_RECOVERY_FROZEN   9

Definition at line 322 of file md.h.

#define MD_RECOVERY_INTR   3

Definition at line 316 of file md.h.

#define MD_RECOVERY_NEEDED   5

Definition at line 318 of file md.h.

#define MD_RECOVERY_RECOVER   2

Definition at line 315 of file md.h.

#define MD_RECOVERY_REQUESTED   6

Definition at line 319 of file md.h.

#define MD_RECOVERY_RESHAPE   8

Definition at line 321 of file md.h.

#define MD_RECOVERY_RUNNING   0

Definition at line 313 of file md.h.

#define MD_RECOVERY_SYNC   1

Definition at line 314 of file md.h.

#define rdev_for_each (   rdev,
  mddev 
)    list_for_each_entry(rdev, &((mddev)->disks), same_set)

Definition at line 533 of file md.h.

#define rdev_for_each_list (   rdev,
  tmp,
  head 
)    list_for_each_entry_safe(rdev, tmp, head, same_set)

Definition at line 527 of file md.h.

#define rdev_for_each_rcu (   rdev,
  mddev 
)    list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)

Definition at line 539 of file md.h.

#define rdev_for_each_safe (   rdev,
  tmp,
  mddev 
)    list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)

Definition at line 536 of file md.h.

#define THREAD_WAKEUP   0

Definition at line 552 of file md.h.

#define UNTIL_IOCTL   1

Definition at line 227 of file md.h.

#define UNTIL_STOP   2

Definition at line 228 of file md.h.

#define wait_event_lock_irq (   wq,
  condition,
  lock,
  cmd 
)
Value:
do { \
if (condition) \
break; \
__wait_event_lock_irq(wq, condition, lock, cmd); \
} while (0)

Definition at line 573 of file md.h.

Enumeration Type Documentation

enum flag_bits
Enumerator:
Faulty 
In_sync 
Unmerged 
WriteMostly 
AutoDetected 
Blocked 
WriteErrorSeen 
FaultRecorded 
BlockedBadBlocks 
WantReplacement 
Replacement 

Definition at line 129 of file md.h.

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.

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.

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 *thread run,
struct mddev mddev,
const char name 
)
read
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.

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.

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

struct attribute_group md_bitmap_group

Definition at line 2266 of file bitmap.c.