From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEA2DC433DB for ; Fri, 15 Jan 2021 22:17:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E7EC22522 for ; Fri, 15 Jan 2021 22:17:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726607AbhAOWRP (ORCPT ); Fri, 15 Jan 2021 17:17:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbhAOWRO (ORCPT ); Fri, 15 Jan 2021 17:17:14 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3DAC0613D3 for ; Fri, 15 Jan 2021 14:16:34 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id 186so13267072qkj.3 for ; Fri, 15 Jan 2021 14:16:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4aN9oA1N7juzXfdXE+PXfSx6s2NsbKqM7ahAHcpgrzM=; b=SzfBZf0AC+PW7i5MWAvJTqrtPtGNxCS19lNr2MjhM+wL2sc2K5IcaEx4+O2UJE+U5f HbneO4LPScqDQ9lK+zpA4JaZyINu+yEpelAuChu4a55YdFSgXAVNueTdjITqtPDH1vim 1GPPwKUSwJ07l73whOqHCcrEQRoi27sUhpZT9if6XbTjd4pJOFw3YviAP/jnOfQl1Hu7 1pxL0zRlqsB/DwsXCvbJLuSGp1yxoqHQSNvX6UM653h8Cd+3DyJwaBUIByISV2258NBW 84tpxotp1hPuoFG5sVvZGYd2s8glSAe9qKQpjLScbcak+mEW43U/sIQ9kfINImsP4+Gc 2fdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4aN9oA1N7juzXfdXE+PXfSx6s2NsbKqM7ahAHcpgrzM=; b=EJa5sm2Mg1uomBygNCpNjb3Lg2Kx80V1guNBY1PoKBFHT9m5fJ1uCqtOa6Nsw75qAR zLDdMu9PM7IP27AKWkeaU3f9HcQrAw3s/aY/pluR1p0K3uPHHLjgZ/0zRhEuylZHccVd YVJ7xAxoRlCtKEHnBeagAFx/+w8ccvE6e89bRKoiISVDt82uc5iCZ59gQqbEpq6cwcIl LLNJS9LVfeigFpSonmZuOukTpax7AsulF14UFPrItIHwKQq6TkauRqIURZIzs4AQ/OA2 udSNq2cw5aJJHmMcDb+83tGjMpwuaomGptsjo+WVdUYjKaVnDn9V0WUXbOlqu9vw535Z VwEA== X-Gm-Message-State: AOAM530sIOGWyiuXLT4yxSDIonOSggNOH0/WPKrVy+8uoBSg++lYf1ig lxfMGQZX+FdjEsDKa/knlAG8fg== X-Google-Smtp-Source: ABdhPJzS1C9/Yn7X7lgtmb2v7YgCiM/Xxlr51Yk9BwS+mLzYlxu2BPmI4HpVBeEJc6kT2Ueban/BcA== X-Received: by 2002:a05:620a:81b:: with SMTP id s27mr14768315qks.385.1610748993822; Fri, 15 Jan 2021 14:16:33 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:11e1::105d? ([2620:10d:c091:480::1:cc17]) by smtp.gmail.com with ESMTPSA id 38sm3448382qtb.67.2021.01.15.14.16.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jan 2021 14:16:33 -0800 (PST) Subject: Re: [PATCH v12 20/41] btrfs: use bio_add_zone_append_page for zoned btrfs To: Naohiro Aota , linux-btrfs@vger.kernel.org, dsterba@suse.com Cc: hare@suse.com, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig , "Darrick J. Wong" References: <9cb19c5a674bede549a357b676627083bf71345d.1610693037.git.naohiro.aota@wdc.com> From: Josef Bacik Message-ID: <0c747633-0f43-63ac-86cf-943c24677cd1@toxicpanda.com> Date: Fri, 15 Jan 2021 17:16:31 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <9cb19c5a674bede549a357b676627083bf71345d.1610693037.git.naohiro.aota@wdc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 1/15/21 1:53 AM, Naohiro Aota wrote: > Zoned device has its own hardware restrictions e.g. max_zone_append_size > when using REQ_OP_ZONE_APPEND. To follow the restrictions, use > bio_add_zone_append_page() instead of bio_add_page(). We need target device > to use bio_add_zone_append_page(), so this commit reads the chunk > information to memoize the target device to btrfs_io_bio(bio)->device. > > Currently, zoned btrfs only supports SINGLE profile. In the feature, > btrfs_io_bio can hold extent_map and check the restrictions for all the > devices the bio will be mapped. > > Reviewed-by: Josef Bacik > Signed-off-by: Naohiro Aota > --- > fs/btrfs/extent_io.c | 30 +++++++++++++++++++++++++++--- > 1 file changed, 27 insertions(+), 3 deletions(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 96f43b9121d6..41fccfbaee15 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -3083,6 +3083,7 @@ static bool btrfs_bio_add_page(struct bio *bio, struct page *page, u64 logical, > { > sector_t sector = logical >> SECTOR_SHIFT; > bool contig; > + int ret; > > if (prev_bio_flags != bio_flags) > return false; > @@ -3097,7 +3098,12 @@ static bool btrfs_bio_add_page(struct bio *bio, struct page *page, u64 logical, > if (btrfs_bio_fits_in_stripe(page, size, bio, bio_flags)) > return false; > > - return bio_add_page(bio, page, size, pg_offset) == size; > + if (bio_op(bio) == REQ_OP_ZONE_APPEND) > + ret = bio_add_zone_append_page(bio, page, size, pg_offset); > + else > + ret = bio_add_page(bio, page, size, pg_offset); > + > + return ret == size; > } > > /* > @@ -3128,7 +3134,9 @@ static int submit_extent_page(unsigned int opf, > int ret = 0; > struct bio *bio; > size_t io_size = min_t(size_t, size, PAGE_SIZE); > - struct extent_io_tree *tree = &BTRFS_I(page->mapping->host)->io_tree; > + struct btrfs_inode *inode = BTRFS_I(page->mapping->host); > + struct extent_io_tree *tree = &inode->io_tree; > + struct btrfs_fs_info *fs_info = inode->root->fs_info; > > ASSERT(bio_ret); > > @@ -3159,11 +3167,27 @@ static int submit_extent_page(unsigned int opf, > if (wbc) { > struct block_device *bdev; > > - bdev = BTRFS_I(page->mapping->host)->root->fs_info->fs_devices->latest_bdev; > + bdev = fs_info->fs_devices->latest_bdev; > bio_set_dev(bio, bdev); > wbc_init_bio(wbc, bio); > wbc_account_cgroup_owner(wbc, page, io_size); > } > + if (btrfs_is_zoned(fs_info) && > + bio_op(bio) == REQ_OP_ZONE_APPEND) { > + struct extent_map *em; > + struct map_lookup *map; > + > + em = btrfs_get_chunk_map(fs_info, offset, io_size); Same goes for this, it fails to compile on misc-next. Thanks, Josef