6 #include <asm/atomic.h>
18 struct stripe_head
*hash_next
, **hash_pprev
; /* hash pointers */
19 struct stripe_head
*free_next
; /* pool of free sh's */
20 struct buffer_head
*buffer_pool
; /* pool of free buffers */
21 struct buffer_head
*bh_pool
; /* pool of free bh's */
22 struct raid5_data
*raid_conf
;
23 struct buffer_head
*bh_old
[MD_SB_DISKS
]; /* disk image */
24 struct buffer_head
*bh_new
[MD_SB_DISKS
]; /* buffers of the MD device (present in buffer cache) */
25 struct buffer_head
*bh_copy
[MD_SB_DISKS
]; /* copy on write of bh_new (bh_new can change from under us) */
26 struct buffer_head
*bh_req
[MD_SB_DISKS
]; /* copy of bh_new (only the buffer heads), queued to the lower levels */
27 int cmd_new
[MD_SB_DISKS
]; /* READ/WRITE for new */
28 int new[MD_SB_DISKS
]; /* buffer added since the last handle_stripe() */
29 unsigned long sector
; /* sector of this row */
30 int size
; /* buffers size */
31 int pd_idx
; /* parity disk index */
32 int nr_pending
; /* nr of pending cmds */
33 unsigned long state
; /* state flags */
34 int cmd
; /* stripe cmd */
35 int count
; /* nr of waiters */
36 int write_method
; /* reconstruct-write / read-modify-write */
37 int phase
; /* PHASE_BEGIN, ..., PHASE_COMPLETE */
38 wait_queue_head_t wait
; /* processes waiting for this stripe */
45 #define PHASE_READ_OLD 1
48 #define PHASE_COMPLETE 4
54 #define RECONSTRUCT_WRITE 1
55 #define READ_MODIFY_WRITE 2
60 #define STRIPE_LOCKED 0
61 #define STRIPE_ERROR 1
67 #define STRIPE_WRITE 1
71 struct stripe_head
**stripe_hashtbl
;
73 struct md_thread
*thread
, *resync_thread
;
74 struct disk_info disks
[MD_SB_DISKS
];
75 struct disk_info
*spare
;
77 int chunk_size
, level
, algorithm
;
78 int raid_disks
, working_disks
, failed_disks
;
80 unsigned long next_sector
;
82 struct stripe_head
*next_free_stripe
;
87 int nr_hashed_stripes
;
88 int nr_locked_stripes
;
89 int nr_pending_stripes
;
90 int nr_cached_stripes
;
96 struct stripe_head
*free_sh_list
;
97 wait_queue_head_t wait_for_stripe
;
103 * Our supported algorithms
105 #define ALGORITHM_LEFT_ASYMMETRIC 0
106 #define ALGORITHM_RIGHT_ASYMMETRIC 1
107 #define ALGORITHM_LEFT_SYMMETRIC 2
108 #define ALGORITHM_RIGHT_SYMMETRIC 3