On Sep 12, 2008 15:06 -0700, Abhijit Paithankar wrote: > On journaling file systems, applications need to know when the meta-data > changes to files are written to disks in a manner which is persistent to > crashes and reboots. > > One way to do it is to fsync every few operations. However, fsync is > blocking and affects performance. > > The other (more efficient) way is to have the filesystem notify the > application when a transaction/change is written to disk. > > This patch implements such a notification mechanism based on inotify for > Ext3 and Ext4. > > Every time an application creates, renames, unlinks, etc a file or > directory, a journal_cookie is sent via the inotify mechanism. Ofcourse, > the application has to first register for such notifications on the > files/directories of interest. > > Once the transaction corresponding to that journal_cookie is committed > to the journal another notification is sent to the application > indicating that the change is now persistent. We had a much more flexible journal commit notification mechanism. The caller would register a callback with the journal layer that contained a caller-private callback function and callback data. This avoided exposing the journal transaction IDs outside of the filesystem, and the caller could use any identifier desired. There was also no limit on the number/type of callbacks registered with the filesystem. The basic data structure was a linked list of callbacks registered on the transaction: struct journal_callback { struct list_head jcb_list; void (*jcb_func)(struct journal_callback *jcb, int error); /* caller data goes here */ }; and in journal_commit_transaction() the callbacks are called: list_for_each_entry_safe(jcb, n, &commit_transaction->t_jcb, jcb_list) { list_del_init(&jcb->jcb_list); jcb->jcb_func(jcb, error); } Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html