Skip to content

Commit ce550c2

Browse files
committed
md/raid1: add documentation to r1_private_data_s data structure.
There wasn't much and it is inconsistent. Also rearrange fields to keep related fields together. Reported-by: Aapo Laine <aapo.laine@shiftmail.org> Signed-off-by: NeilBrown <neilb@suse.de>
1 parent 2dba6a9 commit ce550c2

1 file changed

Lines changed: 42 additions & 17 deletions

File tree

‎drivers/md/raid1.h‎

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,67 @@ struct r1_private_data_s {
2828
mddev_t *mddev;
2929
mirror_info_t *mirrors;
3030
int raid_disks;
31+
32+
/* When choose the best device for a read (read_balance())
33+
* we try to keep sequential reads one the same device
34+
* using 'last_used' and 'next_seq_sect'
35+
*/
3136
int last_used;
3237
sector_t next_seq_sect;
38+
/* During resync, read_balancing is only allowed on the part
39+
* of the array that has been resynced. 'next_resync' tells us
40+
* where that is.
41+
*/
42+
sector_t next_resync;
43+
3344
spinlock_t device_lock;
3445

46+
/* list of 'r1bio_t' that need to be processed by raid1d, whether
47+
* to retry a read, writeout a resync or recovery block, or
48+
* anything else.
49+
*/
3550
struct list_head retry_list;
36-
/* queue pending writes and submit them on unplug */
37-
struct bio_list pending_bio_list;
3851

39-
/* for use when syncing mirrors: */
52+
/* queue pending writes to be submitted on unplug */
53+
struct bio_list pending_bio_list;
4054

55+
/* for use when syncing mirrors:
56+
* We don't allow both normal IO and resync/recovery IO at
57+
* the same time - resync/recovery can only happen when there
58+
* is no other IO. So when either is active, the other has to wait.
59+
* See more details description in raid1.c near raise_barrier().
60+
*/
61+
wait_queue_head_t wait_barrier;
4162
spinlock_t resync_lock;
4263
int nr_pending;
4364
int nr_waiting;
4465
int nr_queued;
4566
int barrier;
46-
sector_t next_resync;
47-
int fullsync; /* set to 1 if a full sync is needed,
48-
* (fresh device added).
49-
* Cleared when a sync completes.
50-
*/
51-
int recovery_disabled; /* when the same as
52-
* mddev->recovery_disabled
53-
* we don't allow recovery
54-
* to be attempted as we
55-
* expect a read error
56-
*/
5767

58-
wait_queue_head_t wait_barrier;
68+
/* Set to 1 if a full sync is needed, (fresh device added).
69+
* Cleared when a sync completes.
70+
*/
71+
int fullsync;
5972

60-
struct pool_info *poolinfo;
73+
/* When the same as mddev->recovery_disabled we don't allow
74+
* recovery to be attempted as we expect a read error.
75+
*/
76+
int recovery_disabled;
6177

62-
struct page *tmppage;
6378

79+
/* poolinfo contains information about the content of the
80+
* mempools - it changes when the array grows or shrinks
81+
*/
82+
struct pool_info *poolinfo;
6483
mempool_t *r1bio_pool;
6584
mempool_t *r1buf_pool;
6685

86+
/* temporary buffer to synchronous IO when attempting to repair
87+
* a read error.
88+
*/
89+
struct page *tmppage;
90+
91+
6792
/* When taking over an array from a different personality, we store
6893
* the new thread here until we fully activate the array.
6994
*/

0 commit comments

Comments
 (0)