XFS: Approach to persist data & metadata changes on original file before IO acknowledgment when file is reflinked

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

 



Hi Team,
      We are using XFS reflink feature to create snapshot of an origin file (a thick file, created through fallocate) and exposing origin file as a block device to the users. XFS file was opened with O_DIRECT option to avoid buffers at lower layer while performing writes, even though a thick file is created, when user performs writes then there are metadata changes associated to writes (mostly xfs marks extents to know whether the data is written to physical blocks or not). To avoid metadata changes during user writes we are explicitly zeroing entire file range post creation of file, so that there won't be any metadata changes in future for writes that happen on zeroed blocks.

      Now, if reflink copy of origin file is created then there will be metadata changes which need to be persisted if data is overwritten on the reflinked blocks of original file. Even though the file is opened in O_DIRECT mode changes to metadata do not persist before write is acknowledged back to user, if system crashes when changes are in buffer then post recovery writes which were acknowledged are not available to read. Two options that we were aware to avoid consistency issue is:

1. Adding O_SYNC flag while opening file which ensures each write gets persisted in persistent media, but this leads to poor performance.
2. Performing sync operation along with writes/post writes will guarantees that metadata changes will be persisted.

Are there any other option available to avoid the above consistency issue (Without much degradation in performance)?  TIA for your help and appreciate any inputs. If any extra information is needed, I will be happy to run experiments and provide the information.


Thanks & Regards,
Sai




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux