From patchwork Mon Nov 11 08:42:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 11236701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FC4816B1 for ; Mon, 11 Nov 2019 08:42:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D793F2075B for ; Mon, 11 Nov 2019 08:42:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dTnzZGzZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727015AbfKKImg (ORCPT ); Mon, 11 Nov 2019 03:42:36 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43641 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbfKKImf (ORCPT ); Mon, 11 Nov 2019 03:42:35 -0500 Received: by mail-pf1-f194.google.com with SMTP id 3so10207059pfb.10 for ; Mon, 11 Nov 2019 00:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UdEYO/l+yqACUXEMzQNWfPJKUu9x/M3Z7pOW/zQLvdM=; b=dTnzZGzZO9U76nlW/CNGLogWRP6lultFwWwfFdUd3txPIKNBuTDO4n8UXs+GockSsE lKFC3myJL5OF/ScR45zaNagcSUgm3dj34eAFVVa+hu2H4A1uJV1IomQERwgZXeAGPv4E yp9EKDuQ0mFGTt0wVFcsRZ3CU0De19AKFa4H2/YRwrPbDrmMMLesFhtcdd/5FPjxC3ZO SyS8dxzLuhac9AtycZpo8s1T0kskXP+U0hzp+QFAAHzo+VUemO5bZYDdJNmxgDhRw3Bm gXNbOEMKHcVzEg36qmczvXQew0rghR6aXTa1GgFwDJV/zeC+rIhlei5FiRlxi2L0NJKn MPbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UdEYO/l+yqACUXEMzQNWfPJKUu9x/M3Z7pOW/zQLvdM=; b=BqK0+c+vOL2vGj6HlY8oHWEUjrlGNcw5hHyoxEVZd48YNYnaVOq8uhJeJUUIhVDG+c hhfgIVkjrPQiATtXTXSE/Q/JfpPRI/Bj+4DdIuxvH6HyYd7vA21UXUHqyGQ6ggflCrSh +2dTqvZ52gWgmQ3Rn5Qo9qpL9SfN1Zs9zSRuo+rD7dW8kuJ836voQZBxmcYvZgTtU590 VowTAZH00sX2Yv4eRLyWa8hV0MwQh8QbWl76WMkLqDmeRNQ2h3M65uBaK8ZQIOU0JIFt e6k364Vm4Ylcm61D/SeXpuSDE+wy/tJUNOu0cdlNdapnR2X3DXHrmL/pib/w8dvfIuW4 eQXw== X-Gm-Message-State: APjAAAWZcaTTgJVlmgN5DmOpZBkWsqQtjPntO7SdYD9KPpWoR3XDSWnw sVgMeLHzyOPeF0j1MM4xRNcxa9j2zpw= X-Google-Smtp-Source: APXvYqzaikJry4J+4Uxp89WKCJtgVwV/gPayGaexcGo9jfqvHDfoVQYbTimHkg/p8Ow1NvNlY+J01A== X-Received: by 2002:a65:6145:: with SMTP id o5mr26646509pgv.38.1573461751965; Mon, 11 Nov 2019 00:42:31 -0800 (PST) Received: from cat-arch.lan (95.246.92.34.bc.googleusercontent.com. [34.92.246.95]) by smtp.gmail.com with ESMTPSA id i16sm12771679pfa.184.2019.11.11.00.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 00:42:31 -0800 (PST) From: damenly.su@gmail.com X-Google-Original-From: Damenly_Su@gmx.com To: linux-btrfs@vger.kernel.org Cc: Damenly_Su@gmx.com Subject: [PATCH 1/2] btrfs-progs: add comments of block group lookup functions Date: Mon, 11 Nov 2019 16:42:25 +0800 Message-Id: <20191111084226.475957-1-Damenly_Su@gmx.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Su Yue The progs side function btrfs_lookup_first_block_group() calls find_first_extent_bit() to find block group which contains bytenr or after the bytenr. This behavior differs from kernel code, so add the comments. Add the coments of btrfs_lookup_block_group() too, this one works like kernel side. Signed-off-by: Su Yue --- extent-tree.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index d67e4098351f..f690ae999f37 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -164,6 +164,9 @@ err: return 0; } +/* + * Return the block group that contains or after bytenr + */ struct btrfs_block_group_cache *btrfs_lookup_first_block_group(struct btrfs_fs_info *info, u64 bytenr) @@ -193,6 +196,9 @@ struct btrfs_block_group_cache *btrfs_lookup_first_block_group(struct return block_group; } +/* + * Return the block group that contains the given bytenr + */ struct btrfs_block_group_cache *btrfs_lookup_block_group(struct btrfs_fs_info *info, u64 bytenr) From patchwork Mon Nov 11 08:42:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 11236703 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6888216B1 for ; Mon, 11 Nov 2019 08:42:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 473772075B for ; Mon, 11 Nov 2019 08:42:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KNklETVY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbfKKImi (ORCPT ); Mon, 11 Nov 2019 03:42:38 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42944 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbfKKImi (ORCPT ); Mon, 11 Nov 2019 03:42:38 -0500 Received: by mail-pf1-f195.google.com with SMTP id s5so10210504pfh.9 for ; Mon, 11 Nov 2019 00:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QN079/fsQ95WXf57JDbaZVJG1P10w696lhNMDZS3X2Q=; b=KNklETVYo5Kjer/puQWa+NvC6ncvIX3F/ktiU2KyGjVwrIc93v0pPVcmdONQLLUNJY hUgSVEm0FwPhpSEzQR7DeU0ZDT2dsfy+DU4aLOLDzYsY+SihW5QXZrymDrQppKuuuzJm uliM4zuw7DFB1XUkfQ2xEn7wQRpiGSC0BqDaMecFBvr9GzFI9jhZoftkjgHkFkOSQ0V+ 0pK27uFioIYIk3DALq9oP4Ht1/buQvo5lb54fet5tOT/nqiaTo5Veqc/5ZsVESjNfGzu T6Jx/hYldHXG1IqSyzC6pZCW9t72BMgDfiX7A+i+8gmXAvo97OvEPlbDpS4UT3NP+D1V ASzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QN079/fsQ95WXf57JDbaZVJG1P10w696lhNMDZS3X2Q=; b=Dd3b8nNYH/VYzeeFnQIijHHCq7r8SoosbbEec+nOLerrOwm7oHM7Zh5biZK1qf67b9 3u2PAy06PlJ9Li4270/KneANq0N55oWZHas+WjwEnkS9IvFlKyLdYfZsccf6oBZcAV3Y HmDTR6dOsdaxd1KeKcducreRe6eg4jP+k39961TOn1YkYi/qntHE8KMYkAJTFNRfra/+ bVLK/VDYlL9pz4dr3BVgRLaa1fpcoFDp72V9+4Ex6bq2sORTPy4mVv+gLfKHF4CZzDKv WJ37jPv3/eTeqipt/w8M7V2V4s9GnfUHYasXgp/1iIaO9WRitwIpB1q5z3ao+99ve6Hq TFcw== X-Gm-Message-State: APjAAAV3zasfh2zNbTdIPJAdDVLcb8XUTiPcuZ1cjd+gy2Sqwmf7H8K2 HjSvHWUOSFViM82X07VxEtJTcxHD3Xk= X-Google-Smtp-Source: APXvYqwIuMjhCMVrCLOHfvjBDYcbr//+6y95Ob+VUrWSWzCA19o8BVcqn+uiKZ0RNuMRb8jzF2E5Vw== X-Received: by 2002:a17:90a:22a6:: with SMTP id s35mr31721546pjc.3.1573461757663; Mon, 11 Nov 2019 00:42:37 -0800 (PST) Received: from cat-arch.lan (95.246.92.34.bc.googleusercontent.com. [34.92.246.95]) by smtp.gmail.com with ESMTPSA id i16sm12771679pfa.184.2019.11.11.00.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 00:42:37 -0800 (PST) From: damenly.su@gmail.com X-Google-Original-From: Damenly_Su@gmx.com To: linux-btrfs@vger.kernel.org Cc: Damenly_Su@gmx.com Subject: [PATCH 2/2] btrfs-progs: check: call btrfs_lookup_block_group() instead in check_extent_type() Date: Mon, 11 Nov 2019 16:42:26 +0800 Message-Id: <20191111084226.475957-2-Damenly_Su@gmx.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191111084226.475957-1-Damenly_Su@gmx.com> References: <20191111084226.475957-1-Damenly_Su@gmx.com> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Su Yue check_extent_type() wants to lookup the block group which contains the extent, not the other contains or after the extent start. Use btrfs_lookup_block_group() instead of btrfs_lookup_first_btrfs_group(). Signed-off-by: Su Yue --- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/main.c b/check/main.c index a0e5ac47c152..d18d8e9fa80b 100644 --- a/check/main.c +++ b/check/main.c @@ -4530,7 +4530,7 @@ static void check_extent_type(struct extent_record *rec) { struct btrfs_block_group_cache *bg_cache; - bg_cache = btrfs_lookup_first_block_group(global_info, rec->start); + bg_cache = btrfs_lookup_block_group(global_info, rec->start); if (!bg_cache) return;