]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/ocfs2/uptodate.h
ocfs2: Change metadata caching locks to an operations structure.
[mv-sheeva.git] / fs / ocfs2 / uptodate.h
index bd749e1434f1871be5c50dbc37f1b591038d8330..3b33eb88d320b7ec4d240ec751dc525ed4cd8138 100644 (file)
 #ifndef OCFS2_UPTODATE_H
 #define OCFS2_UPTODATE_H
 
+/*
+ * The caching code relies on locking provided by the user of
+ * struct ocfs2_caching_info.  These operations connect that up.
+ */
+struct ocfs2_caching_operations {
+       /*
+        * A u64 representing the owning structure.  Usually this
+        * is the block number (i_blkno or whatnot).  This is used so
+        * that caching log messages can identify the owning structure.
+        */
+       u64     (*co_owner)(struct ocfs2_caching_info *ci);
+
+       /*
+        * Lock and unlock the caching data.  These will not sleep, and
+        * should probably be spinlocks.
+        */
+       void    (*co_cache_lock)(struct ocfs2_caching_info *ci);
+       void    (*co_cache_unlock)(struct ocfs2_caching_info *ci);
+
+       /*
+        * Lock and unlock for disk I/O.  These will sleep, and should
+        * be mutexes.
+        */
+       void    (*co_io_lock)(struct ocfs2_caching_info *ci);
+       void    (*co_io_unlock)(struct ocfs2_caching_info *ci);
+};
+
 int __init init_ocfs2_uptodate_cache(void);
 void exit_ocfs2_uptodate_cache(void);
 
 void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci,
-                              spinlock_t *cache_lock,
-                              struct mutex *io_mutex);
+                              const struct ocfs2_caching_operations *ops);
 void ocfs2_metadata_cache_purge(struct inode *inode);
 
 int ocfs2_buffer_uptodate(struct inode *inode,