diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-02-04 11:44:43 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-02-04 11:44:43 -0700 |
commit | 09e57403705d31b76994bc5ff0d816528fdf06c3 (patch) | |
tree | 218eae3e11f7761d39ff296305ccbbded3f8bd4d | |
parent | e960f71a3dfb44b777c96d231c622c724a7a755c (diff) | |
parent | ebda52fa1be73952ec603b1fad685ce86ccb5ee6 (diff) | |
download | linux-09e57403705d31b76994bc5ff0d816528fdf06c3.tar.bz2 |
Merge branch 'md-next' of https://github.com/liu-song-6/linux into for-5.1/block
Pull MD changes for 5.1 from Song.
* 'md-next' of https://github.com/liu-song-6/linux:
raid1: simplify raid1_error function
md-linear: use struct_size() in kzalloc()
-rw-r--r-- | drivers/md/md-linear.c | 3 | ||||
-rw-r--r-- | drivers/md/raid1.c | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c index d45c697c0ebe..5998d78aa189 100644 --- a/drivers/md/md-linear.c +++ b/drivers/md/md-linear.c @@ -96,8 +96,7 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks) int i, cnt; bool discard_supported = false; - conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info), - GFP_KERNEL); + conf = kzalloc(struct_size(conf, disks, raid_disks), GFP_KERNEL); if (!conf) return NULL; diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 1d54109071cc..7e63ccc4ae7b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1603,11 +1603,9 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev) return; } set_bit(Blocked, &rdev->flags); - if (test_and_clear_bit(In_sync, &rdev->flags)) { + if (test_and_clear_bit(In_sync, &rdev->flags)) mddev->degraded++; - set_bit(Faulty, &rdev->flags); - } else - set_bit(Faulty, &rdev->flags); + set_bit(Faulty, &rdev->flags); spin_unlock_irqrestore(&conf->device_lock, flags); /* * if recovery is running, make sure it aborts. |