2006-08-01 19:33:57

by Andi Kleen

[permalink] [raw]
Subject: Re: [BLOCK] bh: Ensure bh fits within a page

Herbert Xu <[email protected]> writes:
> --
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 71649ef..b998f08 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2790,6 +2790,7 @@ int submit_bh(int rw, struct buffer_head
> BUG_ON(!buffer_locked(bh));
> BUG_ON(!buffer_mapped(bh));
> BUG_ON(!bh->b_end_io);
> + WARN_ON(bh_offset(bh) + bh->b_size > PAGE_SIZE);

What happens when someone implements direct large page IO?

-Andi


2006-08-01 22:10:04

by Herbert Xu

[permalink] [raw]
Subject: Re: [BLOCK] bh: Ensure bh fits within a page

On Tue, Aug 01, 2006 at 09:33:54PM +0200, Andi Kleen wrote:
> > diff --git a/fs/buffer.c b/fs/buffer.c
> > index 71649ef..b998f08 100644
> > --- a/fs/buffer.c
> > +++ b/fs/buffer.c
> > @@ -2790,6 +2790,7 @@ int submit_bh(int rw, struct buffer_head
> > BUG_ON(!buffer_locked(bh));
> > BUG_ON(!buffer_mapped(bh));
> > BUG_ON(!bh->b_end_io);
> > + WARN_ON(bh_offset(bh) + bh->b_size > PAGE_SIZE);
>
> What happens when someone implements direct large page IO?

Then they'll need to change submit_bh to generate more than one bvec.
At that time they can remove this warning :)

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2006-08-02 11:06:07

by Jens Axboe

[permalink] [raw]
Subject: Re: [BLOCK] bh: Ensure bh fits within a page

On Wed, Aug 02 2006, Herbert Xu wrote:
> On Tue, Aug 01, 2006 at 09:33:54PM +0200, Andi Kleen wrote:
> > > diff --git a/fs/buffer.c b/fs/buffer.c
> > > index 71649ef..b998f08 100644
> > > --- a/fs/buffer.c
> > > +++ b/fs/buffer.c
> > > @@ -2790,6 +2790,7 @@ int submit_bh(int rw, struct buffer_head
> > > BUG_ON(!buffer_locked(bh));
> > > BUG_ON(!buffer_mapped(bh));
> > > BUG_ON(!bh->b_end_io);
> > > + WARN_ON(bh_offset(bh) + bh->b_size > PAGE_SIZE);
> >
> > What happens when someone implements direct large page IO?
>
> Then they'll need to change submit_bh to generate more than one bvec.
> At that time they can remove this warning :)

Or just use a proper interface, no new code should touch submit_bh().

--
Jens Axboe