From: <tho...@us...> - 2010-11-18 19:26:25
|
Revision: 3969 http://bigdata.svn.sourceforge.net/bigdata/?rev=3969&view=rev Author: thompsonbry Date: 2010-11-18 19:26:19 +0000 (Thu, 18 Nov 2010) Log Message: ----------- Renamed m_bits to m_live to be in keeping with the wiki documentation. Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java 2010-11-18 19:18:43 UTC (rev 3968) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java 2010-11-18 19:26:19 UTC (rev 3969) @@ -31,7 +31,7 @@ /** * Bit maps for an allocator. The allocator is a bit map managed as int[]s. * - * @todo change to make {@link #m_transients}, {@link #m_bits}, and + * @todo change to make {@link #m_transients}, {@link #m_live}, and * {@link #m_commit} final fields and then modify {@link FixedAllocator} * to use {@link System#arraycopy(Object, int, Object, int, int)} to copy * the data rather than cloning it. @@ -70,7 +70,7 @@ * Just the newly allocated bits. This will be copied onto {@link #m_commit} * when the current native transaction commits. */ - final int m_bits[]; + final int m_live[]; /** * All of the bits from the commit point on entry to the current native * transaction plus any newly allocated bits. @@ -86,7 +86,7 @@ // m_writeCache = cache; m_ints = bitSize; m_commit = new int[bitSize]; - m_bits = new int[bitSize]; + m_live = new int[bitSize]; m_transients = new int[bitSize]; } @@ -98,7 +98,7 @@ // Now check to see if it allocated final int bit = (addr - m_addr) / size; - return RWStore.tstBit(m_bits, bit); + return RWStore.tstBit(m_live, bit); } public boolean addressInRange(final int addr, final int size) { @@ -116,7 +116,7 @@ } public boolean freeBit(final int bit) { - if (!RWStore.tstBit(m_bits, bit)) { + if (!RWStore.tstBit(m_live, bit)) { throw new IllegalArgumentException("Freeing bit not set"); } @@ -129,7 +129,7 @@ * output to the file by removing any pending write to the now freed * address. On large transaction scopes this may be significant. */ - RWStore.clrBit(m_bits, bit); + RWStore.clrBit(m_live, bit); if (!RWStore.tstBit(m_commit, bit)) { RWStore.clrBit(m_transients, bit); @@ -162,7 +162,7 @@ final int bit = RWStore.fndBit(m_transients, m_ints); if (bit != -1) { - RWStore.setBit(m_bits, bit); + RWStore.setBit(m_live, bit); RWStore.setBit(m_transients, bit); return bit; @@ -173,7 +173,7 @@ public boolean hasFree() { for (int i = 0; i < m_ints; i++) { - if (m_bits[i] != 0xFFFFFFFF) { + if (m_live[i] != 0xFFFFFFFF) { return true; } } @@ -185,7 +185,7 @@ int total = m_ints * 32; int allocBits = 0; for (int i = 0; i < total; i++) { - if (RWStore.tstBit(m_bits, i)) { + if (RWStore.tstBit(m_live, i)) { allocBits++; } } @@ -211,7 +211,7 @@ final int total = m_ints * 32; for (int i = 0; i < total; i++) { - if (RWStore.tstBit(m_bits, i)) { + if (RWStore.tstBit(m_live, i)) { addrs.add(new Integer(rootAddr - i)); } } Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2010-11-18 19:18:43 UTC (rev 3968) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2010-11-18 19:26:19 UTC (rev 3969) @@ -61,7 +61,7 @@ if (log.isDebugEnabled()) log.debug("Restored index " + index + " with " + getStartAddr() - + "[" + fb.m_bits[0] + "] from " + m_diskAddr); + + "[" + fb.m_live[0] + "] from " + m_diskAddr); m_index = index; } @@ -111,7 +111,7 @@ final int bit = offset % allocBlockRange; - if (RWStore.tstBit(block.m_bits, bit)) { + if (RWStore.tstBit(block.m_live, bit)) { return RWStore.convertAddr(block.m_addr) + ((long) m_size * bit); } else { return 0L; @@ -170,7 +170,7 @@ try { final AllocBlock fb = m_allocBlocks.get(0); if (log.isDebugEnabled()) - log.debug("writing allocator " + m_index + " for " + getStartAddr() + " with " + fb.m_bits[0]); + log.debug("writing allocator " + m_index + " for " + getStartAddr() + " with " + fb.m_live[0]); final byte[] buf = new byte[1024]; final DataOutputStream str = new DataOutputStream(new FixedOutputStream(buf)); try { @@ -182,11 +182,11 @@ str.writeInt(block.m_addr); for (int i = 0; i < m_bitSize; i++) { - str.writeInt(block.m_bits[i]); + str.writeInt(block.m_live[i]); } // if (!m_store.isSessionPreserved()) { - block.m_transients = block.m_bits.clone(); + block.m_transients = block.m_live.clone(); // } /** @@ -196,11 +196,11 @@ if (m_context != null) { assert block.m_saveCommit != null; - block.m_saveCommit = block.m_bits.clone(); + block.m_saveCommit = block.m_live.clone(); // } else if (m_store.isSessionPreserved()) { // block.m_commit = block.m_transients.clone(); } else { - block.m_commit = block.m_bits.clone(); + block.m_commit = block.m_live.clone(); } } // add checksum @@ -243,17 +243,17 @@ block.m_addr = str.readInt(); for (int i = 0; i < m_bitSize; i++) { - block.m_bits[i] = str.readInt(); + block.m_live[i] = str.readInt(); /** * Need to calc how many free blocks are available, minor * optimization by checking against either empty or full to * avoid scanning every bit unnecessarily **/ - if (block.m_bits[i] == 0) { // empty + if (block.m_live[i] == 0) { // empty m_freeBits += 32; - } else if (block.m_bits[i] != 0xFFFFFFFF) { // not full - final int anInt = block.m_bits[i]; + } else if (block.m_live[i] != 0xFFFFFFFF) { // not full + final int anInt = block.m_live[i]; for (int bit = 0; bit < 32; bit++) { if ((anInt & (1 << bit)) == 0) { m_freeBits++; @@ -262,8 +262,8 @@ } } - block.m_transients = (int[]) block.m_bits.clone(); - block.m_commit = (int[]) block.m_bits.clone(); + block.m_transients = (int[]) block.m_live.clone(); + block.m_commit = (int[]) block.m_live.clone(); if (m_startAddr == 0) { m_startAddr = block.m_addr; @@ -642,7 +642,7 @@ final int bit = offset % allocBlockRange; - return RWStore.tstBit(block.m_bits, bit); + return RWStore.tstBit(block.m_live, bit); } public boolean isCommitted(int offset) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |