Re: PATCH 2.5.1.4: fix rd.c build

Alexander Viro (viro@math.psu.edu)
Fri, 30 Nov 2001 02:37:22 -0500 (EST)


On Fri, 30 Nov 2001, Jens Axboe wrote:

> On Fri, Nov 30 2001, Alexander Viro wrote:
> >
> >
> > On Fri, 30 Nov 2001, Jens Axboe wrote:
> >
> > > Actually, this is not even enough if rd receives a multi page bio.
> > > Something like this should work, untested.
> > >
> > > @@ -237,9 +238,9 @@
> > > err = -EIO;
> >
> > Make it err = 0...
>
> Explain

Think what happens if you have all these pages in page cache. Already.
Returning -EIO is hardly a good idea in that case. Look through the
loop - we assign err in the body only if we have to allocate a new
page.

Notice that any bh brings the page in. I.e. for smaller-than-page ones
you are going to have a lot of fun...

@@ -227,19 +227,18 @@
commit_write: ramdisk_commit_write,
};

-static int rd_blkdev_pagecache_IO(int rw, struct buffer_head * sbh, int minor)
+static int rd_blkdev_pagecache_IO(int rw, struct bio *sbh, int minor)
{
struct address_space * mapping;
unsigned long index;
int offset, size, err;

err = -EIO;
- err = 0;
mapping = rd_bdev[minor]->bd_inode->i_mapping;

Sure, one of these assignments had to go away. You'd picked the wrong one,
though...

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