diff options
author | NeilBrown <neilb@suse.de> | 2012-05-21 23:54:30 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-05-21 23:54:30 -0400 |
commit | 545c87957f4d53867b62921625f36df8c4b1bc08 (patch) | |
tree | 52dc839ac828f7742efbad83cfbe5f35f11a04d6 /drivers/md/md.c | |
parent | 96e67703e71f4b3cc32b747dbb6158ec74d01e19 (diff) |
md: dm-raid should call helper function to clear rdev.
dm-raid currently open-codes the freeing of some members of
and rdev. It is more maintainable to have it call common code
from md.c which does this for all call-sites.
So remove free_disk_sb to md_rdev_clear, export it, and use it in
dm-raid.c
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 8fe1abf1b89c..d557e557ff8f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -803,7 +803,7 @@ static int alloc_disk_sb(struct md_rdev * rdev) | |||
803 | return 0; | 803 | return 0; |
804 | } | 804 | } |
805 | 805 | ||
806 | static void free_disk_sb(struct md_rdev * rdev) | 806 | void md_rdev_clear(struct md_rdev *rdev) |
807 | { | 807 | { |
808 | if (rdev->sb_page) { | 808 | if (rdev->sb_page) { |
809 | put_page(rdev->sb_page); | 809 | put_page(rdev->sb_page); |
@@ -817,7 +817,7 @@ static void free_disk_sb(struct md_rdev * rdev) | |||
817 | rdev->bb_page = NULL; | 817 | rdev->bb_page = NULL; |
818 | } | 818 | } |
819 | } | 819 | } |
820 | 820 | EXPORT_SYMBOL_GPL(md_rdev_clear); | |
821 | 821 | ||
822 | static void super_written(struct bio *bio, int error) | 822 | static void super_written(struct bio *bio, int error) |
823 | { | 823 | { |
@@ -2244,7 +2244,7 @@ static void export_rdev(struct md_rdev * rdev) | |||
2244 | bdevname(rdev->bdev,b)); | 2244 | bdevname(rdev->bdev,b)); |
2245 | if (rdev->mddev) | 2245 | if (rdev->mddev) |
2246 | MD_BUG(); | 2246 | MD_BUG(); |
2247 | free_disk_sb(rdev); | 2247 | md_rdev_clear(rdev); |
2248 | #ifndef MODULE | 2248 | #ifndef MODULE |
2249 | if (test_bit(AutoDetected, &rdev->flags)) | 2249 | if (test_bit(AutoDetected, &rdev->flags)) |
2250 | md_autodetect_dev(rdev->bdev->bd_dev); | 2250 | md_autodetect_dev(rdev->bdev->bd_dev); |
@@ -3324,7 +3324,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe | |||
3324 | abort_free: | 3324 | abort_free: |
3325 | if (rdev->bdev) | 3325 | if (rdev->bdev) |
3326 | unlock_rdev(rdev); | 3326 | unlock_rdev(rdev); |
3327 | free_disk_sb(rdev); | 3327 | md_rdev_clear(rdev); |
3328 | kfree(rdev->badblocks.page); | 3328 | kfree(rdev->badblocks.page); |
3329 | kfree(rdev); | 3329 | kfree(rdev); |
3330 | return ERR_PTR(err); | 3330 | return ERR_PTR(err); |