btrfs: zoned: load zone's allocation offset
A zoned filesystem must allocate blocks at the zones' write pointer. The device's write pointer position can be mapped to a logical address within a block group. To facilitate this, add an "alloc_offset" to the block-group to track the logical addresses of the write pointer. This logical address is populated in btrfs_load_block_group_zone_info() from the write pointers of corresponding zones. For now, zoned filesystems the single profile. Supporting non-single profile with zone append writing is not trivial. For example, in the DUP profile, we send a zone append writing IO to two zones on a device. The device reply with written LBAs for the IOs. If the offsets of the returned addresses from the beginning of the zone are different, then it results in different logical addresses. We need fine-grained logical to physical mapping to support such separated physical address issue. Since it should require additional metadata type, disable non-single profiles for now. This commit supports the case all the zones in a block group are sequential. The next patch will handle the case having a conventional zone. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
381a696eb5
commit
08e11a3db0
@@ -15,6 +15,7 @@
|
||||
#include "delalloc-space.h"
|
||||
#include "discard.h"
|
||||
#include "raid56.h"
|
||||
#include "zoned.h"
|
||||
|
||||
/*
|
||||
* Return target flags in extended format or 0 if restripe for this chunk_type
|
||||
@@ -1855,6 +1856,13 @@ static int read_one_block_group(struct btrfs_fs_info *info,
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = btrfs_load_block_group_zone_info(cache);
|
||||
if (ret) {
|
||||
btrfs_err(info, "zoned: failed to load zone info of bg %llu",
|
||||
cache->start);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to exclude the super stripes now so that the space info has
|
||||
* super bytes accounted for, otherwise we'll think we have more space
|
||||
@@ -2141,6 +2149,13 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used,
|
||||
cache->cached = BTRFS_CACHE_FINISHED;
|
||||
if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE))
|
||||
cache->needs_free_space = 1;
|
||||
|
||||
ret = btrfs_load_block_group_zone_info(cache);
|
||||
if (ret) {
|
||||
btrfs_put_block_group(cache);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = exclude_super_stripes(cache);
|
||||
if (ret) {
|
||||
/* We may have excluded something, so call this just in case */
|
||||
|
||||
Reference in New Issue
Block a user