diff options
Diffstat (limited to 'fs/ocfs2/ocfs2.h')
-rw-r--r-- | fs/ocfs2/ocfs2.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index db8e77cd35d3..82cc92dcf8a6 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -46,11 +46,6 @@ | |||
46 | #include "endian.h" | 46 | #include "endian.h" |
47 | #include "ocfs2_lockid.h" | 47 | #include "ocfs2_lockid.h" |
48 | 48 | ||
49 | struct ocfs2_extent_map { | ||
50 | u32 em_clusters; | ||
51 | struct rb_root em_extents; | ||
52 | }; | ||
53 | |||
54 | /* Most user visible OCFS2 inodes will have very few pieces of | 49 | /* Most user visible OCFS2 inodes will have very few pieces of |
55 | * metadata, but larger files (including bitmaps, etc) must be taken | 50 | * metadata, but larger files (including bitmaps, etc) must be taken |
56 | * into account when designing an access scheme. We allow a small | 51 | * into account when designing an access scheme. We allow a small |
@@ -303,6 +298,13 @@ static inline int ocfs2_should_order_data(struct inode *inode) | |||
303 | return 1; | 298 | return 1; |
304 | } | 299 | } |
305 | 300 | ||
301 | static inline int ocfs2_sparse_alloc(struct ocfs2_super *osb) | ||
302 | { | ||
303 | if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC) | ||
304 | return 1; | ||
305 | return 0; | ||
306 | } | ||
307 | |||
306 | /* set / clear functions because cluster events can make these happen | 308 | /* set / clear functions because cluster events can make these happen |
307 | * in parallel so we want the transitions to be atomic. this also | 309 | * in parallel so we want the transitions to be atomic. this also |
308 | * means that any future flags osb_flags must be protected by spinlock | 310 | * means that any future flags osb_flags must be protected by spinlock |
@@ -461,6 +463,49 @@ static inline unsigned long ocfs2_align_bytes_to_sectors(u64 bytes) | |||
461 | return (unsigned long)((bytes + 511) >> 9); | 463 | return (unsigned long)((bytes + 511) >> 9); |
462 | } | 464 | } |
463 | 465 | ||
466 | static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb, | ||
467 | unsigned long pg_index) | ||
468 | { | ||
469 | u32 clusters = pg_index; | ||
470 | unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; | ||
471 | |||
472 | if (unlikely(PAGE_CACHE_SHIFT > cbits)) | ||
473 | clusters = pg_index << (PAGE_CACHE_SHIFT - cbits); | ||
474 | else if (PAGE_CACHE_SHIFT < cbits) | ||
475 | clusters = pg_index >> (cbits - PAGE_CACHE_SHIFT); | ||
476 | |||
477 | return clusters; | ||
478 | } | ||
479 | |||
480 | /* | ||
481 | * Find the 1st page index which covers the given clusters. | ||
482 | */ | ||
483 | static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb, | ||
484 | u32 clusters) | ||
485 | { | ||
486 | unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; | ||
487 | unsigned long index = clusters; | ||
488 | |||
489 | if (PAGE_CACHE_SHIFT > cbits) { | ||
490 | index = clusters >> (PAGE_CACHE_SHIFT - cbits); | ||
491 | } else if (PAGE_CACHE_SHIFT < cbits) { | ||
492 | index = clusters << (cbits - PAGE_CACHE_SHIFT); | ||
493 | } | ||
494 | |||
495 | return index; | ||
496 | } | ||
497 | |||
498 | static inline unsigned int ocfs2_pages_per_cluster(struct super_block *sb) | ||
499 | { | ||
500 | unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; | ||
501 | unsigned int pages_per_cluster = 1; | ||
502 | |||
503 | if (PAGE_CACHE_SHIFT < cbits) | ||
504 | pages_per_cluster = 1 << (cbits - PAGE_CACHE_SHIFT); | ||
505 | |||
506 | return pages_per_cluster; | ||
507 | } | ||
508 | |||
464 | #define ocfs2_set_bit ext2_set_bit | 509 | #define ocfs2_set_bit ext2_set_bit |
465 | #define ocfs2_clear_bit ext2_clear_bit | 510 | #define ocfs2_clear_bit ext2_clear_bit |
466 | #define ocfs2_test_bit ext2_test_bit | 511 | #define ocfs2_test_bit ext2_test_bit |