[PATCH] w1: Fixed 64bit compilation warning.
[linux-2.6/verdex.git] / include / linux / raid / raid10.h
blob60708789c8f978711fe2cf43ce008ef425c1faaa
1 #ifndef _RAID10_H
2 #define _RAID10_H
4 #include <linux/raid/md.h>
6 typedef struct mirror_info mirror_info_t;
8 struct mirror_info {
9 mdk_rdev_t *rdev;
10 sector_t head_position;
13 typedef struct r10bio_s r10bio_t;
15 struct r10_private_data_s {
16 mddev_t *mddev;
17 mirror_info_t *mirrors;
18 int raid_disks;
19 int working_disks;
20 spinlock_t device_lock;
22 /* geometry */
23 int near_copies; /* number of copies layed out raid0 style */
24 int far_copies; /* number of copies layed out
25 * at large strides across drives
27 int copies; /* near_copies * far_copies.
28 * must be <= raid_disks
30 sector_t stride; /* distance between far copies.
31 * This is size / far_copies
34 int chunk_shift; /* shift from chunks to sectors */
35 sector_t chunk_mask;
37 struct list_head retry_list;
38 /* for use when syncing mirrors: */
40 spinlock_t resync_lock;
41 int nr_pending;
42 int barrier;
43 sector_t next_resync;
45 wait_queue_head_t wait_idle;
46 wait_queue_head_t wait_resume;
48 mempool_t *r10bio_pool;
49 mempool_t *r10buf_pool;
52 typedef struct r10_private_data_s conf_t;
55 * this is the only point in the RAID code where we violate
56 * C type safety. mddev->private is an 'opaque' pointer.
58 #define mddev_to_conf(mddev) ((conf_t *) mddev->private)
61 * this is our 'private' RAID10 bio.
63 * it contains information about what kind of IO operations were started
64 * for this RAID10 operation, and about their status:
67 struct r10bio_s {
68 atomic_t remaining; /* 'have we finished' count,
69 * used from IRQ handlers
71 sector_t sector; /* virtual sector number */
72 int sectors;
73 unsigned long state;
74 mddev_t *mddev;
76 * original bio going to /dev/mdx
78 struct bio *master_bio;
80 * if the IO is in READ direction, then this is where we read
82 int read_slot;
84 struct list_head retry_list;
86 * if the IO is in WRITE direction, then multiple bios are used,
87 * one for each copy.
88 * When resyncing we also use one for each copy.
89 * When reconstructing, we use 2 bios, one for read, one for write.
90 * We choose the number when they are allocated.
92 struct {
93 struct bio *bio;
94 sector_t addr;
95 int devnum;
96 } devs[0];
99 /* bits for r10bio.state */
100 #define R10BIO_Uptodate 0
101 #define R10BIO_IsSync 1
102 #define R10BIO_IsRecover 2
103 #endif