to be able to really understand the code and to find the solution next time, you have to find out yourself; i can only give you hints. here i assume everyone on this forum wants to be able to solve a simple programming task and to read and/or debug some code. you can for example print the partial results of line 48/49, what are the values of $dev_size / $extent_size, int($dev_size / $extent_size), $dev_size % $extent_size, ($dev_size % $extent_size) ? 1 : 0 for varying values of the variables?
if you assume for a moment that the numeric value of the extent size matches the comment, what unit is extent size in? what is the factor? what does the manual page for 'blockdev' say about the option --getsize ?
find out
to be able to really understand the code and to find the solution next time, you have to find out yourself; i can only give you hints. here i assume everyone on this forum wants to be able to solve a simple programming task and to read and/or debug some code. you can for example print the partial results of line 48/49, what are the values of $dev_size / $extent_size, int($dev_size / $extent_size), $dev_size % $extent_size, ($dev_size % $extent_size) ? 1 : 0 for varying values of the variables?
if you assume for a moment that the numeric value of the extent size matches the comment, what unit is extent size in? what is the factor? what does the manual page for 'blockdev' say about the option --getsize ?