linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* struct page question
@ 2002-09-24 21:10 Luben Tuikov
  2002-09-25  7:34 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Luben Tuikov @ 2002-09-24 21:10 UTC (permalink / raw)
  To: linux-kernel

Is it possible to build a struct page *page, where
page_address(page) == some virtual address (not high mem of course)?

The reason I want to do this is so that I can pass it to
generic_make_request(), having only a pointer to a buffer
and size to a buffer, and the fact that not all devices
have request_fn() exposed (e.g. md).

Apparently I cannot just set b_data and b_size, b_page
also has to be set and it also seems that it will
not work if page_address(b_page) != b_data...

Thanks,
-- 
Luben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: struct page question
  2002-09-24 21:10 struct page question Luben Tuikov
@ 2002-09-25  7:34 ` Jens Axboe
  2002-09-25 20:56   ` Luben Tuikov
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2002-09-25  7:34 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: linux-kernel

On Tue, Sep 24 2002, Luben Tuikov wrote:
> Is it possible to build a struct page *page, where
> page_address(page) == some virtual address (not high mem of course)?
> 
> The reason I want to do this is so that I can pass it to
> generic_make_request(), having only a pointer to a buffer
> and size to a buffer, and the fact that not all devices
> have request_fn() exposed (e.g. md).
> 
> Apparently I cannot just set b_data and b_size, b_page
> also has to be set and it also seems that it will
> not work if page_address(b_page) != b_data...

bh->b_page = virt_to_page(va);
bh->b_data = va;

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: struct page question
  2002-09-25  7:34 ` Jens Axboe
@ 2002-09-25 20:56   ` Luben Tuikov
  2002-09-26  5:33     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Luben Tuikov @ 2002-09-25 20:56 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

Jens Axboe wrote:
> 
> > Apparently I cannot just set b_data and b_size, b_page
> > also has to be set and it also seems that it will
> > not work if page_address(b_page) != b_data...
> 
> bh->b_page = virt_to_page(va);
> bh->b_data = va;

Thanks Jens again.

My doubts are that va might not point to page->virtual,
but may point ``in the middle'' of the page, in which case
md will cough up since it does the page_address(b_page) != b_data
then BUG()...

I.e. I cannot guarantee about where va points (just that it is NOT
highmem).

-- 
Luben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: struct page question
  2002-09-25 20:56   ` Luben Tuikov
@ 2002-09-26  5:33     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2002-09-26  5:33 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: linux-kernel

On Wed, Sep 25 2002, Luben Tuikov wrote:
> Jens Axboe wrote:
> > 
> > > Apparently I cannot just set b_data and b_size, b_page
> > > also has to be set and it also seems that it will
> > > not work if page_address(b_page) != b_data...
> > 
> > bh->b_page = virt_to_page(va);
> > bh->b_data = va;
> 
> Thanks Jens again.
> 
> My doubts are that va might not point to page->virtual,
> but may point ``in the middle'' of the page, in which case
> md will cough up since it does the page_address(b_page) != b_data
> then BUG()...

It's quite legal for b_data to point to somewhere in the middle of the
page. See usage of bh_offset(). What coughs up and where?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-09-26  5:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-24 21:10 struct page question Luben Tuikov
2002-09-25  7:34 ` Jens Axboe
2002-09-25 20:56   ` Luben Tuikov
2002-09-26  5:33     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).