Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2338409imm; Thu, 9 Aug 2018 11:07:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzu+yLjqQG4aAvrRxEn5lES3rSjlLCWheVT85/9MqNXQd0bQ2KKXPtiSfsMbURpoybDbOT2 X-Received: by 2002:a17:902:3225:: with SMTP id y34-v6mr2982088plb.206.1533838035390; Thu, 09 Aug 2018 11:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533838035; cv=none; d=google.com; s=arc-20160816; b=YEXlw/0JuG4t6lV76BcpKVid2JPY0KO5ujfSg1WKm/E2lEkWvRVMJEqBXHVsY0PKXl wlw057c15LgWRYDYNYcg3P6aco7sZ1Cdo1Xg+UED2QOnOVXQpbnn8GjTBAjxgKa5nOZZ astQOZhjn0LigQgCgvEj+cshsy7WTgqC0G8/scH6KDtHQX71lsLTtpwjkSN19F7U2seK NJiLxyNFcEQphH3mLFSOsmp0qDmDsynil9E2CpBqOqiJjXS5Va8aVYnQxjfQh0bulzyt XdRIs7n9FHSEtg7iTzTacJb9K4TEXkUI/qOs6hVjhZXMSdTQTtIaA9SM0ggcbsLKgI+W 2i+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Vragor325c5+mkfaiNN9c9VU2fiaVIcgfu01gZ3wtGE=; b=fNiUi+uo0wnVlDnF6XFG+GUe3Mg/1DwLlYtDGOGQW/+dNLHg541JQQRSDzVANplN0M pZZvKUdfsG0HGclZVQwE663g/KrreQVOpvlUqmKb+yBCYO3C2/pWyP16oo19bL491KRk Zk3NOoAKkPzZkJZIJzIVtJX+BZ1rrSkzlL8Z7g5vMCG8WtQU46oCwzjI5FIgYNATKGIR X4GtgXo/8DV5XDceXSD7uAOlYjO4LJmRCBFz9AOTOhsmIxoLmvO5Fodzz9hbv5TyMqj8 GOlk7pwDhSZy08Ujb3ZUs6sSx795/CxWw+KbtoAm7Ah4OVqIy1u/wEpTAtfG3POk+cJD X5HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=tlikYUqn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si7973023pfm.7.2018.08.09.11.07.01; Thu, 09 Aug 2018 11:07:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=tlikYUqn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727245AbeHIUb6 (ORCPT + 99 others); Thu, 9 Aug 2018 16:31:58 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:44915 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbeHIUb5 (ORCPT ); Thu, 9 Aug 2018 16:31:57 -0400 Received: by mail-pf1-f195.google.com with SMTP id k21-v6so3198410pff.11; Thu, 09 Aug 2018 11:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vragor325c5+mkfaiNN9c9VU2fiaVIcgfu01gZ3wtGE=; b=tlikYUqnqLXIS0Lu1xCQBWPm6kMPZpvmTEwdsavB5f4HIPzW8ojZw3kHq0+w7RkWJA hO2fAfdnBrdBgqfYOfjhqq4k4LL4Xou+JK5rUGklaC6hsoGIyg5pqg4698tgZrm/zgB0 FMjZ0pRsfpNxd0QAhyf6IkUUtRLouYU1w9NYqBIy9uQyNzqGXdmzz0evhTNOeBnbbY5Q tLBYrBwM+uDnP8B/Ba4M7NmOztR5Qc1ShcybQPy+Gm2B8O+STacQkAplpBDppeuJhnEd TVHrOXjzWbwXDxDqtRO6DijH2Ri9bEocpusuhzK7iga3Zo7Mb5DZgOGr5Zduei85Wkvg wStA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Vragor325c5+mkfaiNN9c9VU2fiaVIcgfu01gZ3wtGE=; b=JXzqdK3qywX+IF6Rpc5BH7IaXArtW1BYPiLZURkxxbcgGiaT3CI8xfgkcMDttstdpq 3Z1LBURY7yzmhP12rpGMICivS0hrCPkO/L5Ug9qqDYmkwIFVhxJVXOduBrIU9Z9l7I78 jXg0jgntyA+dgJnwWgMtWm6r2emZ31ONSoGfxc1QVpctD6UfwCYMPBxkEOHF8mPTNSZY aGaJrNQL48SbZ0PWgyb6W+f0sbG9SDWjbWYdpfgN80hOr54d4DAUF5YdV+AznxM8ehbt i7CLh6B/DQsBtpkMF3VwFjmo1AeIsd5MD2T8vI40gtfzLFTEbdrcUfgFbO/ghDpsZ/pK Izuw== X-Gm-Message-State: AOUpUlFxkPOb9Y1K0j7+04LbZcIPmtaq7KB5RzvUg5nJIGHj56Gq3Gzs 04n3sJzFX1GyF229jEWw740= X-Received: by 2002:a62:5b85:: with SMTP id p127-v6mr3478638pfb.33.1533837957898; Thu, 09 Aug 2018 11:05:57 -0700 (PDT) Received: from localhost (h101-111-148-072.catv02.itscom.jp. [101.111.148.72]) by smtp.gmail.com with ESMTPSA id 143-v6sm12128663pfy.156.2018.08.09.11.05.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 11:05:57 -0700 (PDT) From: Naohiro Aota To: David Sterba , linux-btrfs@vger.kernel.org Cc: Chris Mason , Josef Bacik , linux-kernel@vger.kernel.org, Hannes Reinecke , Damien Le Moal , Bart Van Assche , Matias Bjorling , Naohiro Aota Subject: [RFC PATCH 04/17] btrfs: limit super block locations in HMZONED mode Date: Fri, 10 Aug 2018 03:04:37 +0900 Message-Id: <20180809180450.5091-5-naota@elisp.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809180450.5091-1-naota@elisp.net> References: <20180809180450.5091-1-naota@elisp.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When in HMZONED mode, make sure that device super blocks are located in randomly writable zones of zoned block devices. That is, do not write super blocks in sequential write required zones of host-managed zoned block devices as update would not be possible. Signed-off-by: Damien Le Moal Signed-off-by: Naohiro Aota --- fs/btrfs/disk-io.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 14f284382ba7..6a014632ca1e 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3435,6 +3435,13 @@ struct buffer_head *btrfs_read_dev_super(struct block_device *bdev) return latest; } +static int check_super_location(struct btrfs_device *device, u64 pos) +{ + /* any address is good on a regular (zone_size == 0) device */ + /* non-SEQUENTIAL WRITE REQUIRED zones are capable on a zoned device */ + return device->zone_size == 0 || !btrfs_dev_is_sequential(device, pos); +} + /* * Write superblock @sb to the @device. Do not wait for completion, all the * buffer heads we write are pinned. @@ -3464,6 +3471,8 @@ static int write_dev_supers(struct btrfs_device *device, if (bytenr + BTRFS_SUPER_INFO_SIZE >= device->commit_total_bytes) break; + if (!check_super_location(device, bytenr)) + continue; btrfs_set_super_bytenr(sb, bytenr); -- 2.18.0