diff options
| -rw-r--r-- | fs/ocfs2/ocfs2.h | 31 | ||||
| -rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 40 | ||||
| -rw-r--r-- | fs/ocfs2/super.c | 4 |
3 files changed, 66 insertions, 9 deletions
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index c67003b6b5a2..d5496a792bdb 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
| @@ -368,6 +368,8 @@ struct ocfs2_super | |||
| 368 | struct ocfs2_alloc_stats alloc_stats; | 368 | struct ocfs2_alloc_stats alloc_stats; |
| 369 | char dev_str[20]; /* "major,minor" of the device */ | 369 | char dev_str[20]; /* "major,minor" of the device */ |
| 370 | 370 | ||
| 371 | u8 osb_stackflags; | ||
| 372 | |||
| 371 | char osb_cluster_stack[OCFS2_STACK_LABEL_LEN + 1]; | 373 | char osb_cluster_stack[OCFS2_STACK_LABEL_LEN + 1]; |
| 372 | struct ocfs2_cluster_connection *cconn; | 374 | struct ocfs2_cluster_connection *cconn; |
| 373 | struct ocfs2_lock_res osb_super_lockres; | 375 | struct ocfs2_lock_res osb_super_lockres; |
| @@ -601,10 +603,35 @@ static inline int ocfs2_is_soft_readonly(struct ocfs2_super *osb) | |||
| 601 | return ret; | 603 | return ret; |
| 602 | } | 604 | } |
| 603 | 605 | ||
| 604 | static inline int ocfs2_userspace_stack(struct ocfs2_super *osb) | 606 | static inline int ocfs2_clusterinfo_valid(struct ocfs2_super *osb) |
| 605 | { | 607 | { |
| 606 | return (osb->s_feature_incompat & | 608 | return (osb->s_feature_incompat & |
| 607 | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK); | 609 | (OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK | |
| 610 | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO)); | ||
| 611 | } | ||
| 612 | |||
| 613 | static inline int ocfs2_userspace_stack(struct ocfs2_super *osb) | ||
| 614 | { | ||
| 615 | if (ocfs2_clusterinfo_valid(osb) && | ||
| 616 | memcmp(osb->osb_cluster_stack, OCFS2_CLASSIC_CLUSTER_STACK, | ||
| 617 | OCFS2_STACK_LABEL_LEN)) | ||
| 618 | return 1; | ||
| 619 | return 0; | ||
| 620 | } | ||
| 621 | |||
| 622 | static inline int ocfs2_o2cb_stack(struct ocfs2_super *osb) | ||
| 623 | { | ||
| 624 | if (ocfs2_clusterinfo_valid(osb) && | ||
| 625 | !memcmp(osb->osb_cluster_stack, OCFS2_CLASSIC_CLUSTER_STACK, | ||
| 626 | OCFS2_STACK_LABEL_LEN)) | ||
| 627 | return 1; | ||
| 628 | return 0; | ||
| 629 | } | ||
| 630 | |||
| 631 | static inline int ocfs2_cluster_o2cb_global_heartbeat(struct ocfs2_super *osb) | ||
| 632 | { | ||
| 633 | return ocfs2_o2cb_stack(osb) && | ||
| 634 | (osb->osb_stackflags & OCFS2_CLUSTER_O2CB_GLOBAL_HEARTBEAT); | ||
| 608 | } | 635 | } |
| 609 | 636 | ||
| 610 | static inline int ocfs2_mount_local(struct ocfs2_super *osb) | 637 | static inline int ocfs2_mount_local(struct ocfs2_super *osb) |
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index fa31d05e41b7..d5b1d99abc3c 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
| @@ -101,7 +101,8 @@ | |||
| 101 | | OCFS2_FEATURE_INCOMPAT_META_ECC \ | 101 | | OCFS2_FEATURE_INCOMPAT_META_ECC \ |
| 102 | | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS \ | 102 | | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS \ |
| 103 | | OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE \ | 103 | | OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE \ |
| 104 | | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG) | 104 | | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG \ |
| 105 | | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO) | ||
| 105 | #define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \ | 106 | #define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \ |
| 106 | | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \ | 107 | | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \ |
| 107 | | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA) | 108 | | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA) |
| @@ -170,6 +171,13 @@ | |||
| 170 | #define OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG 0x2000 | 171 | #define OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG 0x2000 |
| 171 | 172 | ||
| 172 | /* | 173 | /* |
| 174 | * Incompat bit to indicate useable clusterinfo with stackflags for all | ||
| 175 | * cluster stacks (userspace adnd o2cb). If this bit is set, | ||
| 176 | * INCOMPAT_USERSPACE_STACK becomes superfluous and thus should not be set. | ||
| 177 | */ | ||
| 178 | #define OCFS2_FEATURE_INCOMPAT_CLUSTERINFO 0x4000 | ||
| 179 | |||
| 180 | /* | ||
| 173 | * backup superblock flag is used to indicate that this volume | 181 | * backup superblock flag is used to indicate that this volume |
| 174 | * has backup superblocks. | 182 | * has backup superblocks. |
| 175 | */ | 183 | */ |
| @@ -292,10 +300,13 @@ | |||
| 292 | #define OCFS2_VOL_UUID_LEN 16 | 300 | #define OCFS2_VOL_UUID_LEN 16 |
| 293 | #define OCFS2_MAX_VOL_LABEL_LEN 64 | 301 | #define OCFS2_MAX_VOL_LABEL_LEN 64 |
| 294 | 302 | ||
| 295 | /* The alternate, userspace stack fields */ | 303 | /* The cluster stack fields */ |
| 296 | #define OCFS2_STACK_LABEL_LEN 4 | 304 | #define OCFS2_STACK_LABEL_LEN 4 |
| 297 | #define OCFS2_CLUSTER_NAME_LEN 16 | 305 | #define OCFS2_CLUSTER_NAME_LEN 16 |
| 298 | 306 | ||
| 307 | /* Classic (historically speaking) cluster stack */ | ||
| 308 | #define OCFS2_CLASSIC_CLUSTER_STACK "o2cb" | ||
| 309 | |||
| 299 | /* Journal limits (in bytes) */ | 310 | /* Journal limits (in bytes) */ |
| 300 | #define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024) | 311 | #define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024) |
| 301 | 312 | ||
| @@ -305,6 +316,11 @@ | |||
| 305 | */ | 316 | */ |
| 306 | #define OCFS2_MIN_XATTR_INLINE_SIZE 256 | 317 | #define OCFS2_MIN_XATTR_INLINE_SIZE 256 |
| 307 | 318 | ||
| 319 | /* | ||
| 320 | * Cluster info flags (ocfs2_cluster_info.ci_stackflags) | ||
| 321 | */ | ||
| 322 | #define OCFS2_CLUSTER_O2CB_GLOBAL_HEARTBEAT (0x01) | ||
| 323 | |||
| 308 | struct ocfs2_system_inode_info { | 324 | struct ocfs2_system_inode_info { |
| 309 | char *si_name; | 325 | char *si_name; |
| 310 | int si_iflags; | 326 | int si_iflags; |
| @@ -566,9 +582,21 @@ struct ocfs2_slot_map_extended { | |||
| 566 | */ | 582 | */ |
| 567 | }; | 583 | }; |
| 568 | 584 | ||
| 585 | /* | ||
| 586 | * ci_stackflags is only valid if the incompat bit | ||
| 587 | * OCFS2_FEATURE_INCOMPAT_CLUSTERINFO is set. | ||
| 588 | */ | ||
| 569 | struct ocfs2_cluster_info { | 589 | struct ocfs2_cluster_info { |
| 570 | /*00*/ __u8 ci_stack[OCFS2_STACK_LABEL_LEN]; | 590 | /*00*/ __u8 ci_stack[OCFS2_STACK_LABEL_LEN]; |
| 571 | __le32 ci_reserved; | 591 | union { |
| 592 | __le32 ci_reserved; | ||
| 593 | struct { | ||
| 594 | __u8 ci_stackflags; | ||
| 595 | __u8 ci_reserved1; | ||
| 596 | __u8 ci_reserved2; | ||
| 597 | __u8 ci_reserved3; | ||
| 598 | }; | ||
| 599 | }; | ||
| 572 | /*08*/ __u8 ci_cluster[OCFS2_CLUSTER_NAME_LEN]; | 600 | /*08*/ __u8 ci_cluster[OCFS2_CLUSTER_NAME_LEN]; |
| 573 | /*18*/ | 601 | /*18*/ |
| 574 | }; | 602 | }; |
| @@ -605,9 +633,9 @@ struct ocfs2_super_block { | |||
| 605 | * group header */ | 633 | * group header */ |
| 606 | /*50*/ __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ | 634 | /*50*/ __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ |
| 607 | /*90*/ __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ | 635 | /*90*/ __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ |
| 608 | /*A0*/ struct ocfs2_cluster_info s_cluster_info; /* Selected userspace | 636 | /*A0*/ struct ocfs2_cluster_info s_cluster_info; /* Only valid if either |
| 609 | stack. Only valid | 637 | userspace or clusterinfo |
| 610 | with INCOMPAT flag. */ | 638 | INCOMPAT flag set. */ |
| 611 | /*B8*/ __le16 s_xattr_inline_size; /* extended attribute inline size | 639 | /*B8*/ __le16 s_xattr_inline_size; /* extended attribute inline size |
| 612 | for this fs*/ | 640 | for this fs*/ |
| 613 | __le16 s_reserved0; | 641 | __le16 s_reserved0; |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index fa1be1b304d1..755431739396 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
| @@ -2149,7 +2149,9 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
| 2149 | goto bail; | 2149 | goto bail; |
| 2150 | } | 2150 | } |
| 2151 | 2151 | ||
| 2152 | if (ocfs2_userspace_stack(osb)) { | 2152 | if (ocfs2_clusterinfo_valid(osb)) { |
| 2153 | osb->osb_stackflags = | ||
| 2154 | OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags; | ||
| 2153 | memcpy(osb->osb_cluster_stack, | 2155 | memcpy(osb->osb_cluster_stack, |
| 2154 | OCFS2_RAW_SB(di)->s_cluster_info.ci_stack, | 2156 | OCFS2_RAW_SB(di)->s_cluster_info.ci_stack, |
| 2155 | OCFS2_STACK_LABEL_LEN); | 2157 | OCFS2_STACK_LABEL_LEN); |
