From 17927372cf781093c33c5f9840af77cd87f47e5e Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Sun, 21 Jan 2007 14:44:59 -0800 Subject: [PATCH] --- yaml --- r: 45599 b: refs/heads/master c: 50af94b14c98f5769860a282a397c6f3b135c8a8 h: refs/heads/master i: 45597: f689a4d1e9d38a3a24a8812739ba53e2ca609c41 45595: ba67e778a8d36edfd693b3be51000aef240aee59 45591: e2acc14b65d3a30f334f842c939cc45077338654 45583: 51fbdaadc3a782a7003c375b57e19469cac950b9 45567: 7e365dd9da39b728c06fca40bcaba3b5cb47daf0 v: v3 --- [refs] | 2 +- trunk/fs/ocfs2/ocfs2_fs.h | 43 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 20da42dd4c90..7d8232c90cf1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6a1bd4a5788435b6ef1664383604b43607eb825a +refs/heads/master: 50af94b14c98f5769860a282a397c6f3b135c8a8 diff --git a/trunk/fs/ocfs2/ocfs2_fs.h b/trunk/fs/ocfs2/ocfs2_fs.h index b5c68567077e..c99e9058c198 100644 --- a/trunk/fs/ocfs2/ocfs2_fs.h +++ b/trunk/fs/ocfs2/ocfs2_fs.h @@ -85,7 +85,7 @@ #define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask) \ OCFS2_SB(sb)->s_feature_incompat &= ~(mask) -#define OCFS2_FEATURE_COMPAT_SUPP 0 +#define OCFS2_FEATURE_COMPAT_SUPP OCFS2_FEATURE_COMPAT_BACKUP_SB #define OCFS2_FEATURE_INCOMPAT_SUPP OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT #define OCFS2_FEATURE_RO_COMPAT_SUPP 0 @@ -109,6 +109,20 @@ /* Support for sparse allocation in b-trees */ #define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC 0x0010 +/* + * backup superblock flag is used to indicate that this volume + * has backup superblocks. + */ +#define OCFS2_FEATURE_COMPAT_BACKUP_SB 0x0001 + +/* The byte offset of the first backup block will be 1G. + * The following will be 4G, 16G, 64G, 256G and 1T. + */ +#define OCFS2_BACKUP_SB_START 1 << 30 + +/* the max backup superblock nums */ +#define OCFS2_MAX_BACKUP_SUPERBLOCKS 6 + /* * Flags on ocfs2_dinode.i_flags */ @@ -566,6 +580,20 @@ static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb) return size / sizeof(struct ocfs2_truncate_rec); } + +static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index) +{ + u64 offset = OCFS2_BACKUP_SB_START; + + if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) { + offset <<= (2 * index); + offset /= sb->s_blocksize; + return offset; + } + + return 0; + +} #else static inline int ocfs2_fast_symlink_chars(int blocksize) { @@ -631,6 +659,19 @@ static inline int ocfs2_truncate_recs_per_inode(int blocksize) return size / sizeof(struct ocfs2_truncate_rec); } + +static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index) +{ + uint64_t offset = OCFS2_BACKUP_SB_START; + + if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) { + offset <<= (2 * index); + offset /= blocksize; + return offset; + } + + return 0; +} #endif /* __KERNEL__ */