Introduce md_cluster_info
PATCH 6/24 Introduce md_cluster_info
md_cluster_info stores the cluster information in the MD device.
The join() is called when mddev detects it is a clustered device.
The main responsibilities are:
1. Setup a DLM lockspace
2. Setup all initial locks such as super block locks and bitmap lock (will come later)
The leave() clears up the lockspace and all the locks held.
Signed-off-by Goldwyn Rodrigues <[email protected]>
--- drivers/md/bitmap.c | 4 +++ drivers/md/md-cluster.c | 67 +++++++++++++++++++++++++++++++++++++++++++++---- drivers/md/md.h | 8 ++++++ 3 files changed, 74 insertions(+), 5 deletions(-)
drivers/md/bitmap.c +4 -0
@@ -420,6 +420,7 @@ void bitmap_update_sb(struct bitmap *bitmap)/* This might have been changed by a reshape */ sb->sync_size =cpu_to_le64 (bitmap->mddev->resync_max_sectors); sb->chunksize =cpu_to_le32 (bitmap->mddev->bitmap_info.chunksize); + sb->nodes =cpu_to_le32 (bitmap->mddev->bitmap_info.nodes); sb->sectors_reserved =cpu_to_le32 (bitmap->mddev-> bitmap_info.space);kunmap_atomic (sb);
@@ -531,6 +532,7 @@ static int bitmap_read_sb(struct bitmap *bitmap)bitmap_super_t *sb;unsigned long chunksize, daemon_sleep, write_behind;unsigned long long events; +int nodes =0 ;unsigned long sectors_reserved =0 ;int err = -EINVAL ;struct page *sb_page;
@@ -570,6 +572,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) daemon_sleep =le32_to_cpu (sb->daemon_sleep) *HZ ; write_behind =le32_to_cpu (sb->write_behind); sectors_reserved =le32_to_cpu (sb->sectors_reserved); + nodes =le32_to_cpu (sb->nodes);/* verify that the bitmap-specific fields are valid */ if (sb->magic !=cpu_to_le32 (BITMAP_MAGIC ))
@@ -630,6 +633,7 @@ out_no_sb: bitmap->mddev->bitmap_info.chunksize = chunksize; bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; bitmap->mddev->bitmap_info.max_write_behind = write_behind; + bitmap->mddev->bitmap_info.nodes = nodes;if (bitmap->mddev->bitmap_info.space ==0 || bitmap->mddev->bitmap_info.space > sectors_reserved) bitmap->mddev->bitmap_info.space = sectors_reserved;
drivers/md/md-cluster.c +62 -5
99 lines not on this page · raw message
drivers/md/md.h +8 -0
@@ -203,6 +203,8 @@ extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors, int is_new);extern void md_ack_all_badblocks (struct badblocks *bb); +struct md_cluster_info ; +struct mddev {void *private;struct md_personality *pers;
@@ -420,6 +422,7 @@ struct mddev {unsigned long daemon_sleep;/* how many jiffies between updates? */ unsigned long max_write_behind;/* write-behind mode */ int external; +int nodes; } bitmap_info;atomic_t max_corr_read_errors;/* max read retries */
@@ -438,6 +441,7 @@ struct mddev {struct work_struct flush_work;struct work_struct event_work;/* used by dm to report failure event */ void (*sync_super)(struct mddev *mddev,struct md_rdev *rdev); +struct md_cluster_info *cluster_info; };
@@ -634,4 +638,8 @@ static inline int mddev_check_plugged(struct mddev *mddev) sizeof(struct blk_plug_cb)); }extern struct md_cluster_operations *md_cluster_ops; +static inline int mddev_is_clustered (struct mddev *mddev) +{ +return mddev->cluster_info && mddev->bitmap_info.nodes >1 ; +}#endif /* _MD_MD_H */
Signature · 1 line
2.1.2