linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ram Pai <linuxram@us.ibm.com>
To: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>, linux-mm@kvack.org
Subject: RE: Which is the proper way to bring in the backing store behind an inode as an struct page?
Date: 02 Jul 2004 22:52:04 -0700	[thread overview]
Message-ID: <1088833923.727.84.camel@dyn319048bld.beaverton.ibm.com> (raw)
In-Reply-To: <F989B1573A3A644BAB3920FBECA4D25A6EBEEE@orsmsx407>

On Fri, 2004-07-02 at 17:37, Perez-Gonzalez, Inaky wrote:
> Hi Ken
> 
> > From: Chen, Kenneth W [mailto:kenneth.w.chen@intel.com]
> > 
> > Perez-Gonzalez, Inaky wrote on Thursday, July 01, 2004 11:35 PM
> > > Dummy question that has been evading me for the last hours. Can you
> > > help? Please bear with me here, I am a little lost in how to deal
> > > with inodes and the cache.
> > >
> > > ....
> > >
> > > Thus, what I need is a way that given the pair (inode,pgoff)
> > > returns to me the 'struct page *' if the thing is cached in memory or
> > > pulls it up from swap/file into memory and gets me a 'struct page *'.
> > >
> > > Is there a way to do this?
> > 
> > find_get_page() might be the one you are looking for.
> 
> Something like this? [I am trying blindly]

> page = find_get_page (inode->i_mapping, pgoff)

I would like at the logic of do_generic_mapping_read(). The code below
is perhaps roughly what you want.

page = find_get_page(inode->i_mapping, pgoff);
if(unlikely(page==NULL)) {

	page = page_cache_alloc_cold(mapping);
	if (!page) {
                /* NO LUCK SORRY :-( */
        }

        if(add_to_page_cache_lru(page, mapping, pgoff, GFP_KERNEL)) {
                /* NO LUCK SORRY :-( */
        }
}
if (!PageUptodate(page)) { 
     lock_page(page);
     mapping->a_ops->readpage(filp /*i guess this can be null */,
			 page);
}
	
	


	

> 
> Under which circumstances will this fail? [I am guessing the only ones
> are if the page offset is out of the limits of the map]. What about 
> i_mapping? When is it not defined? [ie: NULL].
> 
> Thanks
> 
> IA+-aky PA(C)rez-GonzA!lez -- Not speaking for Intel -- all opinions are my own (and my fault)
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2004-07-03  5:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-03  0:37 Perez-Gonzalez, Inaky
2004-07-03  5:52 ` Ram Pai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-07-02  6:34 Perez-Gonzalez, Inaky
2004-07-02 18:07 ` Chen, Kenneth W
2004-07-02 18:46 ` Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1088833923.727.84.camel@dyn319048bld.beaverton.ibm.com \
    --to=linuxram@us.ibm.com \
    --cc=inaky.perez-gonzalez@intel.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox