summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2015-10-28 08:41:25 -0700
committerNeilBrown <neilb@suse.com>2015-11-01 13:45:39 +1100
commit5cb2fbd6ea0d151dcb12d98c06c8761eedfed2ee (patch)
treea5a7bc748d75a96d6b8e7d487c7720e2ee3cf292 /drivers/md
parent355810d12a8974ff1f3a7336149b65d4bda84634 (diff)
downloadlinux-stable-5cb2fbd6ea0d151dcb12d98c06c8761eedfed2ee.tar.gz
linux-stable-5cb2fbd6ea0d151dcb12d98c06c8761eedfed2ee.tar.bz2
linux-stable-5cb2fbd6ea0d151dcb12d98c06c8761eedfed2ee.zip
raid5-cache: use crc32c checksum
crc32c has lower overhead with cpu acceleration. It's a shame I didn't use it in first post, sorry. This changes disk format, but we are still ok in current stage. V2: delete unnecessary type conversion as pointed out by Bart Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5-cache.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 2b9ed0e3af37..270ee3aaba23 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -16,7 +16,7 @@
#include <linux/blkdev.h>
#include <linux/slab.h>
#include <linux/raid/md_p.h>
-#include <linux/crc32.h>
+#include <linux/crc32c.h>
#include <linux/random.h>
#include "md.h"
#include "raid5.h"
@@ -282,7 +282,7 @@ static void r5l_submit_current_io(struct r5l_log *log)
block = page_address(io->meta_page);
block->meta_size = cpu_to_le32(io->meta_offset);
- crc = crc32_le(log->uuid_checksum, (void *)block, PAGE_SIZE);
+ crc = crc32c_le(log->uuid_checksum, block, PAGE_SIZE);
block->checksum = cpu_to_le32(crc);
log->current_io = NULL;
@@ -484,8 +484,8 @@ int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh)
if (test_bit(STRIPE_LOG_TRAPPED, &sh->state))
continue;
addr = kmap_atomic(sh->dev[i].page);
- sh->dev[i].log_checksum = crc32_le(log->uuid_checksum,
- addr, PAGE_SIZE);
+ sh->dev[i].log_checksum = crc32c_le(log->uuid_checksum,
+ addr, PAGE_SIZE);
kunmap_atomic(addr);
}
parity_pages = 1 + !!(sh->qd_idx >= 0);
@@ -744,7 +744,7 @@ static int r5l_read_meta_block(struct r5l_log *log,
le64_to_cpu(mb->position) != ctx->pos)
return -EINVAL;
- crc = crc32_le(log->uuid_checksum, (void *)mb, PAGE_SIZE);
+ crc = crc32c_le(log->uuid_checksum, mb, PAGE_SIZE);
if (stored_crc != crc)
return -EINVAL;
@@ -819,7 +819,7 @@ static int r5l_recovery_flush_one_stripe(struct r5l_log *log,
if (!test_bit(R5_Wantwrite, &sh->dev[disk_index].flags))
continue;
addr = kmap_atomic(sh->dev[disk_index].page);
- checksum = crc32_le(log->uuid_checksum, addr, PAGE_SIZE);
+ checksum = crc32c_le(log->uuid_checksum, addr, PAGE_SIZE);
kunmap_atomic(addr);
if (checksum != sh->dev[disk_index].log_checksum)
goto error;
@@ -909,7 +909,7 @@ static int r5l_log_write_empty_meta_block(struct r5l_log *log, sector_t pos,
mb->meta_size = cpu_to_le32(sizeof(struct r5l_meta_block));
mb->seq = cpu_to_le64(seq);
mb->position = cpu_to_le64(pos);
- crc = crc32_le(log->uuid_checksum, (void *)mb, PAGE_SIZE);
+ crc = crc32c_le(log->uuid_checksum, mb, PAGE_SIZE);
mb->checksum = cpu_to_le32(crc);
if (!sync_page_io(log->rdev, pos, PAGE_SIZE, page, WRITE_FUA, false)) {
@@ -1000,7 +1000,7 @@ static int r5l_load_log(struct r5l_log *log)
}
stored_crc = le32_to_cpu(mb->checksum);
mb->checksum = 0;
- expected_crc = crc32_le(log->uuid_checksum, (void *)mb, PAGE_SIZE);
+ expected_crc = crc32c_le(log->uuid_checksum, mb, PAGE_SIZE);
if (stored_crc != expected_crc) {
create_super = true;
goto create;
@@ -1047,8 +1047,8 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
return -ENOMEM;
log->rdev = rdev;
- log->uuid_checksum = crc32_le(~0, (void *)rdev->mddev->uuid,
- sizeof(rdev->mddev->uuid));
+ log->uuid_checksum = crc32c_le(~0, rdev->mddev->uuid,
+ sizeof(rdev->mddev->uuid));
mutex_init(&log->io_mutex);