/** * Remove leases and inodes related to a given path * @param removedUCFiles INodes whose leases need to be released * @param removedINodes Containing the list of inodes to be removed from * inodesMap * @param acquireINodeMapLock Whether to acquire the lock for inode removal */ void removeLeasesAndINodes(List<Long> removedUCFiles, List<INode> removedINodes, final boolean acquireINodeMapLock) { assert hasWriteLock(); for(long i : removedUCFiles) { leaseManager.removeLease(i); } // remove inodes from inodesMap if (removedINodes != null) { if (acquireINodeMapLock) { dir.writeLock(); } try { dir.removeFromInodeMap(removedINodes); } finally { if (acquireINodeMapLock) { dir.writeUnlock(); } } removedINodes.clear(); } }
snapshotManager.deleteSnapshot(iip, snapshotName, context); fsd.updateCount(iip, context.quotaDelta(), false); fsd.removeFromInodeMap(removedINodes); fsd.updateReplicationFactor(context.collectedBlocks() .toUpdateReplicationInfo());
/** * Remove leases and inodes related to a given path * @param src The given path * @param removedINodes Containing the list of inodes to be removed from * inodesMap * @param acquireINodeMapLock Whether to acquire the lock for inode removal */ void removeLeasesAndINodes(String src, List<INode> removedINodes, final boolean acquireINodeMapLock) { assert hasWriteLock(); leaseManager.removeLeaseWithPrefixPath(src); // remove inodes from inodesMap if (removedINodes != null) { if (acquireINodeMapLock) { dir.writeLock(); } try { dir.removeFromInodeMap(removedINodes); } finally { if (acquireINodeMapLock) { dir.writeUnlock(); } } removedINodes.clear(); } }
/** * Remove leases and inodes related to a given path * @param src The given path * @param removedINodes Containing the list of inodes to be removed from * inodesMap * @param acquireINodeMapLock Whether to acquire the lock for inode removal */ void removeLeasesAndINodes(String src, List<INode> removedINodes, final boolean acquireINodeMapLock) { assert hasWriteLock(); leaseManager.removeLeaseWithPrefixPath(src); // remove inodes from inodesMap if (removedINodes != null) { if (acquireINodeMapLock) { dir.writeLock(); } try { dir.removeFromInodeMap(removedINodes); } finally { if (acquireINodeMapLock) { dir.writeUnlock(); } } removedINodes.clear(); } }
collectedBlocks); collectedBlocks.clear(); fsNamesys.dir.removeFromInodeMap(removedINodes); removedINodes.clear();
/** * Delete a snapshot of a snapshottable directory * @param snapshotRoot The snapshottable directory * @param snapshotName The name of the to-be-deleted snapshot * @throws IOException */ static INode.BlocksMapUpdateInfo deleteSnapshot( FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot, String snapshotName, boolean logRetryCache) throws IOException { final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot); if (fsd.isPermissionEnabled()) { FSPermissionChecker pc = fsd.getPermissionChecker(); fsd.checkOwner(pc, iip); } INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo(); ChunkedArrayList<INode> removedINodes = new ChunkedArrayList<INode>(); fsd.writeLock(); try { snapshotManager.deleteSnapshot(iip, snapshotName, collectedBlocks, removedINodes); fsd.removeFromInodeMap(removedINodes); } finally { fsd.writeUnlock(); } removedINodes.clear(); fsd.getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName, logRetryCache); return collectedBlocks; }
/** * Delete a snapshot of a snapshottable directory * @param snapshotRoot The snapshottable directory * @param snapshotName The name of the to-be-deleted snapshot * @throws IOException */ static INode.BlocksMapUpdateInfo deleteSnapshot( FSDirectory fsd, SnapshotManager snapshotManager, String snapshotRoot, String snapshotName, boolean logRetryCache) throws IOException { final INodesInPath iip = fsd.getINodesInPath4Write(snapshotRoot); if (fsd.isPermissionEnabled()) { FSPermissionChecker pc = fsd.getPermissionChecker(); fsd.checkOwner(pc, iip); } INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo(); ChunkedArrayList<INode> removedINodes = new ChunkedArrayList<INode>(); fsd.writeLock(); try { snapshotManager.deleteSnapshot(iip, snapshotName, collectedBlocks, removedINodes); fsd.removeFromInodeMap(removedINodes); } finally { fsd.writeUnlock(); } removedINodes.clear(); fsd.getEditLog().logDeleteSnapshot(snapshotRoot, snapshotName, logRetryCache); return collectedBlocks; }
fsNamesys.removeBlocksAndUpdateSafemodeTotal(collectedBlocks); collectedBlocks.clear(); fsNamesys.dir.removeFromInodeMap(removedINodes); removedINodes.clear();
fsNamesys.removeBlocksAndUpdateSafemodeTotal(collectedBlocks); collectedBlocks.clear(); fsNamesys.dir.removeFromInodeMap(removedINodes); removedINodes.clear();