All, 

When I reformatted to HTML, I forgot ro fix the code also - here is the 
correct code:

#include <stdio.h>
#include <math.h>

#define NUM_BAYS 24
#define DRIVE_SIZE_GB 300
#define MTBF_YEARS 4
#define MTTR_HOURS_NO_SPARE 16
#define MTTR_HOURS_SPARE 4

int main() {

    printf("\n");
    printf("%u bays w/ %u GB drives having MTBF=%u years\n", NUM_BAYS, 
DRIVE_SIZE_GB, MTBF_YEARS);
    for (int num_drives=2; num_drives<=8; num_drives*=2) {
        for (int num_parity=1; num_parity<=2; num_parity++) {
            double  mttdl;

            int     mtbf_hours          = MTBF_YEARS * 365 * 24;
            int     total_num_drives    = num_drives + num_parity;
            int     num_instances       = NUM_BAYS / total_num_drives;
            int     num_spares          = NUM_BAYS % total_num_drives;
            double  mttr                = num_spares==0 ? 
MTTR_HOURS_NO_SPARE : MTTR_HOURS_SPARE;
            int     total_capacity      = num_drives * num_instances * 
DRIVE_SIZE_GB;

            if (num_parity==1) {
                    mttdl = pow(mtbf_hours, 2.0) / (total_num_drives * 
(total_num_drives-1) * mttr );
            } else if (num_parity==2) {
                    mttdl = pow(mtbf_hours, 3.0) / (total_num_drives * 
(total_num_drives-1) * (total_num_drives-2) * pow(mttr, 2.0) );
            }

            printf("  - can have %u (%u+%u) w/ %u spares providing %u GB 
with MTTDL of %.2f years\n",
                    num_instances,
                    num_drives, num_parity,
                    num_spares,
                    total_capacity,
                    mttdl/24/365/num_instances
                );
        }
    }
}

Sorry about that

Kent

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to