#include "blockcheck.h"
 
 
-
 /*
  * We use the following conventions:
  *
  * p = # parity bits
  * c = # total code bits (d + p)
  */
-static int calc_parity_bits(unsigned int d)
-{
-       unsigned int p;
-
-       /*
-        * Bits required for Single Error Correction is as follows:
-        *
-        * d + p + 1 <= 2^p
-        *
-        * We're restricting ourselves to 31 bits of parity, that should be
-        * sufficient.
-        */
-       for (p = 1; p < 32; p++)
-       {
-               if ((d + p + 1) <= (1 << p))
-                       return p;
-       }
-
-       return 0;
-}
 
 /*
  * Calculate the bit offset in the hamming code buffer based on the bit's
  */
 u32 ocfs2_hamming_encode(u32 parity, void *data, unsigned int d, unsigned int nr)
 {
-       unsigned int p = calc_parity_bits(nr + d);
-       unsigned int i, j, b;
+       unsigned int i, b;
 
-       BUG_ON(!p);
+       BUG_ON(!d);
 
        /*
         * b is the hamming code bit number.  Hamming code specifies a
                 */
                b = calc_code_bit(nr + i);
 
-               for (j = 0; j < p; j++)
-               {
-                       /*
-                        * Data bits in the resultant code are checked by
-                        * parity bits that are part of the bit number
-                        * representation.  Huh?
-                        *
-                        * <wikipedia href="http://en.wikipedia.org/wiki/Hamming_code">
-                        * In other words, the parity bit at position 2^k
-                        * checks bits in positions having bit k set in
-                        * their binary representation.  Conversely, for
-                        * instance, bit 13, i.e. 1101(2), is checked by
-                        * bits 1000(2) = 8, 0100(2)=4 and 0001(2) = 1.
-                        * </wikipedia>
-                        *
-                        * Note that 'k' is the _code_ bit number.  'b' in
-                        * our loop.
-                        */
-                       if (b & (1 << j))
-                               parity ^= (1 << j);
-               }
+               /*
+                * Data bits in the resultant code are checked by
+                * parity bits that are part of the bit number
+                * representation.  Huh?
+                *
+                * <wikipedia href="http://en.wikipedia.org/wiki/Hamming_code">
+                * In other words, the parity bit at position 2^k
+                * checks bits in positions having bit k set in
+                * their binary representation.  Conversely, for
+                * instance, bit 13, i.e. 1101(2), is checked by
+                * bits 1000(2) = 8, 0100(2)=4 and 0001(2) = 1.
+                * </wikipedia>
+                *
+                * Note that 'k' is the _code_ bit number.  'b' in
+                * our loop.
+                */
+               parity ^= b;
        }
 
        /* While the data buffer was treated as little endian, the
 void ocfs2_hamming_fix(void *data, unsigned int d, unsigned int nr,
                       unsigned int fix)
 {
-       unsigned int p = calc_parity_bits(nr + d);
        unsigned int i, b;
 
-       BUG_ON(!p);
+       BUG_ON(!d);
 
        /*
         * If the bit to fix has an hweight of 1, it's a parity bit.  One