@@ -66,6 +66,7 @@ public class LocalFileSystem implements VirtualFileSystem {
66
66
private static final Logger LOG = LoggerFactory .getLogger (LocalFileSystem .class );
67
67
68
68
private final Path _root ;
69
+ private final FileStore _store ;
69
70
private final NonBlockingHashMapLong <Path > inodeToPath = new NonBlockingHashMapLong <>();
70
71
private final NonBlockingHashMap <Path , Long > pathToInode = new NonBlockingHashMap <>();
71
72
private final AtomicLong fileId = new AtomicLong (1 ); //numbering starts at 1
@@ -150,6 +151,7 @@ private void remap(long inodeNumber, Path oldPath, Path newPath) {
150
151
public LocalFileSystem (Path root , Iterable <FsExport > exportIterable ) throws IOException {
151
152
_root = root ;
152
153
assert (Files .exists (_root ));
154
+ _store = Files .getFileStore (_root );
153
155
for (FsExport export : exportIterable ) {
154
156
String relativeExportPath = export .getPath ().substring (1 ); // remove the opening '/'
155
157
Path exportRootPath = root .resolve (relativeExportPath );
@@ -203,9 +205,8 @@ public Inode create(Inode parent, Type type, String path, Subject subject, int m
203
205
204
206
@ Override
205
207
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 ();
209
210
return new FsStat (total , Long .MAX_VALUE , total -free , pathToInode .size ());
210
211
}
211
212
0 commit comments