[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: Access content of file via inodes
On Apr 5, 2005 10:04 AM, Kathy KN (HK) <kathy.kn@xxxxxxxxx> wrote:
> This may sound silly, but I am trying to find a way to commit these
> changes. Any idea how? I believe this is why the data is still located
> in the hard disk device somehow, afterall, I am modifying b_data that
> belongs to buffer_head.
I suppose you're using a 2.6.x kernel. Things were different in 2.4
and that's about all I know about them.
I would suggest you forget about blocks and buffers and try to read
files using pages, just like the generic fs routines do. Have a look
at what generic_file_read and generic_file_write functions in
filemap.c do. Please note that for the sake of efficiency, the data
that are written to the file are kept in cache (i.e. memory) for some
time an only later on written to the disk (when kernel needs to free a
page or it's been dirty for too long). Therefore, i you really need to
be sure the data are on the disk, sync the file or the page or
something appropriate after you've done the changes.
HTH
Martin Jambor
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/