From: "Kathy KN (HK)" <kathy.kn@gmail.com>
To: Jeff Mahoney <jeffm@suse.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Access content of file via inodes
Date: Fri, 8 Apr 2005 14:01:04 +0800 [thread overview]
Message-ID: <f8ad67b305040723012246f254@mail.gmail.com> (raw)
In-Reply-To: <4252E09B.9020606@suse.com>
On Apr 6, 2005 3:01 AM, Jeff Mahoney <jeffm@suse.com> wrote:
> Kathy KN wrote:
> > Good day all,
> >
> > How do I access/read the content of the files via using inodes
> > or blocks that belong to the inode, at sys_link and vfs_link layer?
> > I used bmap to access the blocks that belongs to the inodes, but
> > getting access to the buffer_head's b_data doesn't seem to help.
>
> Hi Kathy -
>
> What you're trying to do is possible, but you need to go about it in a
> different way. Ignore the buffer cache completely and use the page
> cache; it's more appropriate for file contents.
>
> You have two options:
>
> If performance isn't critical, a simple approach would be to use your
> old_dentry pointer to dentry_open a file and then vfs_read from it to a
> buffer you allocate. Make sure you use get_fs/set_fs, since vfs_read
> won't accept a kernel pointer otherwise.
>
> If performance is more important or you really do only have access to an
> inode, you can read from the page cache directly using inode->i_mapping
> and read_cache_page. This has the advantage that you don't need to copy
> the data to access it, but the disadvantage that it is more complex and
> can be tricky to get right.
Hi Jeff,
Is it possible to modify the cached page, and invalidate it back
to update the page cache of the new page? I did a recursive grep
and could only find functions that let you read or grab pages in the
cache.
Kathy
next prev parent reply other threads:[~2005-04-08 6:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-05 1:23 Access content of file via inodes Kathy KN
2005-04-05 7:22 ` Christoph Hellwig
2005-04-05 17:53 ` Bryan Henderson
2005-04-06 1:27 ` Kathy KN (HK)
2005-04-06 1:53 ` Jeff Mahoney
2005-04-06 17:57 ` Bryan Henderson
2005-04-06 7:54 ` Anton Altaparmakov
2005-04-06 11:33 ` Anton Altaparmakov
2005-04-06 13:09 ` Jeffrey Mahoney
2005-04-07 5:25 ` Kathy KN (HK)
2005-04-07 6:47 ` Jeffrey Mahoney
2005-04-07 8:09 ` Anton Altaparmakov
2005-04-05 19:01 ` Jeff Mahoney
2005-04-06 1:32 ` Kathy KN (HK)
2005-04-06 1:50 ` Jeff Mahoney
2005-04-08 6:01 ` Kathy KN (HK) [this message]
2005-04-08 8:17 ` Anton Altaparmakov
2005-05-27 19:13 ` Martin Jambor
2005-05-28 15:57 ` Anton Altaparmakov
2005-05-28 21:44 ` Martin Jambor
2005-05-29 7:26 ` Anton Altaparmakov
2005-05-30 21:51 ` Martin Jambor
2005-05-30 22:19 ` Anton Altaparmakov
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=f8ad67b305040723012246f254@mail.gmail.com \
--to=kathy.kn@gmail.com \
--cc=jeffm@suse.com \
--cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).