diff options
Diffstat (limited to 'fs/ocfs2/uptodate.c')
-rw-r--r-- | fs/ocfs2/uptodate.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index 4da8851f2b23..187b99ff0368 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
@@ -53,7 +53,11 @@ | |||
53 | #include <linux/highmem.h> | 53 | #include <linux/highmem.h> |
54 | #include <linux/buffer_head.h> | 54 | #include <linux/buffer_head.h> |
55 | #include <linux/rbtree.h> | 55 | #include <linux/rbtree.h> |
56 | #include <linux/jbd.h> | 56 | #ifndef CONFIG_OCFS2_COMPAT_JBD |
57 | # include <linux/jbd2.h> | ||
58 | #else | ||
59 | # include <linux/jbd.h> | ||
60 | #endif | ||
57 | 61 | ||
58 | #define MLOG_MASK_PREFIX ML_UPTODATE | 62 | #define MLOG_MASK_PREFIX ML_UPTODATE |
59 | 63 | ||
@@ -511,14 +515,10 @@ static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci, | |||
511 | ci->ci_num_cached--; | 515 | ci->ci_num_cached--; |
512 | } | 516 | } |
513 | 517 | ||
514 | /* Called when we remove a chunk of metadata from an inode. We don't | 518 | static void ocfs2_remove_block_from_cache(struct inode *inode, |
515 | * bother reverting things to an inlined array in the case of a remove | 519 | sector_t block) |
516 | * which moves us back under the limit. */ | ||
517 | void ocfs2_remove_from_cache(struct inode *inode, | ||
518 | struct buffer_head *bh) | ||
519 | { | 520 | { |
520 | int index; | 521 | int index; |
521 | sector_t block = bh->b_blocknr; | ||
522 | struct ocfs2_meta_cache_item *item = NULL; | 522 | struct ocfs2_meta_cache_item *item = NULL; |
523 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 523 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
524 | struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | 524 | struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; |
@@ -544,6 +544,30 @@ void ocfs2_remove_from_cache(struct inode *inode, | |||
544 | kmem_cache_free(ocfs2_uptodate_cachep, item); | 544 | kmem_cache_free(ocfs2_uptodate_cachep, item); |
545 | } | 545 | } |
546 | 546 | ||
547 | /* | ||
548 | * Called when we remove a chunk of metadata from an inode. We don't | ||
549 | * bother reverting things to an inlined array in the case of a remove | ||
550 | * which moves us back under the limit. | ||
551 | */ | ||
552 | void ocfs2_remove_from_cache(struct inode *inode, | ||
553 | struct buffer_head *bh) | ||
554 | { | ||
555 | sector_t block = bh->b_blocknr; | ||
556 | |||
557 | ocfs2_remove_block_from_cache(inode, block); | ||
558 | } | ||
559 | |||
560 | /* Called when we remove xattr clusters from an inode. */ | ||
561 | void ocfs2_remove_xattr_clusters_from_cache(struct inode *inode, | ||
562 | sector_t block, | ||
563 | u32 c_len) | ||
564 | { | ||
565 | unsigned int i, b_len = ocfs2_clusters_to_blocks(inode->i_sb, 1) * c_len; | ||
566 | |||
567 | for (i = 0; i < b_len; i++, block++) | ||
568 | ocfs2_remove_block_from_cache(inode, block); | ||
569 | } | ||
570 | |||
547 | int __init init_ocfs2_uptodate_cache(void) | 571 | int __init init_ocfs2_uptodate_cache(void) |
548 | { | 572 | { |
549 | ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate", | 573 | ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate", |