diff options
Diffstat (limited to 'fs/ocfs2/ocfs2.h')
-rw-r--r-- | fs/ocfs2/ocfs2.h | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 39e1d5a39505..d963d8638709 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -35,12 +35,7 @@ | |||
35 | #include <linux/kref.h> | 35 | #include <linux/kref.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/lockdep.h> | 37 | #include <linux/lockdep.h> |
38 | #ifndef CONFIG_OCFS2_COMPAT_JBD | 38 | #include <linux/jbd2.h> |
39 | # include <linux/jbd2.h> | ||
40 | #else | ||
41 | # include <linux/jbd.h> | ||
42 | # include "ocfs2_jbd_compat.h" | ||
43 | #endif | ||
44 | 39 | ||
45 | /* For union ocfs2_dlm_lksb */ | 40 | /* For union ocfs2_dlm_lksb */ |
46 | #include "stackglue.h" | 41 | #include "stackglue.h" |
@@ -51,20 +46,51 @@ | |||
51 | /* For struct ocfs2_blockcheck_stats */ | 46 | /* For struct ocfs2_blockcheck_stats */ |
52 | #include "blockcheck.h" | 47 | #include "blockcheck.h" |
53 | 48 | ||
49 | |||
50 | /* Caching of metadata buffers */ | ||
51 | |||
54 | /* Most user visible OCFS2 inodes will have very few pieces of | 52 | /* Most user visible OCFS2 inodes will have very few pieces of |
55 | * metadata, but larger files (including bitmaps, etc) must be taken | 53 | * metadata, but larger files (including bitmaps, etc) must be taken |
56 | * into account when designing an access scheme. We allow a small | 54 | * into account when designing an access scheme. We allow a small |
57 | * amount of inlined blocks to be stored on an array and grow the | 55 | * amount of inlined blocks to be stored on an array and grow the |
58 | * structure into a rb tree when necessary. */ | 56 | * structure into a rb tree when necessary. */ |
59 | #define OCFS2_INODE_MAX_CACHE_ARRAY 2 | 57 | #define OCFS2_CACHE_INFO_MAX_ARRAY 2 |
58 | |||
59 | /* Flags for ocfs2_caching_info */ | ||
60 | |||
61 | enum ocfs2_caching_info_flags { | ||
62 | /* Indicates that the metadata cache is using the inline array */ | ||
63 | OCFS2_CACHE_FL_INLINE = 1<<1, | ||
64 | }; | ||
60 | 65 | ||
66 | struct ocfs2_caching_operations; | ||
61 | struct ocfs2_caching_info { | 67 | struct ocfs2_caching_info { |
68 | /* | ||
69 | * The parent structure provides the locks, but because the | ||
70 | * parent structure can differ, it provides locking operations | ||
71 | * to struct ocfs2_caching_info. | ||
72 | */ | ||
73 | const struct ocfs2_caching_operations *ci_ops; | ||
74 | |||
75 | /* next two are protected by trans_inc_lock */ | ||
76 | /* which transaction were we created on? Zero if none. */ | ||
77 | unsigned long ci_created_trans; | ||
78 | /* last transaction we were a part of. */ | ||
79 | unsigned long ci_last_trans; | ||
80 | |||
81 | /* Cache structures */ | ||
82 | unsigned int ci_flags; | ||
62 | unsigned int ci_num_cached; | 83 | unsigned int ci_num_cached; |
63 | union { | 84 | union { |
64 | sector_t ci_array[OCFS2_INODE_MAX_CACHE_ARRAY]; | 85 | sector_t ci_array[OCFS2_CACHE_INFO_MAX_ARRAY]; |
65 | struct rb_root ci_tree; | 86 | struct rb_root ci_tree; |
66 | } ci_cache; | 87 | } ci_cache; |
67 | }; | 88 | }; |
89 | /* | ||
90 | * Need this prototype here instead of in uptodate.h because journal.h | ||
91 | * uses it. | ||
92 | */ | ||
93 | struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci); | ||
68 | 94 | ||
69 | /* this limits us to 256 nodes | 95 | /* this limits us to 256 nodes |
70 | * if we need more, we can do a kmalloc for the map */ | 96 | * if we need more, we can do a kmalloc for the map */ |
@@ -377,12 +403,17 @@ struct ocfs2_super | |||
377 | 403 | ||
378 | /* the group we used to allocate inodes. */ | 404 | /* the group we used to allocate inodes. */ |
379 | u64 osb_inode_alloc_group; | 405 | u64 osb_inode_alloc_group; |
406 | |||
407 | /* rb tree root for refcount lock. */ | ||
408 | struct rb_root osb_rf_lock_tree; | ||
409 | struct ocfs2_refcount_tree *osb_ref_tree_lru; | ||
380 | }; | 410 | }; |
381 | 411 | ||
382 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) | 412 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) |
383 | 413 | ||
384 | /* Useful typedef for passing around journal access functions */ | 414 | /* Useful typedef for passing around journal access functions */ |
385 | typedef int (*ocfs2_journal_access_func)(handle_t *handle, struct inode *inode, | 415 | typedef int (*ocfs2_journal_access_func)(handle_t *handle, |
416 | struct ocfs2_caching_info *ci, | ||
386 | struct buffer_head *bh, int type); | 417 | struct buffer_head *bh, int type); |
387 | 418 | ||
388 | static inline int ocfs2_should_order_data(struct inode *inode) | 419 | static inline int ocfs2_should_order_data(struct inode *inode) |
@@ -480,6 +511,13 @@ static inline void ocfs2_add_links_count(struct ocfs2_dinode *di, int n) | |||
480 | ocfs2_set_links_count(di, links); | 511 | ocfs2_set_links_count(di, links); |
481 | } | 512 | } |
482 | 513 | ||
514 | static inline int ocfs2_refcount_tree(struct ocfs2_super *osb) | ||
515 | { | ||
516 | if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE) | ||
517 | return 1; | ||
518 | return 0; | ||
519 | } | ||
520 | |||
483 | /* set / clear functions because cluster events can make these happen | 521 | /* set / clear functions because cluster events can make these happen |
484 | * in parallel so we want the transitions to be atomic. this also | 522 | * in parallel so we want the transitions to be atomic. this also |
485 | * means that any future flags osb_flags must be protected by spinlock | 523 | * means that any future flags osb_flags must be protected by spinlock |
@@ -578,6 +616,9 @@ static inline int ocfs2_uses_extended_slot_map(struct ocfs2_super *osb) | |||
578 | #define OCFS2_IS_VALID_DX_LEAF(ptr) \ | 616 | #define OCFS2_IS_VALID_DX_LEAF(ptr) \ |
579 | (!strcmp((ptr)->dl_signature, OCFS2_DX_LEAF_SIGNATURE)) | 617 | (!strcmp((ptr)->dl_signature, OCFS2_DX_LEAF_SIGNATURE)) |
580 | 618 | ||
619 | #define OCFS2_IS_VALID_REFCOUNT_BLOCK(ptr) \ | ||
620 | (!strcmp((ptr)->rf_signature, OCFS2_REFCOUNT_BLOCK_SIGNATURE)) | ||
621 | |||
581 | static inline unsigned long ino_from_blkno(struct super_block *sb, | 622 | static inline unsigned long ino_from_blkno(struct super_block *sb, |
582 | u64 blkno) | 623 | u64 blkno) |
583 | { | 624 | { |