X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmd%2Fxor.c;h=324897c4be4ed04cac7404f008cf17ca0c0f5dbc;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=e2103a8bb75a0ecc8ce76cc9054118bc18e9fc34;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/md/xor.c b/drivers/md/xor.c index e2103a8bb..324897c4b 100644 --- a/drivers/md/xor.c +++ b/drivers/md/xor.c @@ -108,29 +108,40 @@ calibrate_xor_block(void) } b2 = b1 + 2*PAGE_SIZE + BENCH_SIZE; - printk(KERN_INFO "raid5: measuring checksumming speed\n"); + /* + * If this arch/cpu has a short-circuited selection, don't loop through all + * the possible functions, just test the best one + */ + + fastest = NULL; + +#ifdef XOR_SELECT_TEMPLATE + fastest = XOR_SELECT_TEMPLATE(fastest); +#endif #define xor_speed(templ) do_xor_speed((templ), b1, b2) - XOR_TRY_TEMPLATES; + if (fastest) { + printk(KERN_INFO "raid5: automatically using best checksumming function: %s\n", + fastest->name); + xor_speed(fastest); + } else { + printk(KERN_INFO "raid5: measuring checksumming speed\n"); + XOR_TRY_TEMPLATES; + fastest = template_list; + for (f = fastest; f; f = f->next) + if (f->speed > fastest->speed) + fastest = f; + } + + printk("raid5: using function: %s (%d.%03d MB/sec)\n", + fastest->name, fastest->speed / 1000, fastest->speed % 1000); #undef xor_speed free_pages((unsigned long)b1, 2); - fastest = template_list; - for (f = fastest; f; f = f->next) - if (f->speed > fastest->speed) - fastest = f; - -#ifdef XOR_SELECT_TEMPLATE - fastest = XOR_SELECT_TEMPLATE(fastest); -#endif - active_template = fastest; - printk("raid5: using function: %s (%d.%03d MB/sec)\n", - fastest->name, fastest->speed / 1000, fastest->speed % 1000); - return 0; }