diff options
author | Josef Bacik <jbacik@redhat.com> | 2008-12-02 06:36:08 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-12-02 06:36:08 -0500 |
commit | f2b636e80d8206dd4012de6e973c2367259a7d22 (patch) | |
tree | 4ed39baca853608bb7b77a6d1061766690cbb32a /fs/btrfs/disk-io.c | |
parent | 7a865e8ac3a8ead776ea2c8c74fa2b2d00a2c9cf (diff) |
Btrfs: add support for compat flags to btrfs
This adds the necessary disk format for handling compatibility flags
in the future to handle disk format changes. We have a compat_flags,
compat_ro_flags and incompat_flags set for the super block. Compat
flags will be to hold the features that are compatible with older
versions of btrfs, compat_ro flags have features that are compatible
with older versions of btrfs if the fs is mounted read only, and
incompat_flags has features that are incompatible with older versions
of btrfs. This also axes the compat_flags field for the inode and
just makes the flags field a 64bit field, and changes the root item
flags field to 64bit.
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 2464c099db57..6ae9bdf98b68 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1434,6 +1434,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1434 | u32 blocksize; | 1434 | u32 blocksize; |
1435 | u32 stripesize; | 1435 | u32 stripesize; |
1436 | u64 generation; | 1436 | u64 generation; |
1437 | u64 features; | ||
1437 | struct btrfs_key location; | 1438 | struct btrfs_key location; |
1438 | struct buffer_head *bh; | 1439 | struct buffer_head *bh; |
1439 | struct btrfs_root *extent_root = kzalloc(sizeof(struct btrfs_root), | 1440 | struct btrfs_root *extent_root = kzalloc(sizeof(struct btrfs_root), |
@@ -1586,6 +1587,26 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1586 | goto fail_sb_buffer; | 1587 | goto fail_sb_buffer; |
1587 | } | 1588 | } |
1588 | 1589 | ||
1590 | features = btrfs_super_incompat_flags(disk_super) & | ||
1591 | ~BTRFS_FEATURE_INCOMPAT_SUPP; | ||
1592 | if (features) { | ||
1593 | printk(KERN_ERR "BTRFS: couldn't mount because of " | ||
1594 | "unsupported optional features (%Lx).\n", | ||
1595 | features); | ||
1596 | err = -EINVAL; | ||
1597 | goto fail_sb_buffer; | ||
1598 | } | ||
1599 | |||
1600 | features = btrfs_super_compat_ro_flags(disk_super) & | ||
1601 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; | ||
1602 | if (!(sb->s_flags & MS_RDONLY) && features) { | ||
1603 | printk(KERN_ERR "BTRFS: couldn't mount RDWR because of " | ||
1604 | "unsupported option features (%Lx).\n", | ||
1605 | features); | ||
1606 | err = -EINVAL; | ||
1607 | goto fail_sb_buffer; | ||
1608 | } | ||
1609 | |||
1589 | /* | 1610 | /* |
1590 | * we need to start all the end_io workers up front because the | 1611 | * we need to start all the end_io workers up front because the |
1591 | * queue work function gets called at interrupt time, and so it | 1612 | * queue work function gets called at interrupt time, and so it |