Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2019 23:52:58 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Peter Eriksson <pen@lysator.liu.se>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@FreeBSD.org>
Subject:   Re: test hash functions for fsid
Message-ID:  <YQBPR0101MB2260AA6B2642A5DDE49D4A35DD320@YQBPR0101MB2260.CANPRD01.PROD.OUTLOOK.COM>
In-Reply-To: <D27D3F7A-22B3-4EDA-AD61-1B95366D1A2D@lysator.liu.se>
References:  <YQBPR0101MB2260D82BAE348FB82902508CDD320@YQBPR0101MB2260.CANPRD01.PROD.OUTLOOK.COM>, <D27D3F7A-22B3-4EDA-AD61-1B95366D1A2D@lysator.liu.se>

next in thread | previous in thread | raw e-mail | index | archive | help
--_002_YQBPR0101MB2260AA6B2642A5DDE49D4A35DD320YQBPR0101MB2260_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Peter wrote:
>Here=92s the output from a couple of our servers (filur00 with around 2428=
9 zfs >filesystems, balur01 with about 72350 zfs filesystems, filur04 about=
 7500 zfs >filesystems):
>
>
>Lpeter86@filur00:~ % ./testhash
>H1: max=3D24290 min=3D0
>H2: max=3D24290 min=3D0
>H3: max=3D24290 min=3D0
>H4: max=3D24290 min=3D0
>
>Lpeter86@balur01:~ % /tmp/testhash
>H1: max=3D73343 min=3D0
>H2: max=3D73343 min=3D0
>H3: max=3D73343 min=3D0
>H4: max=3D73343 min=3D0
>
>Lpeter86@filur04:~ % /tmp/testhash
>H1: max=3D7560 min=3D0
>H2: max=3D7560 min=3D0
>H3: max=3D7560 min=3D0
>H4: max=3D7560 min=3D0
>
I'll admit when I first looked at this, I was baffled;-)
Turns out the f_fsid field is just zeros when getmntinfo() is run by non-ro=
ot.
Please do this again as "root". I have attached a slightly modified version
with an additional trivial hash and it calculates variance.

Thanks for doing this, rick


--_002_YQBPR0101MB2260AA6B2642A5DDE49D4A35DD320YQBPR0101MB2260_
Content-Type: text/plain; name="testhash.c"
Content-Description: testhash.c
Content-Disposition: attachment; filename="testhash.c"; size=2448;
	creation-date="Wed, 08 May 2019 23:52:45 GMT";
	modification-date="Wed, 08 May 2019 23:52:45 GMT"
Content-Transfer-Encoding: base64

I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxlcnIuaD4KI2luY2x1ZGUgPHN5cy9wYXJhbS5o
PgojaW5jbHVkZSA8c3lzL2Zudl9oYXNoLmg+CiNpbmNsdWRlIDxzeXMvaGFzaC5oPgojaW5jbHVk
ZSA8c3lzL21vdW50Lmg+CgppbnQKbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQp7CglpbnQg
aDFbMjU2XSwgaDJbMjU2XSwgaDNbMjU2XSwgaDRbMjU2XSwgaDVbMjU2XSwgaSwgbWF4LCBtaW4s
IG51bTsKCXN0cnVjdCBzdGF0ZnMgKm1udGJ1ZnA7CglmbG9hdCBhdmUsIHZhcmksIHRvdHZhcmk7
CgoJZm9yIChpID0gMDsgaSA8IDI1NjsgaSsrKSB7CgkJaDFbaV0gPSAwOwoJCWgyW2ldID0gMDsK
CQloM1tpXSA9IDA7CgkJaDRbaV0gPSAwOwoJCWg1W2ldID0gMDsKCX0KCW51bSA9IGdldG1udGlu
Zm8oJm1udGJ1ZnAsIE1OVF9OT1dBSVQpOwoJaWYgKG51bSA9PSAwKQoJCWVycngoMSwgIk11c3Qg
YmUgcnVuIGFzIHJvb3QiKTsKCWZvciAoaSA9IDA7IGkgPCBudW07IGkrKykgewoJCWgxW2Zudl8z
Ml9idWYoJm1udGJ1ZnBbaV0uZl9mc2lkLCBzaXplb2YoZnNpZF90KSwgMCkgJSAyNTZdKys7CgkJ
aDJbZm52XzMyX2J1ZigmbW50YnVmcFtpXS5mX2ZzaWQsIHNpemVvZihmc2lkX3QpLCBGTlYxXzMy
X0lOSVQpICUgMjU2XSsrOwoJCWgzW2hhc2gzMl9idWYoJm1udGJ1ZnBbaV0uZl9mc2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bikKCQkJbWluID0gaDVbaV07CgkJaWYgKChmbG9h
dCloNVtpXSA+IGF2ZSkKCQkJdmFyaSA9IChmbG9hdCloNVtpXSAtIGF2ZTsKCQllbHNlCgkJCXZh
cmkgPSBhdmUgLSAoZmxvYXQpaDVbaV07CgkJdG90dmFyaSArPSB2YXJpOwoJfQoJcHJpbnRmKCJI
NTogbWF4PSVkIG1pbj0lZCB0b3R2YXJpPSVmXG4iLCBtYXgsIG1pbiwgdG90dmFyaSk7Cn0K

--_002_YQBPR0101MB2260AA6B2642A5DDE49D4A35DD320YQBPR0101MB2260_--



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