OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [LINUX_2_4_26_OR32/] [linux/] [linux-2.4/] [include/] [linux/] [raid/] [raid1.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _RAID1_H
2
#define _RAID1_H
3
 
4
#include <linux/raid/md.h>
5
 
6
struct mirror_info {
7
        int             number;
8
        int             raid_disk;
9
        kdev_t          dev;
10
        int             sect_limit;
11
        int             head_position;
12
 
13
        /*
14
         * State bits:
15
         */
16
        int             operational;
17
        int             write_only;
18
        int             spare;
19
 
20
        int             used_slot;
21
};
22
 
23
struct raid1_private_data {
24
        mddev_t                 *mddev;
25
        struct mirror_info      mirrors[MD_SB_DISKS];
26
        int                     nr_disks;
27
        int                     raid_disks;
28
        int                     working_disks;
29
        int                     last_used;
30
        unsigned long           next_sect;
31
        int                     sect_count;
32
        mdk_thread_t            *thread, *resync_thread;
33
        int                     resync_mirrors;
34
        struct mirror_info      *spare;
35
        md_spinlock_t           device_lock;
36
 
37
        /* buffer pool */
38
        /* buffer_heads that we have pre-allocated have b_pprev -> &freebh
39
         * and are linked into a stack using b_next
40
         * raid1_bh that are pre-allocated have R1BH_PreAlloc set.
41
         * All these variable are protected by device_lock
42
         */
43
        struct buffer_head      *freebh;
44
        int                     freebh_cnt;     /* how many are on the list */
45
        int                     freebh_blocked;
46
        struct raid1_bh         *freer1;
47
        int                     freer1_blocked;
48
        int                     freer1_cnt;
49
        struct raid1_bh         *freebuf;       /* each bh_req has a page allocated */
50
        md_wait_queue_head_t    wait_buffer;
51
 
52
        /* for use when syncing mirrors: */
53
        unsigned long   start_active, start_ready,
54
                start_pending, start_future;
55
        int     cnt_done, cnt_active, cnt_ready,
56
                cnt_pending, cnt_future;
57
        int     phase;
58
        int     window;
59
        md_wait_queue_head_t    wait_done;
60
        md_wait_queue_head_t    wait_ready;
61
        md_spinlock_t           segment_lock;
62
};
63
 
64
typedef struct raid1_private_data raid1_conf_t;
65
 
66
/*
67
 * this is the only point in the RAID code where we violate
68
 * C type safety. mddev->private is an 'opaque' pointer.
69
 */
70
#define mddev_to_conf(mddev) ((raid1_conf_t *) mddev->private)
71
 
72
/*
73
 * this is our 'private' 'collective' RAID1 buffer head.
74
 * it contains information about what kind of IO operations were started
75
 * for this RAID1 operation, and about their status:
76
 */
77
 
78
struct raid1_bh {
79
        atomic_t                remaining; /* 'have we finished' count,
80
                                            * used from IRQ handlers
81
                                            */
82
        int                     cmd;
83
        unsigned long           state;
84
        mddev_t                 *mddev;
85
        struct buffer_head      *master_bh;
86
        struct buffer_head      *mirror_bh_list;
87
        struct buffer_head      bh_req;
88
        struct raid1_bh         *next_r1;       /* next for retry or in free list */
89
};
90
/* bits for raid1_bh.state */
91
#define R1BH_Uptodate   1
92
#define R1BH_SyncPhase  2
93
#define R1BH_PreAlloc   3       /* this was pre-allocated, add to free list */
94
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.