Hi, On Fri, Sep 29, 2017 at 04:20:51PM +0900, Naohiro Aota wrote: > Balancing a fresh METADATA=dup btrfs file system (with size < 50G) > generates a 128MB sized block group. While we set max_stripe_size = > max_chunk_size = 256MB, we get this half sized block group: > > $ btrfs ins dump-t -t CHUNK_TREE btrfs.img|grep length > length 8388608 owner 2 stripe_len 65536 type DATA > length 33554432 owner 2 stripe_len 65536 type SYSTEM|DUP > length 134217728 owner 2 stripe_len 65536 type METADATA|DUP > > Before commit 86db25785a6e ("Btrfs: fix max chunk size on raid5/6"), we > used "stripe_size * ndevs > max_chunk_size * ncopies" to check the max > chunk size. Since stripe_size = 256MB * dev_stripes (= 2) = 512MB, ndevs > = 1, max_chunk_size = 256MB, and ncopies = 2, we allowed 256MB > METADATA|DUP block group. > > But now, we use "stripe_size * data_stripes > max_chunk_size". Since > data_stripes = 1 on DUP, it disallows the block group to have > 128MB. > What missing here is "dev_stripes". Proper logical space used by the block > group is "stripe_size * data_stripes / dev_stripes". Tweak the equations to > use the right value.
I started looking into it and still don't fully understand it. Change deep in the allocator can easily break some blockgroup combinations, so I'm rather conservative here. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html