[patch] sendpath() support, 2.4.0-test3/-ac9

Ingo Molnar (mingo@elte.hu)
Mon, 15 Jan 2001 21:47:03 +0100 (CET)


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.

--655616-723171322-979591382=:6418
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.4.30.0101152143111.6418@elte.hu>

On 15 Jan 2001, Linus Torvalds wrote:

> int fd = open(..)
> fstat(fd..);
> sendfile(fd..);
> close(fd);
>
> is any slower than
>
> .. cache stat() in user space based on name ..
> sendpath(name, ..);
>
> on any real load.

just for kicks i've implemented sendpath() support. (patch against
2.4.0-test and sample code attached) It appears to work just fine here.
With a bit of reorganization in mm/filemap.c it was quite straightforward
to do.

Jonathan, is this what Zeus needs? If yes, it could be interesting to run
a simple benchmark to compare sendpath() to open()+sendfile()?

Ingo

--655616-723171322-979591382=:6418
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="sendpath-2.4.0-A1"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.30.0101152143020.6418@elte.hu>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="sendpath-2.4.0-A1"

LS0tIGxpbnV4L21tL2ZpbGVtYXAuYy5vcmlnCU1vbiBKYW4gMTUgMjI6NDM6
MjEgMjAwMQ0KKysrIGxpbnV4L21tL2ZpbGVtYXAuYwlNb24gSmFuIDE1IDIz
OjA5OjU1IDIwMDENCkBAIC0zOSw2ICszOSw4IEBADQogICogcGFnZS1jYWNo
ZSwgMjEuMDUuMTk5OSwgSW5nbyBNb2xuYXIgPG1pbmdvQHJlZGhhdC5jb20+
DQogICoNCiAgKiBTTVAtdGhyZWFkZWQgcGFnZW1hcC1MUlUgMTk5OSwgQW5k
cmVhIEFyY2FuZ2VsaSA8YW5kcmVhQHN1c2UuZGU+DQorICoNCisgKiBTdGFy
dGVkIHNlbmRwYXRoKCkgc3VwcG9ydCwg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DENCisrKyBsaW51
eC9hcmNoL2kzODYva2VybmVsL2VudHJ5LlMJTW9uIEphbiAxNSAyMjo0Mzox
MiAyMDAxDQpAQCAtNjQ2LDYgKzY0Niw3IEBADQogCS5sb25nIFNZTUJPTF9O
QU1FKHN5c19nZXRkZW50czY0KQkvKiAyMjAgKi8NCiAJLmxvbmcgU1lNQk9M
X05BTUUoc3lzX2ZjbnRsNjQpDQogCS5sb25nIFNZTUJPTF9OQU1FKHN5c19u
aV9zeXNjYWxsKQkvKiByZXNlcnZlZCBmb3IgVFVYICovDQorCS5sb25nIFNZ
TUJPTF9OQU1FKHN5c19zZW5kcGF0aCkNCiANCiAJLyoNCiAJICogTk9URSEh
IFRoaXMgZG9lc24ndCBoYXZlIHRvIGJlIGV4YWN0IC0gd2UganVzdCBoYXZl
DQpAQCAtNjUzLDYgKzY1NCw2IEBADQogCSAqIGVudHJpZXMuIERvbid0IHBh
bmljIGlmIHlvdSBub3RpY2UgdGhhdCB0aGlzIGhhc24ndA0KIAkgKiBiZWVu
IHNocnVuayBldmVyeSB0aW1lIHdlIGFkZCBhIG5ldyBzeXN0ZW0gY2FsbC4N
CiAJICovDQotCS5yZXB0IE5SX3N5c2NhbGxzLTIyMQ0KKwkucmVwdCBOUl9z
eXNjYWxscy0yMjMNCiAJCS5sb25nIFNZTUJPTF9OQU1FKHN5c19uaV9zeXNj
YWxsKQ0KIAkuZW5kcg0K
--655616-723171322-979591382=:6418
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="sendpath.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.30.0101152143021.6418@elte.hu>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="sendpath.c"

DQovKg0KICogU2FtcGxlIHNlbmRwYXRoKCkgY29kZS4gSXQgc2hvdWxkIG1h
aW5seSBiZSB1c2VkIGZvciBzb2NrZXRzLg0KICovDQoNCiNpbmNsdWRlIDxs
aW51eC91bmlzdGQuaD4NCiNpbmNsdWRlIDxzeXMvc2VuZGZpbGUuaD4NCiNp
bmNsdWRlIDxzdGRsaWIuaD4NCiNpbmNsdWRlIDx1bmlzdGQuaD4NCiNpbmNs
dWRlIDxzdGRpby5oPg0KI2luY2x1ZGUgPGZjbnRsLmg+DQoNCiNkZWZpbmUg
X19OUl9zZW5kcGF0aCAyMjMNCg0KX3N5c2NhbGw0IChpbnQsIHNlbmRwYXRo
LCBpbnQsIG91dF9mZCwgY2hhciAqLCBwYXRoLCBvZmZfdCAqLCBvZmYsIHNp
emVfdCwgc2l6ZSkNCg0KaW50IG1haW4gKGludCBhcmdjLCBjaGFyICoqYXJn
dikNCnsNCglpbnQgb3V0X2ZkOw0KCWludCByZXQ7DQoNCglvdXRfZmQgPSBv
cGVuKCIuL3RtcGZpbGUiLCBPX1JEV1J8T19DUkVBVHxPX1RSVU5DLCAwNzAw
KTsNCglyZXQgPSBzZW5kcGF0aChvdXRfZmQsICIvdXNyL2luY2x1ZGUvdW5p
c3RkLmgiLCBOVUxMLCAzMDApOw0KDQoJcHJpbnRmKCJzZW5kcGF0aCB3cm90
ZSAlZCBieXRlcyBpbnRvIC4vdG1wZmlsZS5cbiIsIHJldCk7DQoJcmV0dXJu
IDA7DQp9DQo=
--655616-723171322-979591382=:6418--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/