bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another fatfs patch


From: Marcus Brinkmann
Subject: Re: Another fatfs patch
Date: Thu, 17 Jul 2003 05:46:14 -0500
User-agent: Mutt/1.5.3i

On Wed, Jul 16, 2003 at 08:01:19PM +0200, Marco Gerards wrote:
> Ok. The old code didn't work for clusters > 4096 because the call to
> find_cluster will be split up because the pager reads the cluster in
> two operations.
> 
> The cluster in a 8096 byte file will be read like this :
> (first pagefault) offset: 0
> (second pagefault) offset: 4096
> 
> 4096(offset) + 8096(clustersize) > allocsize (8096)
> 
> The test will fault and a EIO will be the result.

I see.  So what do you think of this one:

2003-07-17  Marcus Brinkmann  <marcus@gnu.org>

        * pager.c (find_cluster): Round to cluster size rather than adding
        cluster size.

Index: pager.c
===================================================================
RCS file: /cvsroot/hurd/hurd/fatfs/pager.c,v
retrieving revision 1.1
diff -u -p -r1.1 pager.c
--- pager.c     3 Dec 2002 20:52:59 -0000       1.1
+++ pager.c     17 Jul 2003 10:37:53 -0000
@@ -106,7 +106,7 @@ find_cluster (struct node *node, vm_offs
       rwlock_reader_lock (*lock);
     }
 
-  if (offset + bytes_per_cluster > node->allocsize)
+  if (round_cluster (offset) > node->allocsize)
     return EIO;
 
   err = fat_getcluster (node, offset >> log2_bytes_per_cluster, 0, cluster);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]