aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/ocfs2_fs.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index b5c68567077e..c99e9058c198 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -85,7 +85,7 @@
85#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask) \ 85#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
86 OCFS2_SB(sb)->s_feature_incompat &= ~(mask) 86 OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
87 87
88#define OCFS2_FEATURE_COMPAT_SUPP 0 88#define OCFS2_FEATURE_COMPAT_SUPP OCFS2_FEATURE_COMPAT_BACKUP_SB
89#define OCFS2_FEATURE_INCOMPAT_SUPP OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT 89#define OCFS2_FEATURE_INCOMPAT_SUPP OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT
90#define OCFS2_FEATURE_RO_COMPAT_SUPP 0 90#define OCFS2_FEATURE_RO_COMPAT_SUPP 0
91 91
@@ -110,6 +110,20 @@
110#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC 0x0010 110#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC 0x0010
111 111
112/* 112/*
113 * backup superblock flag is used to indicate that this volume
114 * has backup superblocks.
115 */
116#define OCFS2_FEATURE_COMPAT_BACKUP_SB 0x0001
117
118/* The byte offset of the first backup block will be 1G.
119 * The following will be 4G, 16G, 64G, 256G and 1T.
120 */
121#define OCFS2_BACKUP_SB_START 1 << 30
122
123/* the max backup superblock nums */
124#define OCFS2_MAX_BACKUP_SUPERBLOCKS 6
125
126/*
113 * Flags on ocfs2_dinode.i_flags 127 * Flags on ocfs2_dinode.i_flags
114 */ 128 */
115#define OCFS2_VALID_FL (0x00000001) /* Inode is valid */ 129#define OCFS2_VALID_FL (0x00000001) /* Inode is valid */
@@ -566,6 +580,20 @@ static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
566 580
567 return size / sizeof(struct ocfs2_truncate_rec); 581 return size / sizeof(struct ocfs2_truncate_rec);
568} 582}
583
584static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
585{
586 u64 offset = OCFS2_BACKUP_SB_START;
587
588 if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
589 offset <<= (2 * index);
590 offset /= sb->s_blocksize;
591 return offset;
592 }
593
594 return 0;
595
596}
569#else 597#else
570static inline int ocfs2_fast_symlink_chars(int blocksize) 598static inline int ocfs2_fast_symlink_chars(int blocksize)
571{ 599{
@@ -631,6 +659,19 @@ static inline int ocfs2_truncate_recs_per_inode(int blocksize)
631 659
632 return size / sizeof(struct ocfs2_truncate_rec); 660 return size / sizeof(struct ocfs2_truncate_rec);
633} 661}
662
663static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index)
664{
665 uint64_t offset = OCFS2_BACKUP_SB_START;
666
667 if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
668 offset <<= (2 * index);
669 offset /= blocksize;
670 return offset;
671 }
672
673 return 0;
674}
634#endif /* __KERNEL__ */ 675#endif /* __KERNEL__ */
635 676
636 677