On the discrepancy principle for iterative and parametric methods to solve linear ill-posed equations