Added file allocation size tracking to the repo filesystem. Part of ALF-1554.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20024 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer
2010-04-28 09:04:34 +00:00
parent 5addc38577
commit 8bf1c1042c
2 changed files with 30 additions and 1 deletions

View File

@@ -896,16 +896,24 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
finfo.setFileId( path.hashCode());
// Copy cached timestamps, if available
// Copy cached file details, if available
FileState fstate = getStateForPath(tree, infoPath);
if ( fstate != null) {
// Copy cached timestamps
if ( fstate.hasAccessDateTime())
finfo.setAccessDateTime(fstate.getAccessDateTime());
if ( fstate.hasChangeDateTime())
finfo.setChangeDateTime(fstate.getChangeDateTime());
if ( fstate.hasModifyDateTime())
finfo.setModifyDateTime(fstate.getModifyDateTime());
// File allocation size
if ( fstate.hasAllocationSize() && fstate.getAllocationSize() > finfo.getSize())
finfo.setAllocationSize( fstate.getAllocationSize());
}
else {
@@ -1949,6 +1957,10 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
fstate.incrementOpenCount();
fstate.setFilesystemObject(result.getSecond());
// Track the intial allocation size
fstate.setAllocationSize( params.getAllocationSize());
// Store the file state with the file
netFile.setFileState( fstate);
@@ -3188,6 +3200,18 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
}
}
// Check if this is a file extend, update the cached allocation size if necessary
if ( file instanceof ContentNetworkFile) {
// Get the cached state for the file
ContentNetworkFile contentFile = (ContentNetworkFile) file;
FileState fstate = contentFile.getFileState();
if ( fstate != null && size > fstate.getAllocationSize())
fstate.setAllocationSize( size);
}
// Set the file length
try {