[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another fatfs patch
From: |
Marco Gerards |
Subject: |
Re: Another fatfs patch |
Date: |
17 Jul 2003 20:03:27 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Marcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de> writes:
> 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:
[...]
> - if (offset + bytes_per_cluster > node->allocsize)
> + if (round_cluster (offset) > node->allocsize)
> return EIO;
This looks good to me, but after rounding it down you can add the
bytes_per_cluster. This solution is much better than I had.
So it should be:
"if (round_cluster (offset) + bytes_per_cluster > node->allocsize)"
I will test the code to be 100% sure it works. :)
Thanks,
Marco