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()
This commit is contained in:
Jens Axboe 2019-02-04 11:44:43 -07:00
commit 09e5740370
2 changed files with 3 additions and 6 deletions

View File

@ -96,8 +96,7 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks)
int i, cnt; int i, cnt;
bool discard_supported = false; bool discard_supported = false;
conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info), conf = kzalloc(struct_size(conf, disks, raid_disks), GFP_KERNEL);
GFP_KERNEL);
if (!conf) if (!conf)
return NULL; return NULL;

View File

@ -1603,11 +1603,9 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
return; return;
} }
set_bit(Blocked, &rdev->flags); 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++; mddev->degraded++;
set_bit(Faulty, &rdev->flags); set_bit(Faulty, &rdev->flags);
} else
set_bit(Faulty, &rdev->flags);
spin_unlock_irqrestore(&conf->device_lock, flags); spin_unlock_irqrestore(&conf->device_lock, flags);
/* /*
* if recovery is running, make sure it aborts. * if recovery is running, make sure it aborts.