You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The formula in phyvirt.c for the maplbn() function is wrong:
if( s >= dp->sectors / dp->interleave )
s = (s * dp->interleave) - (dp->sectors -1); /* <<< BUG HERE! */
else
s = s * dp->interleave;
s = (s + (dp->skew * c)) % dp->sectors;
First, since the last line shown in the snippet above operates with the reminders modulo dp->sectors, then subtracting dp->sectors -1 on the line marked "BUG HERE" is the same as just adding 1. Thus, the formula on that line can be simplified as:
s = (s * dp->interleave) +1;
That, however, is a problem for dp->sectors not being a multiple of dp->interleave (given, DEC did not use those values in practice, so it may not "trigger" the bug, but still). An example: if sectors:=10 and interleave:=3, the mapping sequence of sectors, which the code calculates, yields:
The formula in
phyvirt.c
for themaplbn()
function is wrong:First, since the last line shown in the snippet above operates with the reminders modulo
dp->sectors
, then subtractingdp->sectors -1
on the line marked "BUG HERE" is the same as just adding 1. Thus, the formula on that line can be simplified as:That, however, is a problem for
dp->sectors
not being a multiple ofdp->interleave
(given, DEC did not use those values in practice, so it may not "trigger" the bug, but still). An example: ifsectors:=10
andinterleave:=3
, the mapping sequence of sectors, which the code calculates, yields:The problem is quite obvious -- there cannot be any repeated sectors! Instead, the correct output sector sequence in these conditions would be:
The correct interleave formula can be found in the
lbn2pbn
tool, which was added recently to thesimtools/converters
.The text was updated successfully, but these errors were encountered: