diff options
author | Alex Shi <alex.shi@linaro.org> | 2018-03-23 02:33:52 +0000 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2018-03-23 02:33:52 +0000 |
commit | 323174b55ef1de0c70ed0b268fcaf9f2d6f842c6 (patch) | |
tree | 903ffc44d70b2adc60c4b067e696b9bf3039373a /fs/btrfs/volumes.c | |
parent | ba2e9dd8362bcdb75daa97b0bc7b06eb331521c8 (diff) | |
parent | a779add58a837fbd5156e0fab0aca5e3b53754ef (diff) |
Merge tag 'v4.9.89' into linux-linaro-lsk-v4.9
This is the 4.9.89 stable release
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 06a77e47957d..5900508ca6ed 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -583,6 +583,7 @@ void btrfs_free_stale_device(struct btrfs_device *cur_dev) btrfs_sysfs_remove_fsid(fs_devs); list_del(&fs_devs->list); free_fs_devices(fs_devs); + break; } else { fs_devs->num_devices--; list_del(&dev->dev_list); @@ -4748,10 +4749,13 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, if (devs_max && ndevs > devs_max) ndevs = devs_max; /* - * the primary goal is to maximize the number of stripes, so use as many - * devices as possible, even if the stripes are not maximum sized. + * The primary goal is to maximize the number of stripes, so use as + * many devices as possible, even if the stripes are not maximum sized. + * + * The DUP profile stores more than one stripe per device, the + * max_avail is the total size so we have to adjust. */ - stripe_size = devices_info[ndevs-1].max_avail; + stripe_size = div_u64(devices_info[ndevs - 1].max_avail, dev_stripes); num_stripes = ndevs * dev_stripes; /* @@ -4791,8 +4795,6 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, stripe_size = devices_info[ndevs-1].max_avail; } - stripe_size = div_u64(stripe_size, dev_stripes); - /* align to BTRFS_STRIPE_LEN */ stripe_size = div_u64(stripe_size, raid_stripe_len); stripe_size *= raid_stripe_len; |