linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>
To: Ram Pai <linuxram@us.ibm.com>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>,
	linux-mm@kvack.org, Dave Hansen <haveblue@us.ibm.com>
Subject: RE: Which is the proper way to bring in the backing store behindaninode as an struct page?
Date: Thu, 8 Jul 2004 17:45:41 -0700	[thread overview]
Message-ID: <F989B1573A3A644BAB3920FBECA4D25A6EBF28@orsmsx407> (raw)

[-- 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 }

                 reply	other threads:[~2004-07-09  0:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=F989B1573A3A644BAB3920FBECA4D25A6EBF28@orsmsx407 \
    --to=inaky.perez-gonzalez@intel.com \
    --cc=haveblue@us.ibm.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=linuxram@us.ibm.com \
    /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