From: Jonathan Brassow Date: Tue, 7 Jun 2011 22:51:30 +0000 (-0500) Subject: MD: add sync_super to mddev_t struct X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=076f968b37f0232d883749da8f5031df5dea7ade;p=linux-beck.git 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 Signed-off-by: NeilBrown --- 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[] = { }, }; +static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev) +{ + if (mddev->sync_super) { + mddev->sync_super(mddev, rdev); + return; + } + + BUG_ON(mddev->major_version >= ARRAY_SIZE(super_types)); + + super_types[mddev->major_version].sync_super(mddev, rdev); +} + static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) { mdk_rdev_t *rdev, *rdev2; @@ -2171,8 +2183,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) /* Don't update this superblock */ rdev->sb_loaded = 2; } else { - super_types[mddev->major_version]. - sync_super(mddev, rdev); + sync_super(mddev, rdev); rdev->sb_loaded = 1; } } diff --git a/drivers/md/md.h b/drivers/md/md.h index 0b1fd3f1d85b..5e35535ab7c3 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -330,6 +330,7 @@ struct mddev_s atomic_t flush_pending; struct work_struct flush_work; struct work_struct event_work; /* used by dm to report failure event */ + void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev); };