From patchwork Mon Oct 7 11:52:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13824525 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B6A41D14EC for ; Mon, 7 Oct 2024 11:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728301987; cv=none; b=Fv/JSktNHBgOkz6TIZtPt8OYyLiGDHBcDEc607uBGdDsbobiObts/hCpKasmNC4aNNzLjT2acU01eoWT0vsGtHSGDiyOlDoVXG82ODIB6wAO4DkrS1CsfQZbd06ff9W5OKmlQhUYjx+gulF+UsVgQ/EU4tz6YJFOeRLZQEtD0hY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728301987; c=relaxed/simple; bh=ciI+LWCUlTIS96ABiIuJgms7yBoCOdDOj616x3zsuPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TFnm9AIhn/ZasDhH9VJks/rgpUBV7KSRya419Ypxaj4/ZZ4VjQzykZPNTAzwy7w3HqRpMRpy3Ej5QUXXv41qbxDDF7uj2Z2Y5ncZPWT+z6IF+LI0rtFIVRivoZCQjBif987CBIZHzqidERz/C7COhqx7SkqT30zvIlV/H3aR2ms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42cb6f3a5bcso57839235e9.2 for ; Mon, 07 Oct 2024 04:53:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728301984; x=1728906784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w5zl/oUKeQlueLBeiiFxcIUlyTQ7b9PLM0joLf/wpD4=; b=ZtjcrP5DTanC5KM+KAcjEU98HOHGx3qpbpGDIV0oaz49yNbBYu4gIoq1jKKuUzCMqi ZzYuIzO8cAbauJn+zPTm9szebXK99B9yLDQbrKX0ljxDT+gmoluuvmXYtgcJA3b78SLF N+ZzK8+BRy1F2rmIwKbqeixmjcvKWIRYlnbx130ohMVYI/Mg/9zadBXgK4KQKu+JMwPU qmEzgR1sYtYdTR21TvjmCHjcpBQKAMf1jF7JCCtESK69CxrxA+gYinDQa1OJ4QWnEYDq A5toV8gZXk163BgQu2UJ2BCaue/UP1/1VyAGzUlUSqsbJ8U9urPCF3VSHeAJxbY76okx 6UPg== X-Gm-Message-State: AOJu0YxioGSYkuhdWMN9Y9va3jfX5oIliWqLJGjx3TTXRf/PUlshrrZN A5dnwoS8T+WG92EVVpt5Xayn/POhF7QkFFUKRZAPYApHSPo8XOuCxJCjHp3c X-Google-Smtp-Source: AGHT+IEykPbagy6EOLFH2MIfi+7pXTsdSYs0o+yrRXS6XsW2cJl/lFxZAgWyXdmIEcpZAJ1/JFBDcQ== X-Received: by 2002:a05:600c:1e22:b0:42c:b555:43dd with SMTP id 5b1f17b1804b1-42f85a6e1admr122131745e9.3.1728301984438; Mon, 07 Oct 2024 04:53:04 -0700 (PDT) Received: from nuc.fritz.box (p200300f6f71aeb00fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f71a:eb00:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d1695e36dsm5570238f8f.85.2024.10.07.04.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 04:53:04 -0700 (PDT) From: Johannes Thumshirn To: David Sterba , Chris Mason , Josef Bacik Cc: linux-btrfs@vger.kernel.org, Johannes Thumshirn Subject: [PATCH 1/2] btrfs: return ENODATA in case RST lookup fails Date: Mon, 7 Oct 2024 13:52:47 +0200 Message-ID: <20241007115248.16434-2-jth@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007115248.16434-1-jth@kernel.org> References: <20241007115248.16434-1-jth@kernel.org> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Thumshirn In case a lookup in the RAID stripe-tree fails, return ENODATA instead of ENOENT to better distinguish stripe-tree lookups from other code paths where we return ENOENT. Suggested-by: Josef Bacik Signed-off-by: Johannes Thumshirn --- fs/btrfs/raid-stripe-tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index b7787a8e4af2..41970bbdb05f 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -234,7 +234,7 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, found_end = found_logical + found_length; if (found_logical > end) { - ret = -ENOENT; + ret = -ENODATA; goto out; } @@ -280,10 +280,10 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, } /* If we're here, we haven't found the requested devid in the stripe. */ - ret = -ENOENT; + ret = -ENODATA; out: if (ret > 0) - ret = -ENOENT; + ret = -ENODATA; if (ret && ret != -EIO && !stripe->rst_search_commit_root) { btrfs_debug(fs_info, "cannot find raid-stripe for logical [%llu, %llu] devid %llu, profile %s", From patchwork Mon Oct 7 11:52:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13824526 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DA7D1D1F56 for ; Mon, 7 Oct 2024 11:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728301988; cv=none; b=czwVqUp2JD4ZNdOIrlVhndQNExA1aPFp1GGQP/mfvBaIWrd/ZciVj2UPETeIKEs9l63LmHA6XAOdL8ShlvKuAVNmeA/uJG7aeLYu6tw7qJtEf5iUoui0Nut+j/nxvXW93BXvzCK8vlySrx50sIOdf+Kh18RdouMaCIrn/b7/eas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728301988; c=relaxed/simple; bh=G8MZuBaiyQ+1y5sK4SONK4j+7xUSGTknzcHmTUZ+eyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qR7YiVYQzCdezASILr+9xtByJYeRkDFUgCNp6ymRjE3TeCJiwhFQS+v90D16gw982T3vgl5UBqjo8/UvIhp15RHXnBBWgFEi8rYcjehTO1I6BMK/6/IIhwBT9KBumTDvKC10icklqwX+K19N+JBnEkkqyNTALkl7C0EYXnMHGt8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37cdb42b29dso2737819f8f.0 for ; Mon, 07 Oct 2024 04:53:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728301985; x=1728906785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fc5Whcht6JjcDwjELihCRf6ceDPK2grnVpeOSGIktNQ=; b=cHzBLblIKlGZ48j/+jEerAaRadQITLd69hQa3Q13zcEhGkqSKIrPaJ8MBkLLaj2DqR zpbemxC7kaH3XkIqO5x7dLc3DnenDODC1P5uKIsCassS9zFv8lpzQaboolvcbwam9UAK lgQI8FemiSQ19FFJUwxhPLWkrLqydXZUQYtlJ2uwlvKLGkGV7jCH4tTxd9BRzFKgj6Mw z+x1ZThnrOjz3/i1jvyEOcM5xrBiRBJAEkILus9VXJbIdGwqsY/GLBEqE6ZsMLoo+IjX kXF8rv/4sZibiTX0/XhLm//5zvoK0MZjlkrqTOXjdgRofZYrn9Tg2t+ozUHPOKDawCXq lLUw== X-Gm-Message-State: AOJu0YxyIBjjzbxaSwPY1ewGsI0uMlWXMPC5/Rmpup8J31dQVZ8cxb0U 21Z5uK6k3fPjEF1EVCm+1blYGRMaE+zugTVxKVltf3y9x2ooVVN0 X-Google-Smtp-Source: AGHT+IEMxWB5hst1cR8JdaZZyJ092DsI8ZUBqylmISjjob62OW/yKF2vLsuad4Kifiqzns05aVl9ZA== X-Received: by 2002:a5d:5f53:0:b0:37c:f933:48a9 with SMTP id ffacd0b85a97d-37d0e6d317fmr8141935f8f.1.1728301985370; Mon, 07 Oct 2024 04:53:05 -0700 (PDT) Received: from nuc.fritz.box (p200300f6f71aeb00fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f71a:eb00:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d1695e36dsm5570238f8f.85.2024.10.07.04.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 04:53:05 -0700 (PDT) From: Johannes Thumshirn To: David Sterba , Chris Mason , Josef Bacik Cc: linux-btrfs@vger.kernel.org, Johannes Thumshirn Subject: [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors Date: Mon, 7 Oct 2024 13:52:48 +0200 Message-ID: <20241007115248.16434-3-jth@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007115248.16434-1-jth@kernel.org> References: <20241007115248.16434-1-jth@kernel.org> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Thumshirn Performing the initial extent sector read on a RAID stripe-tree backed filesystem with pre-allocated extents will cause the RAID stripe-tree lookup code to return ENODATA, as pre-allocated extents do not have any on-disk bytes and thus no RAID stripe-tree entries. But the current scrub read code marks these extens as errors, because the lookup fails. If btrfs_map_block() returns -ENODATA, it means that the call to btrfs_get_raid_extent_offset() returned -ENODATA, because there is no entry for the corresponding range in the RAID stripe-tree. But as this range is in the extent-tree it means we've hit a pre-allocated extent. In this case, don't mark the sector in the stripe's error bitmaps as faulty and carry on to the next. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index e141132b5c8d..96ac6f9e5eee 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1704,8 +1704,10 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx, &stripe_len, &bioc, &io_stripe, &mirror); btrfs_put_bioc(bioc); if (err < 0) { - set_bit(i, &stripe->io_error_bitmap); - set_bit(i, &stripe->error_bitmap); + if (err != -ENODATA) { + set_bit(i, &stripe->io_error_bitmap); + set_bit(i, &stripe->error_bitmap); + } continue; }