aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2011-06-07 18:51:30 -0400
committerNeilBrown <neilb@suse.de>2011-06-08 01:11:31 -0400
commit076f968b37f0232d883749da8f5031df5dea7ade (patch)
treeaa1c58756c3754abe657be36b4720a16d5c41858 /drivers/md/md.c
parent1ed7242e591af7e233234d483f12d33818b189d9 (diff)
MD: add sync_super to mddev_t struct
Add the 'sync_super' function pointer to MD array structure (struct mddev_s) If device-mapper (dm-raid.c) is to define its own on-disk superblock and be able to load it, there must still be a way for MD to initiate superblock updates. The simplest way to make this happen is to provide a pointer in the MD array structure that can be set by device-mapper (or other module) with a function to do this. If the function has been set, it will be used; otherwise, the method with be looked up via 'super_types' as usual. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d5385188c445..9160463b5f68 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1753,6 +1753,18 @@ static struct super_type super_types[] = {
1753 }, 1753 },
1754}; 1754};
1755 1755
1756static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev)
1757{
1758 if (mddev->sync_super) {
1759 mddev->sync_super(mddev, rdev);
1760 return;
1761 }
1762
1763 BUG_ON(mddev->major_version >= ARRAY_SIZE(super_types));
1764
1765 super_types[mddev->major_version].sync_super(mddev, rdev);
1766}
1767
1756static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) 1768static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2)
1757{ 1769{
1758 mdk_rdev_t *rdev, *rdev2; 1770 mdk_rdev_t *rdev, *rdev2;
@@ -2171,8 +2183,7 @@ static void sync_sbs(mddev_t * mddev, int nospares)
2171 /* Don't update this superblock */ 2183 /* Don't update this superblock */
2172 rdev->sb_loaded = 2; 2184 rdev->sb_loaded = 2;
2173 } else { 2185 } else {
2174 super_types[mddev->major_version]. 2186 sync_super(mddev, rdev);
2175 sync_super(mddev, rdev);
2176 rdev->sb_loaded = 1; 2187 rdev->sb_loaded = 1;
2177 } 2188 }
2178 } 2189 }