/** * Load the snapshots section from fsimage. Also convert snapshottable directories into {@link * INodeDirectorySnapshottable}. */ public void loadSnapshotSection(InputStream in) throws IOException { SnapshotManager sm = fsn.getSnapshotManager(); SnapshotSection section = SnapshotSection.parseDelimitedFrom(in); int snum = section.getNumSnapshots(); sm.setNumSnapshots(snum); sm.setSnapshotCounter(section.getSnapshotCounter()); for (long sdirId : section.getSnapshottableDirList()) { INodeDirectory dir = fsDir.getInode(sdirId).asDirectory(); final INodeDirectorySnapshottable sdir; if (!dir.isSnapshottable()) { sdir = new INodeDirectorySnapshottable(dir); fsDir.addToInodeMap(sdir); } else { // dir is root, and admin set root to snapshottable before sdir = (INodeDirectorySnapshottable) dir; sdir.setSnapshotQuota(INodeDirectorySnapshottable.SNAPSHOT_LIMIT); } sm.addSnapshottable(sdir); } loadSnapshots(in, snum); }