Re: Re: Re: Re: Re: Access content of file via inodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> 
>> Then just say mark_buffer_dirty(bh).
>> "sync_dirty_buffer()" is to sync dirty buffer to 
>> disk instantly, which otherwise, would be done by 
>> bdflush deamon at regular intervels.
>
> sync_dirty_buffer works great on 
> non-journaling/non-data logging fs.
> b_data indeed pointing to the data of the files in 
> there. Thanks for the pointer.
>

A buffer head (struct buffer_head) contains pointer to data block in memory (char * b_data). A page has number of buffers mapped to it. So its like :
 
list
 |     _________________        _______________
 ---> |                 | ---> |               | --->
      |  Buffer Head 0  |      | Buffer Head 0 |  NULL
      |_________________|      |_______________|
      |                 |      |               |
      |  Buffer Head 1  |      | Buffer Head 1 |
      |_________________|      |_______________|
      |                 |      |               |
      |     ...         |      |    ...        |
      |_________________|      |_______________|
      |                 |      |               |
      |  Buffer Head n  |      | Buffer Head m |
      |_________________|      |_______________|
 
           Page 0                  Page 1

Actual data is pointed to by buffer heads.
So just marking the buffer dirty and syncing it will do your job. 

  void commit_to_disk (struct buffer_head * bh)
  {
      mark_buffer_dirty (bh);
      wakeup_bdflush (); // to sync immediately
  }


Nitin






--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux