diff --git a/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java b/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java index 09adeff820..af6dbe15fb 100644 --- a/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java +++ b/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java @@ -109,6 +109,11 @@ public class CacheLookupSearchContext extends ContentSearchContext { if ( fstate.hasModifyDateTime()) info.setModifyDateTime( fstate.getModifyDateTime()); + // File allocation size + + if ( fstate.hasAllocationSize() && fstate.getAllocationSize() > info.getSize()) + info.setAllocationSize( fstate.getAllocationSize()); + // DEBUG if ( logger.isDebugEnabled()) diff --git a/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java b/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java index c37ab187eb..4978f601f9 100644 --- a/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java +++ b/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java @@ -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 {