Store some data in a structode inode

Hi, I am new to kernel programming. I am writing a small kernel module which is based on the wrapfs template for implementing the backup mechanism. This is for training purposes only.

I am expanding wrapfs so that when a write call has been made wrapfs transparently makes a copy of this file in a separate directory, and then the file is written. But I do not want me to create a copy for each call to the record.

A naive approach might be to check for a file in this directory. But I think that for every challenge, checking this can be a severe punishment.

I could also check the first call to the record, and then save the value for that specific file using the private_data attribute. But it will not be saved to disk. Therefore, I will need to check it again.

I also thought about using modification time. I could save a change of time. If the older modification time is before this time, then only the copy is created differently, I will not do anything. I tried to use inode.i_mtime for this, but it was a modified time before the recording was called, also applications can change this time.

So, I was thinking about saving some value in the inode on the disk, which indicates whether it was backed up or not. Is it possible? Any other suggestions or approaches are welcome.

+5
source
2

, , Copy-On-Write.

IMO, , ( libfuse , ). , , :

  • ()
  • POSIX (setfattr )
  • , sqlite

, , , (, , , " ()" 1.


1 IO Wrong: .

0

atime mtime. S_NOATIME inode (. touch_atime() inode.c). , , - noatime.

0

All Articles