cluster = sector/sb->cluster_size;
offset = sector % sb->cluster_size;
...my computer seems to be wasting most of it's time doing integer divide
on numbers that my recollection from the FAT days should be replaceable
by simple bit-operations (Okay, this may have something to do with the
fact that the FPU is otherwise pre-occupied). Geeze, even int
i=sb->cluster_size>>1; cluster=sector; while(i>>1) cluster=cluster>>1;
offset=sector&(sb->cluster_size-1); yields better result. I'm probably
missing a technique to do away with that loop entirely, but taking the
shift-value ahead of time into a static variable in appropriate place is
the real trick...
The reason I'm not presenting a patch to do this at this time is because
kernel stuff isn't really my usual playground, and so I'm wondering if
there actually is a reason this is done the "hard way" currently or all
places the change would reflect to. Also, by posting this instead I hope
other people take cases like this into account (Multiplication and
especially division is very expensive operation even when done in
integer, which is exactly why most measures dealt with in lowe-level code
are powers of 2) and won't change the behaviour back to earlier in the
next patch ;) I can only guess at how many similiar places there are in the
code.
-Donwulff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/