[ros-diffs] [jmorlan] 38179: VfatSetAllocationSizeInformation: The fast code for extending the size of a non-empty file did have a bug in that it didn't always set Fcb->LastCluster/Fcb->LastOffset but the OffsetToCluster call was made assuming that it did. However, the code that replaced it had a bug as well, in that it did not set Cluster to the original final cluster like the error handling code expected, so it would crash when out of disk space. Bringing back the fast code, but with its bug fixed.

jmorlan at svn.reactos.org jmorlan at svn.reactos.org
Thu Dec 18 21:47:21 CET 2008


Author: jmorlan
Date: Thu Dec 18 14:47:20 2008
New Revision: 38179

URL: http://svn.reactos.org/svn/reactos?rev=38179&view=rev
Log:
VfatSetAllocationSizeInformation: The fast code for extending the size of a non-empty file did have a bug in that it didn't always set Fcb->LastCluster/Fcb->LastOffset but the OffsetToCluster call was made assuming that it did. However, the code that replaced it had a bug as well, in that it did not set Cluster to the original final cluster like the error handling code expected, so it would crash when out of disk space. Bringing back the fast code, but with its bug fixed.

Modified:
    trunk/reactos/drivers/filesystems/fastfat/finfo.c

Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/finfo.c?rev=38179&r1=38178&r2=38179&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Thu Dec 18 14:47:20 2008
@@ -639,7 +639,6 @@
     }
     else
     {
-#if 0 /* FIXME */
        if (Fcb->LastCluster > 0)
        {
           if (Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize == Fcb->LastOffset)
@@ -665,23 +664,14 @@
           return Status;
        }
 
-       if (Fcb->LastCluster == 0)
-       {
-          Fcb->LastCluster = Cluster;
-          Fcb->LastOffset = Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize;
-       }
+       Fcb->LastCluster = Cluster;
+       Fcb->LastOffset = Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize;
 
        /* FIXME: Check status */
        /* Cluster points now to the last cluster within the chain */
        Status = OffsetToCluster(DeviceExt, Cluster,
 	                        ROUND_DOWN(NewSize - 1, ClusterSize) - Fcb->LastOffset,
                                 &NCluster, TRUE);
-#else
-       Status = OffsetToCluster(DeviceExt, FirstCluster,
-	                        ROUND_DOWN(NewSize - 1, ClusterSize),
-                                &Cluster, TRUE);
-       NCluster = Cluster;
-#endif
        if (NCluster == 0xffffffff || !NT_SUCCESS(Status))
        {
 	  /* disk is full */



More information about the Ros-diffs mailing list