aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/xor.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 20:08:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 20:08:40 -0400
commitc80ddb526331a72c9e9d1480f85f6fd7c74e3d2d (patch)
tree0212803a009f171990032abb94fad84156baa153 /crypto/xor.c
parent2c13bc0f8f0d3e13b42be70bf74fec8e56b58324 (diff)
parent1dff2b87a34a1ac1d1898ea109bf97ed396aca53 (diff)
Merge tag 'md-3.5' of git://neil.brown.name/md
Pull md updates from NeilBrown: "It's been a busy cycle for md - lots of fun stuff here.. if you like this kind of thing :-) Main features: - RAID10 arrays can be reshaped - adding and removing devices and changing chunks (not 'far' array though) - allow RAID5 arrays to be reshaped with a backup file (not tested yet, but the priciple works fine for RAID10). - arrays can be reshaped while a bitmap is present - you no longer need to remove it first - SSSE3 support for RAID6 syndrome calculations and of course a number of minor fixes etc." * tag 'md-3.5' of git://neil.brown.name/md: (56 commits) md/bitmap: record the space available for the bitmap in the superblock. md/raid10: Remove extras after reshape to smaller number of devices. md/raid5: improve removal of extra devices after reshape. md: check the return of mddev_find() MD RAID1: Further conditionalize 'fullsync' DM RAID: Use md_error() in place of simply setting Faulty bit DM RAID: Record and handle missing devices DM RAID: Set recovery flags on resume md/raid5: Allow reshape while a bitmap is present. md/raid10: resize bitmap when required during reshape. md: allow array to be resized while bitmap is present. md/bitmap: make sure reshape request are reflected in superblock. md/bitmap: add bitmap_resize function to allow bitmap resizing. md/bitmap: use DIV_ROUND_UP instead of open-code md/bitmap: create a 'struct bitmap_counts' substructure of 'struct bitmap' md/bitmap: make bitmap bitops atomic. md/bitmap: make _page_attr bitops atomic. md/bitmap: merge bitmap_file_unmap and bitmap_file_put. md/bitmap: remove async freeing of bitmap file. md/bitmap: convert some spin_lock_irqsave to spin_lock_irq ...
Diffstat (limited to 'crypto/xor.c')
-rw-r--r--crypto/xor.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/crypto/xor.c b/crypto/xor.c
index 664b6dfa9e2c..65c7b416b4a3 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -21,6 +21,7 @@
21#include <linux/gfp.h> 21#include <linux/gfp.h>
22#include <linux/raid/xor.h> 22#include <linux/raid/xor.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/preempt.h>
24#include <asm/xor.h> 25#include <asm/xor.h>
25 26
26/* The xor routines to use. */ 27/* The xor routines to use. */
@@ -63,12 +64,14 @@ static void
63do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2) 64do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
64{ 65{
65 int speed; 66 int speed;
66 unsigned long now; 67 unsigned long now, j;
67 int i, count, max; 68 int i, count, max;
68 69
69 tmpl->next = template_list; 70 tmpl->next = template_list;
70 template_list = tmpl; 71 template_list = tmpl;
71 72
73 preempt_disable();
74
72 /* 75 /*
73 * Count the number of XORs done during a whole jiffy, and use 76 * Count the number of XORs done during a whole jiffy, and use
74 * this to calculate the speed of checksumming. We use a 2-page 77 * this to calculate the speed of checksumming. We use a 2-page
@@ -76,9 +79,11 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
76 */ 79 */
77 max = 0; 80 max = 0;
78 for (i = 0; i < 5; i++) { 81 for (i = 0; i < 5; i++) {
79 now = jiffies; 82 j = jiffies;
80 count = 0; 83 count = 0;
81 while (jiffies == now) { 84 while ((now = jiffies) == j)
85 cpu_relax();
86 while (time_before(jiffies, now + 1)) {
82 mb(); /* prevent loop optimzation */ 87 mb(); /* prevent loop optimzation */
83 tmpl->do_2(BENCH_SIZE, b1, b2); 88 tmpl->do_2(BENCH_SIZE, b1, b2);
84 mb(); 89 mb();
@@ -89,6 +94,8 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
89 max = count; 94 max = count;
90 } 95 }
91 96
97 preempt_enable();
98
92 speed = max * (HZ * BENCH_SIZE / 1024); 99 speed = max * (HZ * BENCH_SIZE / 1024);
93 tmpl->speed = speed; 100 tmpl->speed = speed;
94 101