Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c29744e authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer
Browse files

dm raid: simplify rs_get_progress()



No need to calculate the reshaping progress because
mddev->curr_resync_completed holds it.

Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent dc15b943
Loading
Loading
Loading
Loading
+3 −20
Original line number Diff line number Diff line
@@ -3399,25 +3399,8 @@ static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery,
		set_bit(RT_FLAG_RS_IN_SYNC, &rs->runtime_flags);

	} else {
		/* Reshape is relative to the array size */
		if (test_bit(MD_RECOVERY_RESHAPE, &recovery)) {
			r = mddev->reshape_position;
			if (r != MaxSector) {
				/* Got to reverse on backward reshape */
				if (mddev->reshape_backwards)
					r = mddev->array_sectors - r;

				/* Divide by # of data stripes unless raid1 */
				if (!rs_is_raid1(rs))
					sector_div(r, mddev_data_stripes(rs));
			}

		/*
		 * Sync/recover is relative to the component device size.
		 *
		 * MD_RECOVERY_NEEDED for https://bugzilla.redhat.com/show_bug.cgi?id=1508070
		 */
		} else if (test_bit(MD_RECOVERY_NEEDED, &recovery) ||
		if (test_bit(MD_RECOVERY_NEEDED, &recovery) ||
		    test_bit(MD_RECOVERY_RESHAPE, &recovery) ||
		    test_bit(MD_RECOVERY_RUNNING, &recovery))
			r = mddev->curr_resync_completed;
		else