Hi, On 8/16/19 3:40 PM, Guilherme G. Piccoli wrote:
+static bool linear_is_missing_dev(struct mddev *mddev) +{ + struct md_rdev *rdev; + static int already_missing; + int def_disks, work_disks = 0; + + def_disks = mddev->raid_disks; + rdev_for_each(rdev, mddev) + if (rdev->bdev->bd_disk->flags & GENHD_FL_UP) + work_disks++; + + if (unlikely(def_disks - work_disks)) {
If my understanding is correct, after enter the branch,
+ if (already_missing < (def_disks - work_disks)) {
the above is always true since already_missing should be '0', right? If so, maybe the above checking is pointless.
+ already_missing = def_disks - work_disks; + pr_warn("md: %s: linear array has %d missing/failed members\n", + mdname(mddev), already_missing); + } + return true; + } + + already_missing = 0; + return false; +} +.
I'd suggest something like, just FYI. bool already_missing = false; int missing_disks; missing_disks = def_disks - work_disks; if (unlikely(missing_disks)) { already_missing = true; pr_warn("md: %s: linear array has %d missing/failed members\n", mdname(mddev), missing_disks); } return already_missing; Thanks, Guoqing