Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1135138pxb; Wed, 10 Feb 2021 00:30:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCJ19m/KeGikdgt0hTkC2Ox6EatT/AeSDmBLNvyoWBaiXp6Rk+RCuH/SriFebmmr6Gd11C X-Received: by 2002:a17:906:bce2:: with SMTP id op2mr1845279ejb.127.1612945804846; Wed, 10 Feb 2021 00:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612945804; cv=none; d=google.com; s=arc-20160816; b=D1IwaZCcs0M0MSE64QP0NN9w+59sN8/wkolIh9uR/1vMkYziaWA4v77XPPcPi0attJ F+iTL461TPhec7zUJPWp/OPHqTnxn9w32P/5EhedcAkyOaxo//KKbLd1hDzTg95kvojk y6w925HV5nfTHCiJjqZrmvZfIz3bxAz7Du5bN3feIEP9PLTNrinxYxO9NDO6lhpd5dkz 5rn9+wv0XA4RdJvTy1KRIjxqT34JTzbeEligpf9cQsDCshe9HlWFqODe4auvaoxDESHN PzvfJjJwSrjAxLvc69WEnoEccKIstAJoeSp1NNo780G6NTSemcZUFZ2tE1SQq/GQUFpq Q8lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AhVShSbq82v6RtWV1y9Cl9bUWlKiXcAwC+UK22AZzXM=; b=ztiUWE8KlVxZiO92CyDzYH/gsMrcb5Mju2vbSoe4s9BCTK2eGNAKq27T/xWDIgIj48 ujD6YHqBhHNi5yA1swtWudaS/me005xFpiSWVE9NyNelbF29AGtHbREkg/UvcHRyEvnX 6/USILC4wiRZd6vn8qbHGLLWMZgjOyIp3UkAlK4KRgtfuPYeSwCO+X0Rn1hs90R0LVdL cD97ahicpLxOxaKFRIO2WDA7/oJr6bgPjgZkyEe6cLwQODCIBoH35rm3nrp0KnZL09dH az7l+irStBSx6jft1/w3+fH70wYiqDQ0Y1Hp1X/6Ne173zv8wR9Z2r4Nq/o77utpsTGv Ehsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=IMcUs6cF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s22si807227ejv.410.2021.02.10.00.29.40; Wed, 10 Feb 2021 00:30:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=IMcUs6cF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbhBJEJV (ORCPT + 99 others); Tue, 9 Feb 2021 23:09:21 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:38781 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbhBJEJQ (ORCPT ); Tue, 9 Feb 2021 23:09:16 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4Db5pn2cNcz2d; Wed, 10 Feb 2021 05:08:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1612930113; bh=ZDhTCXZCzIKGT4AKpym1hMLWxqXenhYjqabI+NNVA8Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IMcUs6cF8NQyQqbsoLs8XE1qtfzxGU9uBVivpA8PtKpv7xpWTG/rSDWROTz9YWxU5 CxWE7DeG1VY/Ep4KBzJ8b4nYmuP+u3Bf2+AeemI0OWhWa1crlOdqkPwdUDg6pq9VBI edTj0+06Ie1hxaaSWV0XS6M56xOH5NprinFGRECwF08qDakLQeFzHoT4fAS0dWB7/E Ek5ZwFd7Cy7u+fuTz69wwqGZ5P/3JQZHNNVbzpqBXd7MMSfne6MSKdHlbOyzDv9FOS NmRako666R3IBOoNu7cPDJs0WvluSKxlRK8TX6U3JfU+Uf6YLLf0B5KojybkFJ0Jlw iA9OhSGd83jEQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Wed, 10 Feb 2021 05:08:05 +0100 From: =?iso-8859-2?Q?Micha=B3_Miros=B3aw?= To: Michal Rostecki Cc: Chris Mason , Josef Bacik , David Sterba , "open list:BTRFS FILE SYSTEM" , open list , Michal Rostecki Subject: Re: [PATCH RFC 4/6] btrfs: Check if the filesystem is has mixed type of devices Message-ID: <20210210040805.GB12086@qmqm.qmqm.pl> References: <20210209203041.21493-1-mrostecki@suse.de> <20210209203041.21493-5-mrostecki@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210209203041.21493-5-mrostecki@suse.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 09, 2021 at 09:30:38PM +0100, Michal Rostecki wrote: > From: Michal Rostecki > > Add the btrfs_check_mixed() function which checks if the filesystem has > the mixed type of devices (non-rotational and rotational). This > information is going to be used in roundrobin raid1 read policy.a [...] > @@ -669,8 +699,12 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices, > } > > q = bdev_get_queue(bdev); > - if (!blk_queue_nonrot(q)) > + rotating = !blk_queue_nonrot(q); > + device->rotating = rotating; > + if (rotating) > fs_devices->rotating = true; > + if (!fs_devices->mixed) > + fs_devices->mixed = btrfs_check_mixed(fs_devices, rotating); [...] Since this is adding to a set, a faster way is: if (fs_devices->rotating != rotating) fs_devices->mixed = true; The scan might be necessary on device removal, though. > - if (!blk_queue_nonrot(q)) > + rotating = !blk_queue_nonrot(q); > + device->rotating = rotating; > + if (rotating) > fs_devices->rotating = true; > + if (!fs_devices->mixed) > + fs_devices->mixed = btrfs_check_mixed(fs_devices, rotating); Duplication. Maybe pull all this into a function? Best Regards, Micha? Miros?aw