Formation of stacking faults and their correlation with flux pinning and critical current density in Sm-doped YBa2Cu3O7-δ films