Increments the number of bytes read from remote racks during file fix
operations of the this integrity monitor
167440
protected synchronized void incrFileFixReadBytesRemoteRack(long incr) {
    if (incr < 0) {
      throw new IllegalArgumentException("Cannot increment by negative value " +
                                         incr);
    }
    
    RaidNodeMetrics.getInstance(RaidNodeMetrics.DEFAULT_NAMESPACE_ID).numFileFixReadBytesRemoteRack.inc(incr);
    numfileFixBytesReadRemoteRack += incr;
  }
1057577
private void readMore(final int bytesRequired) throws IOException {
        if ((long) used + (long) bytesRequired > FileUtils.MAX_BUFFER_SIZE) {
            // Since buf is an array, we're limited to reading 2GB per file
            throw new IOException("File is larger than 2GB, cannot read it");
        }
        // Read INITIAL_BUFFER_CHUNK_SIZE for first chunk, or SUBSEQUENT_BUFFER_CHUNK_SIZE for subsequent chunks,
        // but don't try to read past 2GB limit
        final int targetReadSize = Math.max(bytesRequired, // 
                used == 0 ? INITIAL_BUFFER_CHUNK_SIZE : SUBSEQUENT_BUFFER_CHUNK_SIZE);
        // Calculate number of bytes to read, based on the target read size, handling integer overflow
        final int maxNewUsed = (int) Math.min((long) used + (long) targetReadSize, FileUtils.MAX_BUFFER_SIZE);
        final int bytesToRead = maxNewUsed - used;
        if (maxNewUsed > buf.length) {
            // Ran out of space, need to increase the size of the buffer
            long newBufLen = buf.length;
            while (newBufLen < maxNewUsed) {
                newBufLen <<= 1;
            }
            buf = Arrays.copyOf(buf, (int) Math.min(newBufLen, FileUtils.MAX_BUFFER_SIZE));
        }
        int extraBytesStillNotRead = bytesToRead;
        int totBytesRead = 0;
        while (extraBytesStillNotRead > 0) {
            final int bytesRead = read(used, extraBytesStillNotRead);
            if (bytesRead > 0) {
                used += bytesRead;
                totBytesRead += bytesRead;
                extraBytesStillNotRead -= bytesRead;
            } else {
                // EOF
                break;
            }
        }
        if (totBytesRead < bytesRequired) {
            throw new IOException("Premature EOF while reading classfile");
        }
    }
953057
def update_counter(self, bucket, key, value, w=None, dw=None, pw=None,
                       returnvalue=False):
        
        raise NotImplementedError
766902
private void maybeEvictFilesInCacheDir() throws IOException {
    synchronized (mLock) {
      boolean calculatedRightNow = maybeUpdateFileCacheSize();

      // Update the size limit (mCacheSizeLimit)
      updateFileCacheSizeLimit();

      long cacheSize = mCacheStats.getSize();
      // If we are going to evict force a recalculation of the size
      // (except if it was already calculated!)
      if (cacheSize > mCacheSizeLimit && !calculatedRightNow) {
        mCacheStats.reset();
        maybeUpdateFileCacheSize();
      }

      // If size has exceeded the size limit, evict some files
      if (cacheSize > mCacheSizeLimit) {
      evictAboveSize(
          mCacheSizeLimit * 9 / 10,
          CacheEventListener.EvictionReason.CACHE_FULL); // 90%
      }
    }
  }
1274746
private void updateFdMetrics() {
    if (osMbean instanceof com.sun.management.UnixOperatingSystemMXBean) {
      final com.sun.management.UnixOperatingSystemMXBean unix =
          (com.sun.management.UnixOperatingSystemMXBean) osMbean;

      fdCount.setValue(unix.getOpenFileDescriptorCount());
      fdLimit.setValue(unix.getMaxFileDescriptorCount());
    }
  }
147139
static void incrementCounter(byte[] counter, byte[] oldCounter) throws GeneralSecurityException {
    System.arraycopy(counter, 0, oldCounter, 0, counter.length);
    int i = 0;
    for (; i < COUNTER_OVERFLOW_LENGTH; i++) {
      counter[i]++;
      if (counter[i] != (byte) 0x00) {
        break;
      }
    }

    if (i == COUNTER_OVERFLOW_LENGTH) {
      // Restore old counter value to ensure that encrypt and decrypt keep failing.
      System.arraycopy(oldCounter, 0, counter, 0, counter.length);
      throw new GeneralSecurityException("Counter has overflowed.");
    }
  }
894646
def update_status(dbfile,status_file,nas_addr):
    ''' 
    '''
    try:
        total = 0
        params = []
        for sid, su in  parse_status_file(status_file, nas_addr).items():
            if 'session_id' in su and 'inbytes' in su and 'outbytes' in su:
                params.append((su['inbytes'],su['outbytes'],su['session_id']))
                total += 1
        statusdb.batch_update_client(dbfile,params)
        log.msg('update_status total = %s' % total)
    except Exception, e:
        log.err('batch update status error')
        log.err(e)
883314
public synchronized void onRequestSucceeded(long responeLatencyInMicros) {
		executing.decrement();
		succeeded.increment();
		counter.addMicro(responeLatencyInMicros);
		histogram.add(responeLatencyInMicros);
	}
574326
@GuardedBy("mLock")
  private void updateFileCacheSizeLimit() {
    // Test if mCacheSizeLimit can be set to the high limit
    boolean isAvailableSpaceLowerThanHighLimit;
    StatFsHelper.StorageType storageType =
        mStorage.isExternal()
            ? StatFsHelper.StorageType.EXTERNAL
            : StatFsHelper.StorageType.INTERNAL;
    isAvailableSpaceLowerThanHighLimit =
        mStatFsHelper.testLowDiskSpace(
            storageType,
            mDefaultCacheSizeLimit - mCacheStats.getSize());
    if (isAvailableSpaceLowerThanHighLimit) {
      mCacheSizeLimit = mLowDiskSpaceCacheSizeLimit;
    } else {
      mCacheSizeLimit = mDefaultCacheSizeLimit;
    }
  }
1344015
public boolean updateIOCounts(long byteCount, int type) {

        setLastIOAmt(byteCount);
        setIODoneAmount(getIODoneAmount() + byteCount);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            String dbString = null;
            if (type == 0) {
                dbString = "Read ";
            } else {
                dbString = "Wrote ";
            }
            SocketIOChannel channel = getTCPConnLink().getSocketIOChannel();
            Tr.event(tc, dbString + byteCount + "(" + +getIODoneAmount() + ")" + " bytes, " + getIOAmount() + " requested on local: " + channel.getSocket().getLocalSocketAddress()
                         + " remote: " + channel.getSocket().getRemoteSocketAddress());
        }

        boolean rc;
        if (getIODoneAmount() >= getIOAmount()) {
            // read is complete on current thread
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                if (type == 0) {
                    Tr.debug(tc, "read complete, at least minimum amount of data read");
                } else {
                    Tr.debug(tc, "write complete, at least minimum amount of data written");
                }
            }
            rc = true;
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                if (type == 0) {
                    Tr.debug(tc, "read not complete, more data needed");
                } else {
                    Tr.debug(tc, "write not complete, more data needs to be written");
                }
            }
            rc = false;
        }
        return rc;
    }
985207
def increment_client_count(self, ofs = 1):
        """"""
        self._uc += ofs
        assert self._uc > -1, "Increments must match decrements, usage counter negative: %i" % self._uc

        if self.client_count() == 0:
            self.release()
            return True
        else:
            return False
433947
private void loadBytesAsNeeded() throws IOException {
        if (available() <= 0) {
            _isEof = true;
        }

        while ((!_isEof) && (bytesLeftInBuffer() <= 0)) {
            _currentBufferPosition = 0;
            NfsReadResponse response = _file.read(_offset, _bytes.length, _bytes, _currentBufferPosition);
            _bytesInBuffer = response.getBytesRead();
            _offset += _bytesInBuffer;
            _isEof = response.isEof();
        }
    }
923200
protected void updateBytesRead() {
        if (log.isTraceEnabled()) {
            log.trace("updateBytesRead");
        }
        long bytesRead = getReadBytes();
        if (bytesRead >= nextBytesRead) {
            BytesRead sbr = new BytesRead((int) (bytesRead % Integer.MAX_VALUE));
            getChannel(2).write(sbr);
            nextBytesRead += bytesReadInterval;
        }
    }
735366
def _net_read(sock, count, expiration):
    
    s = ''
    while count > 0:
        _wait_for_readable(sock, expiration)
        n = sock.recv(count)
        if n == '':
            raise EOFError
        count = count - len(n)
        s = s + n
    return s
807309
def _update_seek(self, offset, whence):
        
        with self._seek_lock:
            if whence == SEEK_SET:
                self._seek = offset
            elif whence == SEEK_CUR:
                self._seek += offset
            elif whence == SEEK_END:
                self._seek = offset + self._size
            else:
                raise ValueError('whence value %s unsupported' % whence)
        return self._seek
1112875
protected synchronized void incrFileCopyFailures(long incr) {
    if (incr < 0) {
      throw new IllegalArgumentException("Cannot increment by negative value " +
                                         incr);
    }

    RaidNodeMetrics.getInstance(RaidNodeMetrics.DEFAULT_NAMESPACE_ID).fileCopyFailures.inc(incr);
    numFileCopyFailures += incr;
  }
1067905
def number_of_modified_bytes(buf, fuzzed_buf):
    
    count = 0
    for idx, b in enumerate(buf):
        if b != fuzzed_buf[idx]:
            count += 1
    return count