@@ -66,6 +66,7 @@ public class LocalFileSystem implements VirtualFileSystem {
6666 private static final Logger LOG = LoggerFactory .getLogger (LocalFileSystem .class );
6767
6868 private final Path _root ;
69+ private final FileStore _store ;
6970 private final NonBlockingHashMapLong <Path > inodeToPath = new NonBlockingHashMapLong <>();
7071 private final NonBlockingHashMap <Path , Long > pathToInode = new NonBlockingHashMap <>();
7172 private final AtomicLong fileId = new AtomicLong (1 ); //numbering starts at 1
@@ -150,6 +151,7 @@ private void remap(long inodeNumber, Path oldPath, Path newPath) {
150151 public LocalFileSystem (Path root , Iterable <FsExport > exportIterable ) throws IOException {
151152 _root = root ;
152153 assert (Files .exists (_root ));
154+ _store = Files .getFileStore (_root );
153155 for (FsExport export : exportIterable ) {
154156 String relativeExportPath = export .getPath ().substring (1 ); // remove the opening '/'
155157 Path exportRootPath = root .resolve (relativeExportPath );
@@ -203,9 +205,8 @@ public Inode create(Inode parent, Type type, String path, Subject subject, int m
203205
204206 @ Override
205207 public FsStat getFsStat () throws IOException {
206- FileStore store = Files .getFileStore (_root );
207- long total = store .getTotalSpace ();
208- long free = store .getUsableSpace ();
208+ long total = _store .getTotalSpace ();
209+ long free = _store .getUsableSpace ();
209210 return new FsStat (total , Long .MAX_VALUE , total -free , pathToInode .size ());
210211 }
211212
0 commit comments