Skip to contentSkip to conversation

LVM2 ./VERSION ./VERSION_DM ./WHATS_NEW ./WHAT ...

PATCH [email protected] 1 participant 1 message Sep 27, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-09-27 19:09:36

Modified files:
. : VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM
make.tmpl.in
lib/config : config.c config.h
lib/format_text: format-text.c
lib/label : label.c
lib/misc : crc.c crc.h
Added files:
lib/misc : crc_gen.c

Log message:
Speed up CRC32 calculations by using a larger lookup table.

Use -DDEBUG_CRC32 to revert to old function and check new one gives same result.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.255&r2=1.256
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1736&r2=1.1737
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.415&r2=1.416
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/make.tmpl.in.diff?cvsroot=lvm2&r1=1.110&r2=1.111
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.80&r2=1.81
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.h.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.144&r2=1.145
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/label/label.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/crc_gen.c.diff?cvsroot=lvm2&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/crc.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/crc.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6

VERSION +1 -1
@@ -1 +1 @@
-2.02.74(2)-cvs (2010-09-24)
+2.02.75(2)-cvs (2010-09-24)
VERSION_DM +1 -1
@@ -1 +1 @@
-1.02.55-cvs (2010-09-24)
+1.02.56-cvs (2010-09-24)
WHATS_NEW +5 -1
@@ -1,3 +1,7 @@
+Version 2.02.75 - 
+=====================================
+  Speed up CRC32 calculations by using a larger lookup table.
+
 Version 2.02.74 - 24th September 2010
 =====================================
   Allow : and @ to be escaped with \ in device names of PVs.
@@ -17,7 +21,7 @@
   Add configure --with-default-data-alignment.
   Update heuristic used for default and detected data alignment.
   Add "devices/default_data_alignment" to lvm.conf.
-  Add implmentation for simple numeric 'get' property functions.
+  Add implementation for simple numeric 'get' property functions.
   Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' function
   Add properties.[ch] to lib/report using columns.h.
   Add macro definitions to report infrastructure for character array length.
WHATS_NEW_DM +3 -0
@@ -1,3 +1,6 @@
+Version 1.02.56 - 
+=====================================
+
 Version 1.02.55 - 24th September 2010
 =====================================
   Fix the way regions are marked complete to avoid slow --nosync cmirror I/O.
make.tmpl.in +1 -0
@@ -113,6 +113,7 @@
 
 #CFLAGS += -W -Wconversion -Wpointer-arith -Wbad-function-cast -Wcast-qual
 #CFLAGS += -pedantic -std=gnu99
+#CFLAGS += -DDEBUG_CRC32
 
 CFLAGS += @COPTIMISE_FLAG@
 
lib/config/config.c +2 -2
@@ -239,8 +239,8 @@
 	}
 
 	if (checksum_fn && checksum !=
-	    (checksum_fn(checksum_fn(INITIAL_CRC, p->fb, size),
-			 p->fb + size, size2))) {
+	    (checksum_fn(checksum_fn(INITIAL_CRC, (uint8_t *)p->fb, size),
+			 (uint8_t *)(p->fb + size), size2))) {
 		log_error("%s: Checksum error", dev_name(dev));
 		goto out;
 	}
lib/config/config.h +1 -1
@@ -60,7 +60,7 @@
 				     const char *config_settings);
 void destroy_config_tree(struct config_tree *cft);
 
-typedef uint32_t (*checksum_fn_t) (uint32_t initial, const void *buf, uint32_t size);
+typedef uint32_t (*checksum_fn_t) (uint32_t initial, const uint8_t *buf, uint32_t size);
 
 int read_config_fd(struct config_tree *cft, struct device *dev,
 		   off_t offset, size_t size, off_t offset2, size_t size2,
lib/format_text/format-text.c +4 -4
@@ -332,7 +332,7 @@
 	if (!dev_read(dev_area->dev, dev_area->start, MDA_HEADER_SIZE, mdah))
 		goto_bad;
 
-	if (mdah->checksum_xl != xlate32(calc_crc(INITIAL_CRC, mdah->magic,
+	if (mdah->checksum_xl != xlate32(calc_crc(INITIAL_CRC, (uint8_t *)mdah->magic,
 						  MDA_HEADER_SIZE -
 						  sizeof(mdah->checksum_xl)))) {
 		log_error("Incorrect metadata area header checksum on %s"
@@ -380,7 +380,7 @@
 	mdah->start = start_byte;
 
 	_xlate_mdah(mdah);
-	mdah->checksum_xl = xlate32(calc_crc(INITIAL_CRC, mdah->magic,
+	mdah->checksum_xl = xlate32(calc_crc(INITIAL_CRC, (uint8_t *)mdah->magic,
 					     MDA_HEADER_SIZE -
 					     sizeof(mdah->checksum_xl)));
 
@@ -650,12 +650,12 @@
 			goto_out;
 	}
 
-	mdac->rlocn.checksum = calc_crc(INITIAL_CRC, fidtc->raw_metadata_buf,
+	mdac->rlocn.checksum = calc_crc(INITIAL_CRC, (uint8_t *)fidtc->raw_metadata_buf,
 					(uint32_t) (mdac->rlocn.size -
 						    new_wrap));
 	if (new_wrap)
 		mdac->rlocn.checksum = calc_crc(mdac->rlocn.checksum,
-						fidtc->raw_metadata_buf +
+						(uint8_t *)fidtc->raw_metadata_buf +
 						mdac->rlocn.size -
 						new_wrap, (uint32_t) new_wrap);
 
lib/label/label.c +4 -4
@@ -142,8 +142,8 @@
 					 sector + scan_sector);
 				continue;
 			}
-			if (calc_crc(INITIAL_CRC, &lh->offset_xl, LABEL_SIZE -
-				     ((uintptr_t) &lh->offset_xl - (uintptr_t) lh)) !=
+			if (calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl, LABEL_SIZE -
+				     ((uint8_t *) &lh->offset_xl - (uint8_t *) lh)) !=
 			    xlate32(lh->crc_xl)) {
 				log_info("Label checksum incorrect on %s - "
 					 "ignoring", dev_name(dev));
@@ -323,8 +323,8 @@
 	if (!(label->labeller->ops->write)(label, buf))
 		return_0;
 
-	lh->crc_xl = xlate32(calc_crc(INITIAL_CRC, &lh->offset_xl, LABEL_SIZE -
-				      ((uintptr_t) &lh->offset_xl - (uintptr_t) lh)));
+	lh->crc_xl = xlate32(calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl, LABEL_SIZE -
+				      ((uint8_t *) &lh->offset_xl - (uint8_t *) lh)));
 
 	if (!dev_open(dev))
 		return_0;

/cvs/lvm2/LVM2/lib/misc/crc_gen.c,v --> standard output revision 1.1

- renamed from lib/misc/crc_gen.c +47 -0

47 lines not on this page · raw message

lib/misc/crc.c +81 -3

100 lines not on this page · raw message

lib/misc/crc.h +1 -1
@@ -18,6 +18,6 @@
 
 #define INITIAL_CRC 0xf597a6cf
 
-uint32_t calc_crc(uint32_t initial, const void *buf, uint32_t size);
+uint32_t calc_crc(uint32_t initial, const uint8_t *buf, uint32_t size);
 
 #endif