Re: [PATCH] btrfs: zoned: limit ordered extent to zoned append size
From: David Sterba <hidden>
Date: 2021-05-31 19:01:25
On Fri, May 21, 2021 at 06:11:04PM +0900, Johannes Thumshirn wrote:
quoted hunk ↗ jump to hunk
--- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c@@ -1860,6 +1860,7 @@ noinline_for_stack bool find_lock_delalloc_range(struct inode *inode, u64 *end) { struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; + struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); u64 max_bytes = BTRFS_MAX_EXTENT_SIZE; u64 delalloc_start; u64 delalloc_end;@@ -1868,6 +1869,9 @@ noinline_for_stack bool find_lock_delalloc_range(struct inode *inode, int ret; int loops = 0; + if (fs_info && fs_info->max_zone_append_size)
Do you really need to check for a valid fs_info? It's derived from an inode so it must be valid or something is seriously wrong.
+ max_bytes = ALIGN_DOWN(fs_info->max_zone_append_size, + PAGE_SIZE);
Right now the page alignment sounds ok because the delalloc code works on page granularity. There's the implicit assumpption that data blocks are page-sized, but the whole delalloc engine works on pages so no reason to use anything else.