mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* How does ramfs actually fills the page cache with data?
@ 2001-06-22 21:45 Ho Chak Hung
  2001-06-23 13:50 ` Ingo Oeser
  0 siblings, 1 reply; 3+ messages in thread
From: Ho Chak Hung @ 2001-06-22 21:45 UTC (permalink / raw)
  To: linux-kernel

In fs/ramfs/inode.c, how does ramfs actually fills the page cache with data? In the readpage operation, it only zero-fill the page if it didn't already exist in the page cache. However, how do I actually fill the page with data?

Thanks a lot.


__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/

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

* Re: How does ramfs actually fills the page cache with data?
  2001-06-22 21:45 How does ramfs actually fills the page cache with data? Ho Chak Hung
@ 2001-06-23 13:50 ` Ingo Oeser
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Oeser @ 2001-06-23 13:50 UTC (permalink / raw)
  To: Ho Chak Hung; +Cc: linux-kernel

On Fri, Jun 22, 2001 at 05:45:27PM -0400, Ho Chak Hung wrote:
> In fs/ramfs/inode.c, how does ramfs actually fills the page
> cache with data? In the readpage operation, it only zero-fill
> the page if it didn't already exist in the page cache. However,
> how do I actually fill the page with data?

The page cache does it itself. 

"readpage" is to move pages from the backing store into the page
cache. 

"writepage" and friends is for updating the backing store with
the contents of the page cache.

There is no real backing store of ramfs, since ramfs data lives
completly in page cache. 

But we cannot give the user random memory contents, so we zero it
out on readpage and prepare_write.

The data is copied with copy_{from,to}_user in the generic file
operations (look how ramfs_file_operations is defined and look at
the functions referenced), which read/write through page cache.

Regards

Ingo Oeser
-- 
Use ReiserFS to get a faster fsck and Ext2 to fsck slowly and gently.

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

* Re: How does ramfs actually fills the page cache with data?
@ 2001-06-25  3:01 Ho Chak Hung
  0 siblings, 0 replies; 3+ messages in thread
From: Ho Chak Hung @ 2001-06-25  3:01 UTC (permalink / raw)
  To: linux-kernel

thanks a lot for your reply

But is it at all possible to put data into page cache without going through the inodes or files? I mean, for example, if you are given a string "abcde", and you want to allocate a page to store this "abcde" into that page and add that page to the page cache, what would you do? 

2)The ramfs uses the generic file operation
Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de> wrote:
>
> On Fri, Jun 22, 2001 at 05:45:27PM -0400, Ho Chak Hung wrote:
> > In fs/ramfs/inode.c, how does ramfs actually fills the page
> > cache with data? In the readpage operation, it only zero-fill
> > the page if it didn't already exist in the page cache. However,
> > how do I actually fill the page with data?
> 
> The page cache does it itself. 
> 
> "readpage" is to move pages from the backing store into the page
> cache. 
> 
> "writepage" and friends is for updating the backing store with
> the contents of the page cache.
> 
> There is no real backing store of ramfs, since ramfs data lives
> completly in page cache. 
> 
> But we cannot give the user random memory contents, so we zero it
> out on readpage and prepare_write.
> 
> The data is copied with copy_{from,to}_user in the generic file
> operations (look how ramfs_file_operations is defined and look at
> the functions referenced), which read/write through page cache.
> 
> Regards
> 
> Ingo Oeser
> -- 
> Use ReiserFS to get a faster fsck and Ext2 to fsck slowly and gently.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
__________________________________________________________________
__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/

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

end of thread, other threads:[~2001-06-25  3:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-22 21:45 How does ramfs actually fills the page cache with data? Ho Chak Hung
2001-06-23 13:50 ` Ingo Oeser
2001-06-25  3:01 Ho Chak Hung

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

all inboxes | Powered by JetHome®