Merge branch 'for-4.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[muen/linux.git] / fs / btrfs / disk-io.c
index 0f2271815eb636bd71bd8bcfa53a7fb918b60da9..dfdab849037b70887e9a61d5b1044a313658d437 100644 (file)
@@ -2478,7 +2478,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
                return ret;
        }
 
-       if (fs_info->sb->s_flags & MS_RDONLY) {
+       if (sb_rdonly(fs_info->sb)) {
                ret = btrfs_commit_super(fs_info);
                if (ret)
                        return ret;
@@ -2828,6 +2828,8 @@ int open_ctree(struct super_block *sb,
        features |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;
        if (fs_info->compress_type == BTRFS_COMPRESS_LZO)
                features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
+       else if (fs_info->compress_type == BTRFS_COMPRESS_ZSTD)
+               features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD;
 
        if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
                btrfs_info(fs_info, "has skinny extents");
@@ -2874,7 +2876,7 @@ int open_ctree(struct super_block *sb,
 
        features = btrfs_super_compat_ro_flags(disk_super) &
                ~BTRFS_FEATURE_COMPAT_RO_SUPP;
-       if (!(sb->s_flags & MS_RDONLY) && features) {
+       if (!sb_rdonly(sb) && features) {
                btrfs_err(fs_info,
        "cannot mount read-write because of unsupported optional features (%llx)",
                       features);
@@ -3036,7 +3038,7 @@ retry_root_backup:
                goto fail_sysfs;
        }
 
-       if (!(sb->s_flags & MS_RDONLY) && !btrfs_check_rw_degradable(fs_info)) {
+       if (!sb_rdonly(sb) && !btrfs_check_rw_degradable(fs_info)) {
                btrfs_warn(fs_info,
                "writeable mount is not allowed due to too many missing devices");
                goto fail_sysfs;
@@ -3095,7 +3097,7 @@ retry_root_backup:
        if (ret)
                goto fail_qgroup;
 
-       if (!(sb->s_flags & MS_RDONLY)) {
+       if (!sb_rdonly(sb)) {
                ret = btrfs_cleanup_fs_roots(fs_info);
                if (ret)
                        goto fail_qgroup;
@@ -3121,7 +3123,7 @@ retry_root_backup:
                goto fail_qgroup;
        }
 
-       if (sb->s_flags & MS_RDONLY)
+       if (sb_rdonly(sb))
                return 0;
 
        if (btrfs_test_opt(fs_info, CLEAR_CACHE) &&
@@ -3511,7 +3513,7 @@ static void write_dev_flush(struct btrfs_device *device)
 
        bio_reset(bio);
        bio->bi_end_io = btrfs_end_empty_barrier;
-       bio->bi_bdev = device->bdev;
+       bio_set_dev(bio, device->bdev);
        bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH;
        init_completion(&device->flush_wait);
        bio->bi_private = &device->flush_wait;
@@ -3528,7 +3530,7 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
        struct bio *bio = device->flush_bio;
 
        if (!device->flush_bio_sent)
-               return 0;
+               return BLK_STS_OK;
 
        device->flush_bio_sent = 0;
        wait_for_completion_io(&device->flush_wait);
@@ -3565,7 +3567,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
                        continue;
 
                write_dev_flush(dev);
-               dev->last_flush_error = 0;
+               dev->last_flush_error = BLK_STS_OK;
        }
 
        /* wait for all the barriers */
@@ -3883,7 +3885,7 @@ void close_ctree(struct btrfs_fs_info *fs_info)
 
        cancel_work_sync(&fs_info->async_reclaim_work);
 
-       if (!(fs_info->sb->s_flags & MS_RDONLY)) {
+       if (!sb_rdonly(fs_info->sb)) {
                /*
                 * If the cleaner thread is stopped and there are
                 * block groups queued for removal, the deletion will be