lkml.org 
[lkml]   [1999]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] pagecache-2.3.9-E8, fixes against pre3-2.3.9
On Fri, 25 Jun 1999, Andrea Arcangeli wrote:

>o fix for an fs corrution bug in all 2.3.[89]: even if we write to a
> partial buffer, this doesn't mean that we have all buffers
> in the page uptodate. The below check was bogus:
>
> if (!partial)
> SetPageUptodate(page);
> return bytes;

I have a more efficient fix for the same bug, here it is an incremental
patch (incremental with the previous big buffer patch, it will generate
some offset but it will apply cleanly):

Index: linux/fs/buffer.c
===================================================================
RCS file: /var/cvs/linux/fs/buffer.c,v
retrieving revision 1.1.2.183
diff -u -r1.1.2.183 buffer.c
--- linux/fs/buffer.c 1999/06/25 17:19:48 1.1.2.183
+++ linux/fs/buffer.c 1999/06/25 19:01:32
@@ -1424,7 +1424,7 @@
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
unsigned long block;
- int err, nr_uptodate = 0, uptodate;
+ int err, uptodate, all_uptodate = 1;
unsigned long blocksize, start_block, end_block;
unsigned long start_offset, start_bytes, end_bytes;
unsigned long bbits, blocks, i, len;
@@ -1473,7 +1473,6 @@
BUG();

uptodate = buffer_uptodate(bh);
- nr_uptodate += uptodate;

if ((i < start_block) || (i > end_block))
goto skip;
@@ -1525,11 +1524,11 @@
* lots of dirty pages.
*/
mark_buffer_uptodate(bh, 1);
- if (!uptodate)
- nr_uptodate++;
+ uptodate = 1;
atomic_mark_buffer_dirty(bh, 0);

skip:
+ all_uptodate &= uptodate;
i++;
block++;
bh = bh->b_this_page;
@@ -1541,7 +1540,7 @@
* the next read(). Here we 'discover' wether the page went
* uptodate as a result of this (potentially partial) write.
*/
- if ((PAGE_SIZE >> bbits) == nr_uptodate)
+ if (all_uptodate)
SetPageUptodate(page);
return bytes;
out:



Andrea Arcangeli


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.190 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site