aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.c
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/inode.c
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/inode.c')
-rw-r--r--fs/ocfs2/inode.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 8ec80445d18c..36bb588f8fcb 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1395,3 +1395,52 @@ int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh)
1395{ 1395{
1396 return ocfs2_read_inode_block_full(inode, bh, 0); 1396 return ocfs2_read_inode_block_full(inode, bh, 0);
1397} 1397}
1398
1399static struct ocfs2_inode_info *cache_info_to_inode(struct ocfs2_caching_info *ci)
1400{
1401 return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache);
1402}
1403
1404static u64 ocfs2_inode_cache_owner(struct ocfs2_caching_info *ci)
1405{
1406 struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
1407
1408 return oi->ip_blkno;
1409}
1410
1411static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
1412{
1413 struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
1414
1415 spin_lock(&oi->ip_lock);
1416}
1417
1418static void ocfs2_inode_cache_unlock(struct ocfs2_caching_info *ci)
1419{
1420 struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
1421
1422 spin_unlock(&oi->ip_lock);
1423}
1424
1425static void ocfs2_inode_cache_io_lock(struct ocfs2_caching_info *ci)
1426{
1427 struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
1428
1429 mutex_lock(&oi->ip_io_mutex);
1430}
1431
1432static void ocfs2_inode_cache_io_unlock(struct ocfs2_caching_info *ci)
1433{
1434 struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
1435
1436 mutex_unlock(&oi->ip_io_mutex);
1437}
1438
1439const struct ocfs2_caching_operations ocfs2_inode_caching_ops = {
1440 .co_owner = ocfs2_inode_cache_owner,
1441 .co_cache_lock = ocfs2_inode_cache_lock,
1442 .co_cache_unlock = ocfs2_inode_cache_unlock,
1443 .co_io_lock = ocfs2_inode_cache_io_lock,
1444 .co_io_unlock = ocfs2_inode_cache_io_unlock,
1445};
1446