[ENBD] md5sum switch
Arne Wiebalck
wiebalck at kip.uni-heidelberg.de
Fri Jan 9 09:39:14 MST 2004
On Fri, 9 Jan 2004, Peter T. Breuer wrote:
> Perhaps ... if the argument is even (terminates in 0 mod 2), then
> we want to switch OFF md5summing, and clear the flag and set the on
> threshold to arg/2. A negative value means never switch on, thus
> "-2" as an argument switches off md5summing forever.
>
> If the argument is odd (terminates in 1 mod 2), then we want to switch
> ON md5summing, and set the flag and set the off threshold to (arg-1)/2.
> A negative value means never switch off, so "-1" as argument
> switches on md5summing forever.
>
> case ENBD_SET_MD5SUM: /* PTB - change to do/plead md5summing */
> ENBD_DEBUG (3, "ENBD_SET_MD5SUM %ld\n", arg);
> if (arg & 1) {
> // PTB odd. switch on md5sum and possibly raise off_threshold
> atomic_set_mask (ENBD_MD5SUM, &lo->flags);
> if (arg != 1) {
> md5_off_threshold = (long)arg >> 1;
> }
> }
> else {
> // PTB even. switch off md5sum and possibly raise on_threshold
> atomic_clear_mask (ENBD_MD5SUM, &lo->flags);
> if (arg != 0) {
> md5_on_threshold = (long)arg >> 1;
> }
> }
>
> Which has the merit of not mixing addresses and values. And the obvious
> demerits.
>
you're coding a switch into the threshold value, which is a nice
idea. but wouldn't it be easier to use a central flag and leave the rest
as it is? I think that one would understand the meanings of
dev.enbd.md5_off_threshold = 10
dev.enbd.md5_on_threshold = 1000 and
dev.enbd.md5sum = 0
without a man page. if you implement your proposal,
you definitively must write some sentences in the man page ... :-)
anyway, your version very ok for me!
arne
**********************************************************************
Arne Wiebalck Kirchhoff Institute for Physics
Technical Computer Science
INF 227, Room 3.315
D-69120 Heidelberg
e-mail: wiebalck at kip.uni-heidelberg.de
web : http://www.kip.uni-heidelberg.de Tel.: (+49) 6221/54-9816
**********************************************************************
More information about the ENBD
mailing list