Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1279429pxb; Wed, 10 Feb 2021 04:54:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0EPwSWMbNafKGVRR1sqJ4TgfKu5dyIJ3p+phtpRUrrc9/HMtg+Reg9mQPqnAZGitMO4Yg X-Received: by 2002:a17:906:2697:: with SMTP id t23mr2825836ejc.357.1612961663514; Wed, 10 Feb 2021 04:54:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612961663; cv=none; d=google.com; s=arc-20160816; b=Qbq6NtlxjZH5DPh33zbjd39DPp+meknuFKcanDEkmwu314KdVPhplPMZqZefkYHzmR oOFF8prUvwfutzFqyblAqo5mhNLwVHVJYEr30GIaza74UZZJTjREaHKRlL1BpSHASbVu 7Kst4I8x0IEQvbC2xEQ9O1aZfrxnsz1g+vmkxAZzZ43toEonFSRMyy4vDwec3KSmrts5 E+IJx14/LY7Va8HbrnM0U9YUud3QFwGfhCrHI3y5TPjDrMAvy1Yz/26M54XHeiLbJl0a MxN3uSMGPWmXFcn8g1e/LjCVWYBTKrmwk0VYoLiH6OX9IxojraIa2rFwJ0A8F3PtWmV1 ZJWQ== 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; bh=pPLULdXDazCciX4HwdS4bTI/NqxzPXi96YPCtO+r0b0=; b=CgI+QkTB8thIaQcM5/j3DUFtSMW+vIC7TBJd+Zr/5BMrnBSr4Xtp2ezxfRW9P1iin2 37HTxD8WaCxAgxudA3946pZ5WZD7iTZjXZx8zXZ7dONoTg5S+wmEOM91xcaXDpgRu8PX xHOaTO06kOiDVbgK6kQVg02U+IaAqEfoapXz6SExidi8xd0AyiAplQicqc4vTBLnWTw5 T4PNzTC5Vo4NDnfzxsk/jxoMKQzq6FLFhHEv9v46J2RkbdxVcRn6M232AI7V/2T+z5xP M8WkNAViaX3gLc11y8dRplPRUNJIMknAzFF92vJtN0uC5xp+C4cHLf+3AmDaqJbJMOkE OUzw== ARC-Authentication-Results: i=1; mx.google.com; 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 p3si1195954eji.503.2021.02.10.04.53.59; Wed, 10 Feb 2021 04:54:23 -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; 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 S229651AbhBJMvE (ORCPT + 99 others); Wed, 10 Feb 2021 07:51:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:52184 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbhBJMu5 (ORCPT ); Wed, 10 Feb 2021 07:50:57 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7BA9EAEBE; Wed, 10 Feb 2021 12:50:15 +0000 (UTC) Date: Wed, 10 Feb 2021 12:50:14 +0000 From: Michal Rostecki To: =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= 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: <20210210125014.GC23499@wotan.suse.de> References: <20210209203041.21493-1-mrostecki@suse.de> <20210209203041.21493-5-mrostecki@suse.de> <20210210040805.GB12086@qmqm.qmqm.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210210040805.GB12086@qmqm.qmqm.pl> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 05:08:05AM +0100, Michał Mirosław wrote: > 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; > Good idea. > The scan might be necessary on device removal, though. > And good point. I didn't address the case of device removal at all. > > - 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? > Will do that as well. > Best Regards, > Michał Mirosław Regards, Michal