mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Fix typos in the comment of the raid library
This commit is contained in:
parent
eccc837e8d
commit
b709371d2d
10 changed files with 32 additions and 32 deletions
|
|
@ -11,7 +11,7 @@
|
|||
* This function checks if the specified failed blocks satisfy the redundancy
|
||||
* information using the data from the known valid parity blocks.
|
||||
*
|
||||
* It's similar at raid_check(), just with a different format for arguments.
|
||||
* It's similar to raid_check(), just with a different format for arguments.
|
||||
*
|
||||
* The number of failed blocks @nr must be strictly less than the number of
|
||||
* parities @nv, because you need one more parity to validate the recovering.
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
* @ip[] Vector of @nv indexes of the valid parity blocks.
|
||||
* The indexes start from 0. They must be in order.
|
||||
* @nd Number of data blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiplier of 64.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiple of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @ip[@nv - 1] + 1) elements. The starting elements are the
|
||||
* blocks for data, following with the parity blocks.
|
||||
|
|
|
|||
10
raid/combo.h
10
raid/combo.h
|
|
@ -9,7 +9,7 @@
|
|||
/**
|
||||
* Get the first permutation with repetition of r of n elements.
|
||||
*
|
||||
* Typical use is with permutation_next() in the form :
|
||||
* Typical use is with permutation_next() in the form:
|
||||
*
|
||||
* int i[R];
|
||||
* permutation_first(R, N, i);
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* code using i[0], i[1], ..., i[R-1]
|
||||
* } while (permutation_next(R, N, i));
|
||||
*
|
||||
* It's equivalent at the code :
|
||||
* It's equivalent to the code:
|
||||
*
|
||||
* for(i[0]=0;i[0]<N;++i[0])
|
||||
* for(i[1]=0;i[1]<N;++i[1])
|
||||
|
|
@ -75,7 +75,7 @@ recurse:
|
|||
/**
|
||||
* Get the first combination without repetition of r of n elements.
|
||||
*
|
||||
* Typical use is with combination_next() in the form :
|
||||
* Typical use is with combination_next() in the form:
|
||||
*
|
||||
* int i[R];
|
||||
* combination_first(R, N, i);
|
||||
|
|
@ -83,7 +83,7 @@ recurse:
|
|||
* code using i[0], i[1], ..., i[R-1]
|
||||
* } while (combination_next(R, N, i));
|
||||
*
|
||||
* It's equivalent at the code :
|
||||
* It's equivalent to the code:
|
||||
*
|
||||
* for(i[0]=0;i[0]<N-(R-1);++i[0])
|
||||
* for(i[1]=i[0]+1;i[1]<N-(R-2);++i[1])
|
||||
|
|
@ -133,7 +133,7 @@ recurse:
|
|||
|
||||
/* initialize all the next positions, if any */
|
||||
while (i < r) {
|
||||
/* each position start at the next value of the previous one */
|
||||
/* each position starts at the next value of the previous one */
|
||||
c[i] = c[i - 1] + 1;
|
||||
++i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static inline void raid_xgetbv(uint32_t* reg)
|
|||
asm volatile (
|
||||
/* uses a direct encoding of the XGETBV instruction as only recent */
|
||||
/* assemblers support it. */
|
||||
/* the next line is equivalent at: "xgetbv\n" */
|
||||
/* the next line is equivalent to: "xgetbv\n" */
|
||||
".byte 0x0f, 0x01, 0xd0\n"
|
||||
: "=a" (reg[0]), "=d" (reg[3])
|
||||
: "c" (0)
|
||||
|
|
@ -114,7 +114,7 @@ static inline int raid_cpu_has_sse2(void)
|
|||
* Before an application attempts to use the SSE and/or SSE2 extensions, it should check
|
||||
* that they are present on the processor:
|
||||
* 1. Check that the processor supports the CPUID instruction. Bit 21 of the EFLAGS
|
||||
* register can be used to check processor's support the CPUID instruction.
|
||||
* register can be used to check if the processor supports the CPUID instruction.
|
||||
* 2. Check that the processor supports the SSE and/or SSE2 extensions (true if
|
||||
* CPUID.01H:EDX.SSE[bit 25] = 1 and/or CPUID.01H:EDX.SSE2[bit 26] = 1).
|
||||
*/
|
||||
|
|
@ -266,7 +266,7 @@ static inline int raid_cpu_has_slowmult(void)
|
|||
|
||||
/**
|
||||
* Check if the processor has a slow extended set of SSE registers.
|
||||
* If yes, it's better to limit the unroll to the firsrt 8 registers.
|
||||
* If yes, it's better to limit the unrolling to the first 8 registers.
|
||||
*/
|
||||
static inline int raid_cpu_has_slowextendedreg(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ void raid_rec1_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv)
|
|||
|
||||
(void)nr; /* unused, it's always 1 */
|
||||
|
||||
/* if it's RAID5 uses the faster function */
|
||||
/* if it's RAID5, use the faster function */
|
||||
if (ip[0] == 0) {
|
||||
raid_rec1of1(id, nd, size, vv);
|
||||
return;
|
||||
|
|
@ -441,7 +441,7 @@ void raid_rec2_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv)
|
|||
|
||||
(void)nr; /* unused, it's always 2 */
|
||||
|
||||
/* if it's RAID6 recovering with P and Q uses the faster function */
|
||||
/* if it's RAID6, recovering with P and Q uses the faster function */
|
||||
if (ip[0] == 0 && ip[1] == 1) {
|
||||
raid_rec2of2_int8(id, ip, nd, size, vv);
|
||||
return;
|
||||
|
|
@ -489,7 +489,7 @@ void raid_rec2_int8(int nr, int *id, int *ip, int nd, size_t size, void **vv)
|
|||
*
|
||||
* we solve inverting the coefficients matrix.
|
||||
*
|
||||
* Note that referring at previous equations you have:
|
||||
* Note that referring to previous equations you have:
|
||||
* PD[0] = Pd, PD[1] = Qd, PD[2] = Rd, ...
|
||||
* D[0] = Dx, D[1] = Dy, D[2] = Dz, ...
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* end.
|
||||
*
|
||||
* To avoid this effect, it's better if all the blocks are allocated
|
||||
* with a fixed displacement trying to reduce the cache addresses sharing.
|
||||
* with a fixed displacement trying to reduce the cache address sharing.
|
||||
*
|
||||
* The selected displacement was chosen empirically with some speed tests
|
||||
* with 8/12/16/20/24 data buffers of 256 KB.
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
* gen2 6814 [MB/s]
|
||||
* genz 3033 [MB/s]
|
||||
*
|
||||
* These are the results with displacement resulting in improvements
|
||||
* These are the results with displacement, resulting in improvements
|
||||
* in the order of 20% or more:
|
||||
*
|
||||
* sse2
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ static void set_cauchy(uint8_t *matrix)
|
|||
uint8_t inv_x, y;
|
||||
|
||||
/*
|
||||
* The first row of the generator matrix is formed by all 1.
|
||||
* The first row of the generator matrix is formed by all 1s.
|
||||
*
|
||||
* The generator matrix is an Extended Cauchy matrix built from
|
||||
* a Cauchy matrix adding at the top a row of all 1.
|
||||
* a Cauchy matrix by adding a row at the top of all 1s.
|
||||
*
|
||||
* Extending a Cauchy matrix in this way maintains the MDS property
|
||||
* of the matrix.
|
||||
|
|
@ -74,7 +74,7 @@ static void set_cauchy(uint8_t *matrix)
|
|||
matrix[0 * DISK + i] = 1;
|
||||
|
||||
/*
|
||||
* Second row is formed with powers 2^i, and it's the first
|
||||
* The second row is formed with powers 2^i, and it's the first
|
||||
* row of the Cauchy matrix.
|
||||
*
|
||||
* Each element of the Cauchy matrix is in the form 1/(x_i + y_j)
|
||||
|
|
@ -111,7 +111,7 @@ static void set_cauchy(uint8_t *matrix)
|
|||
}
|
||||
|
||||
/*
|
||||
* The rest of the Cauchy matrix is formed choosing for each row j
|
||||
* The rest of the Cauchy matrix is formed by choosing for each row j
|
||||
* a new y_j = 2^j and reusing the x_i already assigned in the first
|
||||
* row obtaining :
|
||||
*
|
||||
|
|
@ -145,7 +145,7 @@ static void set_cauchy(uint8_t *matrix)
|
|||
}
|
||||
|
||||
/*
|
||||
* Finally we adjust the matrix multiplying each row for
|
||||
* Finally we adjust the matrix multiplying each row by
|
||||
* the inverse of the first element in the row.
|
||||
*
|
||||
* Also this operation maintains the MDS property of the matrix.
|
||||
|
|
@ -261,7 +261,7 @@ int main(void)
|
|||
/* 1/a */
|
||||
printf("const uint8_t __aligned(256) raid_gfinv[256] =\n");
|
||||
printf("{\n");
|
||||
printf("\t/* note that the first element is not significative */\n");
|
||||
printf("\t/* note that the first element is not significant */\n");
|
||||
for (i = 0; i < 256; ++i) {
|
||||
if (i % 8 == 0)
|
||||
printf("\t");
|
||||
|
|
@ -282,7 +282,7 @@ int main(void)
|
|||
|
||||
printf("/**\n");
|
||||
printf(" * Power matrix used to generate parity.\n");
|
||||
printf(" * This matrix is valid for up to %u parity with %u data disks.\n", 3, DISK);
|
||||
printf(" * This matrix is valid for up to %u parities with %u data disks.\n", 3, DISK);
|
||||
printf(" *\n");
|
||||
for (p = 0; p < 3; ++p) {
|
||||
printf(" *");
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ void raid_delta_gen(int nr, int *id, int *ip, int nd, size_t size, void **v)
|
|||
} else {
|
||||
/*
|
||||
* Unused parities are going to be rewritten with
|
||||
* not significative data, because we don't have
|
||||
* not significant data, because we don't have
|
||||
* functions able to compute only a subset of
|
||||
* parities.
|
||||
*
|
||||
|
|
|
|||
12
raid/raid.h
12
raid/raid.h
|
|
@ -83,7 +83,7 @@ void raid_zero(void *zero);
|
|||
*
|
||||
* @nd Number of data blocks.
|
||||
* @np Number of parities blocks to compute.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiplier of 64.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiple of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @np) elements. The starting elements are the blocks for
|
||||
* data, following with the parity blocks.
|
||||
|
|
@ -119,7 +119,7 @@ void raid_gen(int nd, int np, size_t size, void **v);
|
|||
* @nd + 1, just like positions in the @v vector.
|
||||
* @nd Number of data blocks.
|
||||
* @np Number of parity blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiplier of 64.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiple of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @np) elements. The starting elements are the blocks
|
||||
* for data, following with the parity blocks.
|
||||
|
|
@ -139,7 +139,7 @@ void raid_rec(int nr, int *ir, int nd, int np, size_t size, void **v);
|
|||
* @ip[] Vector of @nr indexes of the parity blocks to use for recovering.
|
||||
* The indexes start from 0. They must be in order.
|
||||
* @nd Number of data blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiplier of 64.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiple of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @ip[@nr - 1] + 1) elements. The starting elements are the
|
||||
* blocks for data, following with the parity blocks.
|
||||
|
|
@ -166,7 +166,7 @@ void raid_data(int nr, int *id, int *ip, int nd, size_t size, void **v);
|
|||
* @nd + 1, just like positions in the @v vector.
|
||||
* @nd Number of data blocks.
|
||||
* @np Number of parity blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiplier of 64.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiple of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @np) elements. The starting elements are the blocks
|
||||
* for data, following with the parity blocks.
|
||||
|
|
@ -182,7 +182,7 @@ int raid_check(int nr, int *ir, int nd, int np, size_t size, void **v);
|
|||
* available redundancy.
|
||||
*
|
||||
* It uses a brute force method, and then the call can be expensive.
|
||||
* The expected execution time is proportional at the binomial coefficient
|
||||
* The expected execution time is proportional to the binomial coefficient
|
||||
* @np + @nd choose @np - 1, usually written as:
|
||||
*
|
||||
* ( @np + @nd )
|
||||
|
|
@ -203,7 +203,7 @@ int raid_check(int nr, int *ir, int nd, int np, size_t size, void **v);
|
|||
* @nd + 1, just like positions in the @v vector.
|
||||
* @nd Number of data blocks.
|
||||
* @np Number of parity blocks.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiplier of 64.
|
||||
* @size Size of the blocks pointed by @v. It must be a multiple of 64.
|
||||
* @v Vector of pointers to the blocks of data and parity.
|
||||
* It has (@nd + @np) elements. The starting elements are the blocks
|
||||
* for data, following with the parity blocks.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
/**
|
||||
* Tests insertion function.
|
||||
*
|
||||
* Test raid_insert() with all the possible combinations of elements to insert.
|
||||
* Tests raid_insert() with all the possible combinations of elements to insert.
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
|
|
@ -16,7 +16,7 @@ int raid_test_insert(void);
|
|||
/**
|
||||
* Tests sorting function.
|
||||
*
|
||||
* Test raid_sort() with all the possible combinations of elements to sort.
|
||||
* Tests raid_sort() with all the possible combinations of elements to sort.
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ void raid_gen3_ssse3(int nd, size_t size, void **vv)
|
|||
asm volatile ("movdqa %0,%%xmm7" : : "m" (gfconst16.low4[0]));
|
||||
|
||||
for (i = 0; i < size; i += 16) {
|
||||
/* last disk without the by two multiplication */
|
||||
/* last disk without the multiplication by two */
|
||||
asm volatile ("movdqa %0,%%xmm4" : : "m" (v[l][i]));
|
||||
|
||||
asm volatile ("movdqa %xmm4,%xmm0");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue