private int getNumNonNull(INodesInPath iip) { List<INode> inodes = iip.getReadOnlyINodes(); for (int i = inodes.size() - 1; i >= 0; i--) { if (inodes.get(i) != null) { return i+1; } } return 0; }
/** * Looks up the EncryptionZoneInt for a path within an encryption zone. * Returns null if path is not within an EZ. * <p/> * Must be called while holding the manager lock. */ private EncryptionZoneInt getEncryptionZoneForPath(INodesInPath iip) { assert dir.hasReadLock(); Preconditions.checkNotNull(iip); if (!hasCreatedEncryptionZone()) { return null; } List<INode> inodes = iip.getReadOnlyINodes(); for (int i = inodes.size() - 1; i >= 0; i--) { final INode inode = inodes.get(i); if (inode != null) { final EncryptionZoneInt ezi = encryptionZones.get(inode.getId()); if (ezi != null) { return ezi; } } } return null; }
/** * Looks up the EncryptionZoneInt for a path within an encryption zone. * Returns null if path is not within an EZ. * <p/> * Must be called while holding the manager lock. */ private EncryptionZoneInt getEncryptionZoneForPath(INodesInPath iip) { assert dir.hasReadLock(); Preconditions.checkNotNull(iip); if (!hasCreatedEncryptionZone()) { return null; } List<INode> inodes = iip.getReadOnlyINodes(); for (int i = inodes.size() - 1; i >= 0; i--) { final INode inode = inodes.get(i); if (inode != null) { final EncryptionZoneInt ezi = encryptionZones.get(inode.getId()); if (ezi != null) { return ezi; } } } return null; }