aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/uptodate.h
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-10 22:00:37 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:48 -0400
commit6e5a3d7538ad4e46a976862f593faf65750e37cc (patch)
treee87ce6d69bdbcce23eed0a195a7f80a59c01d3d9 /fs/ocfs2/uptodate.h
parent47460d65a483529b3bc2bf6ccf461ad45f94df83 (diff)
ocfs2: Change metadata caching locks to an operations structure.
We don't really want to cart around too many new fields on the ocfs2_caching_info structure. So let's wrap all our access of the parent object in a set of operations. One pointer on caching_info, and more flexibility to boot. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/uptodate.h')
-rw-r--r--fs/ocfs2/uptodate.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/fs/ocfs2/uptodate.h b/fs/ocfs2/uptodate.h
index bd749e1434f1..3b33eb88d320 100644
--- a/fs/ocfs2/uptodate.h
+++ b/fs/ocfs2/uptodate.h
@@ -26,12 +26,38 @@
26#ifndef OCFS2_UPTODATE_H 26#ifndef OCFS2_UPTODATE_H
27#define OCFS2_UPTODATE_H 27#define OCFS2_UPTODATE_H
28 28
29/*
30 * The caching code relies on locking provided by the user of
31 * struct ocfs2_caching_info. These operations connect that up.
32 */
33struct ocfs2_caching_operations {
34 /*
35 * A u64 representing the owning structure. Usually this
36 * is the block number (i_blkno or whatnot). This is used so
37 * that caching log messages can identify the owning structure.
38 */
39 u64 (*co_owner)(struct ocfs2_caching_info *ci);
40
41 /*
42 * Lock and unlock the caching data. These will not sleep, and
43 * should probably be spinlocks.
44 */
45 void (*co_cache_lock)(struct ocfs2_caching_info *ci);
46 void (*co_cache_unlock)(struct ocfs2_caching_info *ci);
47
48 /*
49 * Lock and unlock for disk I/O. These will sleep, and should
50 * be mutexes.
51 */
52 void (*co_io_lock)(struct ocfs2_caching_info *ci);
53 void (*co_io_unlock)(struct ocfs2_caching_info *ci);
54};
55
29int __init init_ocfs2_uptodate_cache(void); 56int __init init_ocfs2_uptodate_cache(void);
30void exit_ocfs2_uptodate_cache(void); 57void exit_ocfs2_uptodate_cache(void);
31 58
32void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, 59void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci,
33 spinlock_t *cache_lock, 60 const struct ocfs2_caching_operations *ops);
34 struct mutex *io_mutex);
35void ocfs2_metadata_cache_purge(struct inode *inode); 61void ocfs2_metadata_cache_purge(struct inode *inode);
36 62
37int ocfs2_buffer_uptodate(struct inode *inode, 63int ocfs2_buffer_uptodate(struct inode *inode,