[patch] Re: Speeding up FAT operations

Jukka Tapani Santala (e75644@UWasa.Fi)
Wed, 16 Sep 1998 01:45:58 +0300 (EET DST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-1804928587-905899558=:3921
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Tue, 15 Sep 1998, Gordon Chaffee wrote:
> If you want to make improvements, go ahead and create a patch. The
> particular code in question has been around for a long time. It seems

I'm rather familiar with the free software idea, and would love to
contribute to such projects... however, it's been my experience from
participating (intemittenly(sp?)) on this list for a couple of years that
obscure patches submitted by unknown people don't usually have much
change entering into codebase, and often for good reasons - last year I
had another performance-patch I didn't post for the simple reason that I
_knew_ it would have broken things on pracctically every other platform
besides mine, and I couldn't find anybody on other platforms to review it
;) So sometimes it seems more worth it to just simply remind people on
some basic principles of the area, and hope things get fixed
particularily as the code goes over it's usual cycles...

On that slightly sourer note, I did nevertheless get interested on this
particular problem, so I wrote the patch referred to. On a slight
tangent, you welcomed people to "look over the code"; I don't usually do
that, since kernels are quite new stuff to me. Places I've started with,
including this, are ones I've spotted by using the built-in kernel
profiler (plus a hacked-together improved version of readprofile
utility). Consistent with this, usually when I find a place with
inefficiencies I can't even be sure whether they're intentional or not -
like in this case I don't actually have any of the FAT, VFAT etc. specs
so I don't know if it's actually ever possible for cluster_size not to be
a power of two (I just checked mkfs.msdos does require it to be, but this
is still not to say it couldn't be something else with other tools). In
this patch, I've therefore included a "fallback-case" in case this
assumption isn't true; for all I know it's said to be true in some spec,
if not I'm sure people will tell if this patch will misbehave on them...

Enough of the ramble, though... there's still possible improvements: Are
the chosen algorithms best possible, and clear enough? I doubt this,
actually, but then, I'm always a bit of a perfectionist ;) Also, if the
assumption on powers of two proves to be true, there's many places where
multiplication by cluster-size could be replaced by shift operation.
sb->cluster_size might in fact be done away with completely.

-Donwulff
---559023410-1804928587-905899558=:3921
Content-Type: TEXT/PLAIN; charset=US-ASCII; name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aW5j
bHVkZS9saW51eC9tc2Rvc19mc19zYi5oDQotLS0gbGludXguMTIwL2luY2x1
ZGUvbGludXgvbXNkb3NfZnNfc2IuaAlGcmkgSmFuICA5IDAwOjAyOjQxIDE5
OTgNCisrKyBsaW51eC9pbmNsdWRlL2xpbnV4L21zZG9zX2ZzX3NiLmgJV2Vk
IFNlcCAxNiAwMzoyMjo1NyAxOTk4DQpAQCAtMzQsNiArMzQsNyBAQA0KIA0K
IHN0cnVjdCBtc2Rvc19zYl9pbmZvIHsNCiAJdW5zaWduZWQgc2hvcnQgY2x1
c3Rlcl9zaXplOyAvKiBzZWN0b3JzL2NsdXN0ZXIgKi8NCisJdW5zaWduZWQg
c2hvcnQgY2x1c3Rlcl9zaGlmdDsgLyogZm9yIGZhc3QgYm1hcCAqLw0KIAl1
bnNpZ25lZCBjaGFyIGZhdHMsZmF0X2JpdHM7IC8qIG51bWJlciBvZiBGQVRz
LCBGQVQgYml0cyAoMTIgb3IgMTYpICovDQogCXVuc2lnbmVkIHNob3J0IGZh
dF9zdGFydCxmYXRfbGVuZ3RoOyAvKiBGQVQgc3RhcnQgJiBsZW5ndGggKHNl
Yy4pICovDQogCXVuc2lnbmVkIHNob3J0IGRpcl9zdGFydCxkaXJfZW50cmll
czsgLyogcm9vdCBkaXIgc3RhcnQgJiBlbnRyaWVzICovDQo=
---559023410-1804928587-905899558=:3921--

-
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/