Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 2009 14:43:24 -0800
From:      Matt Reimer <mattjreimer@gmail.com>
To:        freebsd-fs <freebsd-fs@freebsd.org>
Cc:        Pawel Jakub Dawidek <pjd@freebsd.org>
Subject:   PATCH: more efficient raidz memory usage for (gpt)zfsboot
Message-ID:  <f383264b0912141443k13d1df48jf5a93c6007f2f29b@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--000e0cd72a504bd44d047ab800e3
Content-Type: text/plain; charset=ISO-8859-1

Teach the (gpt)zfsboot and zfsloader raidz code to use its buffers
more efficiently.

Before this patch, in the worst case memory use would increase
exponentially on the number of drives in the raidz vdev.

Sponsored by: VPOP Technologies, Inc.

Matt Reimer

--000e0cd72a504bd44d047ab800e3
Content-Type: application/octet-stream; name="raidz-mem.patch"
Content-Disposition: attachment; filename="raidz-mem.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g37tvwgu0

LS0tIC9zeXMvY2RkbC9ib290L3pmcy96ZnNzdWJyLmMuT1JJRwkyMDA5LTExLTE0IDA4OjE0OjUx
LjAwMDAwMDAwMCAtMDgwMAorKysgL3N5cy9jZGRsL2Jvb3QvemZzL3pmc3N1YnIuYwkyMDA5LTEy
LTA3IDE1OjI3OjQ5LjAwMDAwMDAwMCAtMDgwMApAQCAtNDU0LDcgKzQ1NCw3IEBACiAKIHN0YXRp
YyB2b2lkCiB2ZGV2X3JhaWR6X3JlY29uc3RydWN0X3BxKHJhaWR6X2NvbF90ICpjb2xzLCBpbnQg
bnBhcml0eSwgaW50IGFjb2xzLAotICAgIGludCB4LCBpbnQgeSkKKyAgICBpbnQgeCwgaW50IHks
IHZvaWQgKnRlbXBfcCwgdm9pZCAqdGVtcF9xKQogewogCXVpbnQ4X3QgKnAsICpxLCAqcHh5LCAq
cXh5LCAqeGQsICp5ZCwgdG1wLCBhLCBiLCBhZXhwLCBiZXhwOwogCXZvaWQgKnBkYXRhLCAqcWRh
dGE7CkBAIC00NzgsMT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hbGxvY190ZW1wKGFzaXplKTsKKwkJaWYgKCFvcmlnKQor
CQkJb3JpZyA9IHpmc19hbGxvY190ZW1wKG1heF9yY19zaXplKTsKKwkJaWYgKCFvcmlnMSkKKwkJ
CW9yaWcxID0gemZzX2FsbG9jX3RlbXAobWF4X3JjX3NpemUpOworCQlpZiAoIXRlbXBfcCkKKwkJ
CXRlbXBfcCA9IHpmc19hbGxvY190ZW1wKG1heF9yY19zaXplKTsKKwkJaWYgKCF0ZW1wX3EpCisJ
CQl0ZW1wX3EgPSB6ZnNfYWxsb2NfdGVtcChtYXhfcmNfc2l6ZSk7CiAJCWZvciAoYyA9IG5wYXJp
dHk7IGMgPCBhY29scyAtIDE7IGMrKykgewogCQkJcmMgPSAmY29sc1tjXTsKIApAQCAtOTA5LDcg
KzkxNyw3IEBACiAJCQkJbWVtY3B5KG9yaWcxLCByYzEtPnJjX2RhdGEsIHJjMS0+cmNfc2l6ZSk7
CiAKIAkJCQl2ZGV2X3JhaWR6X3JlY29uc3RydWN0X3BxKGNvbHMsIG5wYXJpdHksCi0JCQkJICAg
IGFjb2xzLCBjLCBjMSk7CisJCQkJICAgIGFjb2xzLCBjLCBjMSwgdGVtcF9wLCB0ZW1wX3EpOwog
CiAJCQkJaWYgKHppb19jaGVja3N1bV9lcnJvcihicCwgYnVmKSA9PSAwKQogCQkJCQlyZXR1cm4g
KDApOwo=
--000e0cd72a504bd44d047ab800e3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f383264b0912141443k13d1df48jf5a93c6007f2f29b>