Crush: Backporting fixes for #9492 to giant

The fixes for #9492 are backported from master to giant.  The fix ensures that at most num-rep osds are selected for firstn and indep rules