linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* RE: Which is the proper way to bring in the backing store behindaninode as an struct page?
@ 2004-07-09  0:45 Perez-Gonzalez, Inaky
  0 siblings, 0 replies; only message in thread
From: Perez-Gonzalez, Inaky @ 2004-07-09  0:45 UTC (permalink / raw)
  To: Ram Pai; +Cc: Chen, Kenneth W, linux-mm, Dave Hansen

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

> From: Ram Pai [mailto:linuxram@us.ibm.com]
>
> I dont' see why any of the readpage() methods need the filp information.
> A quick scan shows that  zisofs_readpage() deferences filp.
> zisofs_readpage() uses the filp to get to the inode, which it can always
> get through  page->mapping->host

Hm, so that is something that could be patched.

> >  - the error paths, for example, for "error_unlock", #77, leaving
> >    the page in the LRU cache [is this ok? will somebody else
> >    use it or will it drop automatically?]
> 
> page_cache_release() takes care of that. So this should be ok.

Ok.

I went on an digged in some more similar code, like swapfile.c:sys_swapon(),
where it calls read_cache_page(). I realized I could accomplish the same 
[almost] with the following:

01 struct page * page_cache_readpage (struct inode *inode, unsigned long pgoff)
02 {
03         struct page *page;
04         struct address_space *mapping = inode->i_mapping;
05         
06         page = read_cache_page (mapping, pgoff, 
07                                 (filler_t *) mapping->a_ops->readpage,
08                                 NULL);
09         if (IS_ERR (page))
10                 goto out;
11         wait_on_page_locked (page);
12         if (!PageUptodate (page)) {
13                 page_cache_release (page);
14                 page = ERR_PTR (-EIO);
15         }
16 out:
17         return page;
18 }

For the time being I should add some BUG_ON()s on inode->i_mapping
being NULL, but this should do better than the monster I coded.

THanks!

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own (and my fault)


[-- Attachment #2: t.txt --]
[-- Type: text/plain, Size: 631 bytes --]

01 struct page * page_cache_readpage (struct inode *inode, unsigned long pgoff)
02 {
03         struct page *page;
04         struct address_space *mapping = inode->i_mapping;
05         
06         page = read_cache_page (mapping, pgoff, 
07                                 (filler_t *) mapping->a_ops->readpage,
08                                 NULL);
09         if (IS_ERR (page))
10                 goto out;
11         wait_on_page_locked (page);
12         if (!PageUptodate (page)) {
13                 page_cache_release (page);
14                 page = ERR_PTR (-EIO);
15         }
16 out:
17         return page;
18 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-09  0:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-09  0:45 Which is the proper way to bring in the backing store behindaninode as an struct page? Perez-Gonzalez, Inaky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox