From patchwork Thu Jun 6 08:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13688013 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 1B1B1328A0; Thu, 6 Jun 2024 08:35:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662915; cv=none; b=cdIQdiVmnsY3IdM7g3lmRZmOPNQeqj0SHvocgJogZ1EL4KyIcYyEdQQ8HA4pSv9T9/Ae2vCO6WjpREB8cQ2d07K/tS7T12jB0rNFjjWQkujeKrfijFcANVoo13af8TGaLd9dBCnyB+EvKKQ9Z5b4bgCFQV9TGuqy6+GJnzL+d5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662915; c=relaxed/simple; bh=nrPlPu+vqctIKgQjjWQn/wmT8cS0gnl9RdBb7sSooyc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lwBNFgeLMnzc/th9RUdkJobNPe7mqngHMsappdQwn8AZwTRr8w0b0R1CWa9WgKxIBfAg7dsE0vj952OkwW8JcAX/QSIFNblgLCjwuvX7JMiu4Uo+A2ZEWxIejwQtvNFhflCH3OxHBvdQz75+qAjWP58YSebU9oPt4XTzYZZsEno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a68ca4d6545so119933866b.0; Thu, 06 Jun 2024 01:35:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662912; x=1718267712; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ajaptr92AkTMxF9DLUxB3pN3cxARsrkqoOMgRin2Hos=; b=pPpBdtEj6+EgMPiUtqsbSuT9RqO6SIMC8RkVh6SaoW0WMwpbFFiC5J9JIhk8W9Iwk+ NOQv/BKXOKs0aYrGxUbtlJiBaXsScpOLQqfKNu0zLU61gUJvmK8uE3SfgMe0G1qu0flO z6Oxl8EysYaRppTtxsM2trppAvK2gNen77zvkEquVcZDp1VrJtHpZHY35SlMhrbhQjU0 mVZcta3bPAt77vpcPF3wxeuZQk7qI9DtWqn5mo6qKnCRFpSrDDXgGPbscQwRzWR4YeWK 4YTraMb2KVG5SmAggp8QmYRNVcYo9mp1b5nKTdYJKb/Gj6Ufw96vMHWwaQMWfJyEAi9n qHtA== X-Forwarded-Encrypted: i=1; AJvYcCWrPTwLSUwBoWh1n+VKtmcMUH6/5ULkOA6vGvuN7BExO2C6h2YyEG+BmWcIYyz7SKDkzYSL2EY8hZpSiOkTdFFI3F57UX3eo1akRf1c X-Gm-Message-State: AOJu0Yxskmowga9P4A1WOANHNO8o+I36esHoCDe+5bbNW/cXYwOJkqmt DQkFhnq6ZHlE5rnxYixtz1kGe4hi+FGGX7yKd6P0/AhsHTOER4waj2qeCA== X-Google-Smtp-Source: AGHT+IG1k2A2nEo+eAd2B4yK1AFmD2j1FXdphTIeHn0SRBTaiBBtAONnXsbr0g2vmV0E1y+HItTcaQ== X-Received: by 2002:a17:906:9a85:b0:a68:f2b3:b075 with SMTP id a640c23a62f3a-a6c75741c2cmr185824466b.0.1717662912336; Thu, 06 Jun 2024 01:35:12 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f7253800fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f725:3800:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aadf9e99asm701338a12.17.2024.06.06.01.35.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:35:11 -0700 (PDT) From: Johannes Thumshirn Date: Thu, 06 Jun 2024 10:34:59 +0200 Subject: [PATCH v2 1/6] btrfs: pass reloc_control to relocate_data_extent Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240606-reloc-cleanups-v2-1-5172a6926f62@kernel.org> References: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> In-Reply-To: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1505; i=jth@kernel.org; h=from:subject:message-id; bh=iosbNk+jKEdT/C5EFn1R+Rv4UY+ilsoTJw2nsGDr2tk=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlluy1vz8v5s5M17vHtummXOyMbym/9Hbmqbu8xR0Ns 2MuJgcHdZSyMIhxMciKKbIcD7XdL2F6hH3KoddmMHNYmUCGMHBxCsBEJocw/LOf3MRSuU1P3mxn 99aMiDumRU5sM9bocdvyS6amzNaqbGZkeNu4RJhltx6rUuWiCJvXKhkLTNyCfILXPu8y95hy+1I lKwA= X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Pass a 'struct reloc_control' to relocate_data_extent() instead of it's data_inode and file_extent_cluster separately. Signed-off-by: Johannes Thumshirn Reviewed-by: Josef Bacik Reviewed-by: David Sterba --- fs/btrfs/relocation.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 81836a38325a..442d3c074477 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3123,10 +3123,11 @@ static int relocate_file_extent_cluster(struct inode *inode, return ret; } -static noinline_for_stack int relocate_data_extent(struct inode *inode, - const struct btrfs_key *extent_key, - struct file_extent_cluster *cluster) +static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, + const struct btrfs_key *extent_key) { + struct inode *inode = rc->data_inode; + struct file_extent_cluster *cluster = &rc->cluster; int ret; struct btrfs_root *root = BTRFS_I(inode)->root; @@ -3745,8 +3746,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) if (rc->stage == MOVE_DATA_EXTENTS && (flags & BTRFS_EXTENT_FLAG_DATA)) { rc->found_file_extent = true; - ret = relocate_data_extent(rc->data_inode, - &key, &rc->cluster); + ret = relocate_data_extent(rc, &key); if (ret < 0) { err = ret; break; From patchwork Thu Jun 6 08:35:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13688014 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.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 5164513C814; Thu, 6 Jun 2024 08:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662917; cv=none; b=ONUzc5Yil+QXiAWrG0kv6glKhcnsFsYX1laLjpVi/c5oFXvfhELb8EXTwP1aon2Ojdy/CSKheZ3XDsDEypXi0oTp4jiH4XQ/qZbmb55lulmkBOfVDTwgCheH2t7IKnZlHXjmLYquRX5/wElPcoqGqYXk15TicMwtMprZrlRCiYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662917; c=relaxed/simple; bh=BSOOhO9uOGNNGpi3Gg+mYHQY2B8J/1iID6JLkJE46A0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BPT19OHpmEsTTuah9GrifY+f2vPVS5oHSXOwZO6IfbPofoPD2mvfczgwy6Dzrgnf7ErZRESA3YWtZbd0/kPZMFFccfv6naaRV9eYX9ZLXg80tjtgXIWO++5FngPA9nyAVvHe1/qQysAanDMKMBJ07De3pSShV6g8mfQui3p4tBw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-57a32b0211aso777596a12.2; Thu, 06 Jun 2024 01:35:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662913; x=1718267713; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CeG2H+23xO9tpjf9WGGXRka0BNONAaWNuKPYJcmDEqc=; b=Bhxfjr05H73AJ4CJvix98L6GmxogNnJvoWJmx8LxaVgSMZlwlSXgQvAOI12C0cvi87 ytKhzFdTn3HjOyxqQNvfwznLURIPanMyemU0TmM1FIhuywLSYofjH6o2EMP5tJ986YgK L9QfgvP9s4aE5xMif4KTI9wG9ieOkPe0yWHx3diEt7e2/2bNUznVC1E9ixo2XFG2HCW6 53I80UyQSahspa4Ca2dByl0H3QzMUPVoEAvGRnRpgA/olExHKHFS0KCoQMTXi+MbWFG8 hjSOz7IBRhfvWSygaP9FoqgQ06WZ90yveb44HgyJuHx9AR2jbsLUSVfLfFXe7p3epPPw QoxQ== X-Forwarded-Encrypted: i=1; AJvYcCW7xP6k2kQUGd01DftvUP4Y5ek5Zyt51t6UI8HmQkVtvd8VTef7NTfrd2nP9faYJYetfF8CYHmvNOI0j7IyhQsdv6WNOewWj+JQX7hb X-Gm-Message-State: AOJu0YwePQNLEYdXEY2hodfDYNPLE0lLnomc+elIYJy18g8WbGNUZCWG 4+hRhuVq4HATYQpeezb6y0dygulKxQZ2Nu9uwyyG/rW4PUikZKRh X-Google-Smtp-Source: AGHT+IHCWso67t/to7iMIinu7ADUyy+aHhwgohwPXJMxb0Gfe6fOharlZLaAfrq6H57XFJY/BvCGgg== X-Received: by 2002:a50:9509:0:b0:57a:19f5:76cd with SMTP id 4fb4d7f45d1cf-57a8b6b6e70mr3404801a12.19.1717662913312; Thu, 06 Jun 2024 01:35:13 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f7253800fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f725:3800:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aadf9e99asm701338a12.17.2024.06.06.01.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:35:12 -0700 (PDT) From: Johannes Thumshirn Date: Thu, 06 Jun 2024 10:35:00 +0200 Subject: [PATCH v2 2/6] btrfs: pass a reloc_control to relocate_file_extent_cluster Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240606-reloc-cleanups-v2-2-5172a6926f62@kernel.org> References: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> In-Reply-To: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2408; i=jth@kernel.org; h=from:subject:message-id; bh=OfB3wMCsTTsiPlpJ1BKnSCGb2nR83tLTHiinUb2gTlc=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlluyVnrxK/1jfWReBI6/P3QjJ2/dcSrnTc7rT8v2s2 gI+vVuLOkpZGMS4GGTFFFmOh9rulzA9wj7l0GszmDmsTCBDGLg4BWAi+18xMsx7oLstae0s0Wyh sG/2S5dnWS+0Djn55pe87LPJlfEeInwM/yyeHf9n7XRs6//UHyxqDiFc7zi/zfZ8uewxh0zN/t3 3t7IAAA== X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Instead of passing in a reloc_control's data_inode and file_extent_cluster members, pass in the whole reloc_control structure. Signed-off-by: Johannes Thumshirn Reviewed-by: Josef Bacik Reviewed-by: David Sterba --- fs/btrfs/relocation.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 442d3c074477..e23220bb2d53 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3084,9 +3084,10 @@ static int relocate_one_folio(struct inode *inode, struct file_ra_state *ra, return ret; } -static int relocate_file_extent_cluster(struct inode *inode, - const struct file_extent_cluster *cluster) +static int relocate_file_extent_cluster(struct reloc_control *rc) { + struct inode *inode = rc->data_inode; + const struct file_extent_cluster *cluster = &rc->cluster; u64 offset = BTRFS_I(inode)->reloc_block_group_start; unsigned long index; unsigned long last_index; @@ -3132,7 +3133,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, struct btrfs_root *root = BTRFS_I(inode)->root; if (cluster->nr > 0 && extent_key->objectid != cluster->end + 1) { - ret = relocate_file_extent_cluster(inode, cluster); + ret = relocate_file_extent_cluster(rc); if (ret) return ret; cluster->nr = 0; @@ -3158,7 +3159,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, * the cluster we need to relocate. */ root->relocation_src_root = cluster->owning_root; - ret = relocate_file_extent_cluster(inode, cluster); + ret = relocate_file_extent_cluster(rc); if (ret) return ret; cluster->nr = 0; @@ -3177,7 +3178,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, cluster->nr++; if (cluster->nr >= MAX_EXTENTS) { - ret = relocate_file_extent_cluster(inode, cluster); + ret = relocate_file_extent_cluster(rc); if (ret) return ret; cluster->nr = 0; @@ -3775,8 +3776,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) } if (!err) { - ret = relocate_file_extent_cluster(rc->data_inode, - &rc->cluster); + ret = relocate_file_extent_cluster(rc); if (ret < 0) err = ret; } From patchwork Thu Jun 6 08:35:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13688015 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 CA76F13C823; Thu, 6 Jun 2024 08:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662917; cv=none; b=PF/hrxBfbbGR+1qLXBRojBivmWMHZ1nqiWaF0wUdhLKVr0EgSp1M9oXuYJhItSyhOX+PVUvL7tuqSU73Nacm71bZq+bYH9hNeJAX/rIpi2lOHrULH49wcTB3z+OCrGhsrk15MxLqvyi9o4qkvLe7ms5BnsZJqhtdNRk9j73gqBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662917; c=relaxed/simple; bh=zzE5bAZOBFfYggkgkFIySkkBxdOQfmS/iBbhcnPJ+XA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VOjzAUAAj0iStOyfWBqO/exRp51D4HML9rpAm2crpMN3VJNkNAjGhMiWcLvPjBNVw+r5NtDq6q3GI5yoKQloWjVz6/g8AGw1zRhLtTd2jlHwYNoh7BFrGffM0GzLeO2cyqET1/rm24VcOJyBj/XBcy4f5DKNeJj/pl46wjX47uY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-57864327f6eso1101360a12.1; Thu, 06 Jun 2024 01:35:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662914; x=1718267714; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tkFCExxHuTtm3UumYxMeb2p+BeqDb6wrLCHjywTupuY=; b=JY4F26VQtK0ExPxnAPQvK4jv6xR/FlTPjUBqWrukL5/HHngsKxu9MpZj+7/A4okKN8 zqb4ZN/d0m1ic/bv0YSUK8kn9QebqA3Ad5ClhP2kRBDEAyyIgRpzxCc7iGU3WUsSHGGx xGORQTzjEvRZEujYVKg9v1+QsvBLlmLfd8EO+x+qLPGkE6mWM2QPMR0FsdkVmcbmaPlr LNUZvqjmUQR1/LRf6GadwAJbZreNDD/fJjDENsplQhTbmm2W1C5z7FHlkIF1g3Q3PUmX 62hNCJMESQElymKM3dlCTLw7XI+atRrctgfAHEhaZRH5vDmU7Og+FxIoTr4dusrG0y4h /Oyw== X-Forwarded-Encrypted: i=1; AJvYcCW4mPFZFi6sqMPUJmLtB5UWCkjFFNpedfS3cjIol4sGrjECfBcXUfGZIxcz8WXpc2Vc8Xe+ddgUYN4elPbgceKuA6xtho04E3PmpaKE X-Gm-Message-State: AOJu0YwdL4dcS5C6e26pSU3cr+G2ZBEbJcg4KT6Mbko5EpVO4k6jGCv3 tp7R3JUOMvRGKQg3Pyg3YC0CpRLPfnUPfgdxYFOQhB3Qir/T/vcf X-Google-Smtp-Source: AGHT+IGlLwqUw/PBa7WuChUSpAbvZcsRnDYe4k4yEzuD7qI7xa5Br5PqHn41BBY+P5g4MGHB87xE1g== X-Received: by 2002:a50:d7db:0:b0:578:69be:6e7a with SMTP id 4fb4d7f45d1cf-57aa53e0569mr1762409a12.1.1717662914242; Thu, 06 Jun 2024 01:35:14 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f7253800fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f725:3800:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aadf9e99asm701338a12.17.2024.06.06.01.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:35:13 -0700 (PDT) From: Johannes Thumshirn Date: Thu, 06 Jun 2024 10:35:01 +0200 Subject: [PATCH v2 3/6] btrfs: pass a reloc_control to relocate_one_folio Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240606-reloc-cleanups-v2-3-5172a6926f62@kernel.org> References: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> In-Reply-To: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1750; i=jth@kernel.org; h=from:subject:message-id; bh=LXiNUZKoUbEDGm+5ZVvGCnkC49++FH+noIxoB0lBoXk=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQllux99unl4ZDeWZtNr3Gl3H5lVGrzt6uOffb3L9Lrr fzYPCbP6yhlYRDjYpAVU2Q5Hmq7X8L0CPuUQ6/NYOawMoEMYeDiFICJKDQwMnSknb+pPvFtluOL GUFbVpU98SpYpMs+Obw2fkd74gvbnjZGhvf6nnai51NNLrHN4Yn2T44S+LCsp9rjy+zN51v4DCM WMAEA X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Pass a struct reloc_control to relocate_one_folio, instead of passing it's members data_inode and cluster as separate arguments to the function. Signed-off-by: Johannes Thumshirn Reviewed-by: Josef Bacik Reviewed-by: David Sterba --- fs/btrfs/relocation.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index e23220bb2d53..a43118a70916 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2947,10 +2947,12 @@ static u64 get_cluster_boundary_end(const struct file_extent_cluster *cluster, return cluster->boundary[cluster_nr + 1] - 1; } -static int relocate_one_folio(struct inode *inode, struct file_ra_state *ra, - const struct file_extent_cluster *cluster, +static int relocate_one_folio(struct reloc_control *rc, + struct file_ra_state *ra, int *cluster_nr, unsigned long index) { + const struct file_extent_cluster *cluster = &rc->cluster; + struct inode *inode = rc->data_inode; struct btrfs_fs_info *fs_info = inode_to_fs_info(inode); u64 offset = BTRFS_I(inode)->reloc_block_group_start; const unsigned long last_index = (cluster->end - offset) >> PAGE_SHIFT; @@ -3116,7 +3118,7 @@ static int relocate_file_extent_cluster(struct reloc_control *rc) last_index = (cluster->end - offset) >> PAGE_SHIFT; for (index = (cluster->start - offset) >> PAGE_SHIFT; index <= last_index && !ret; index++) - ret = relocate_one_folio(inode, ra, cluster, &cluster_nr, index); + ret = relocate_one_folio(rc, ra, &cluster_nr, index); if (ret == 0) WARN_ON(cluster_nr != cluster->nr); out: From patchwork Thu Jun 6 08:35:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13688016 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 3CA5613D27F; Thu, 6 Jun 2024 08:35:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662918; cv=none; b=Km3C8r3koIX9vxeKmWXEFPtC2s9XEO5ebsK82/OXGQ8qO6nHMjZ/NZui8Ddl//Nd656tt2qtZSKIFGfMzqo3aUz8HQx4a92wRDVITd5uLEe9xZLhGf0yXxEca4mD9UNqGxkpTAXvbe9odoaDRz6cT7bmFZkxmJaEbxIyq5uQ3kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662918; c=relaxed/simple; bh=yH8G6YWI06bHfK8IxhTFZTp6ZbVAWJROjgj/gnxMVT4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qkTymhd8MMWepUmanEkIxNKjdw9WsLyJY0tnFzp6ewyekuGzK4PfMBj8KHxz2nnnHBx09eTKctyYHRHhmwtRcY9MqS7JHBMZAogLUEGGraIlZzqv7jXKaEjj//z4VE4t69dhqfB93y9NR/dEkByEVZxzZQrc0GEmD/gt/aD5QJc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-57a4d7ba501so666561a12.2; Thu, 06 Jun 2024 01:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662915; x=1718267715; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B3RP1QBkoyJNi5M16iMTIkUvadwfoBKvDY6JbocbOfI=; b=Q46J5sY41afRRqEkUkqdRNe+LokYcEfx5Vb49+fZ4GYXUKdrdeoughF/xki7GRlZkI oBer86ojmNG+kR4jFW6YQ3VMQR+KujN2g/XpYWVa0sG1Sz5bM4R7CG2U4BVnaN3vCdkc kTlDDht02aTDcU+nk52YYmMUEnI42AzPWnoQEv5Kt+4T9saGJ4yNuLYAjhr6YyO0KNiU wME4yVCaZgtYpPctIWy8bEGiEKAThFALds8HDpfZm4hls5q8FX8UmpdG2kB0KZdxQ3jL 791dAxPyVUFjQwSXMLZimq79wQzNlAKhPxBWFdbgwKcpmjH1H13Kaxjk32a7bM9j6pWi y/8A== X-Forwarded-Encrypted: i=1; AJvYcCUZLz+LTQNMJqEVZ3h8oC0HlPOt7ZycW5L5fDO5oDTorinKo6LOZySMrrIXmwxWO8uaNL7tvsouItYZ9rSt+3CUp0FcZlVIXKIrF81N X-Gm-Message-State: AOJu0YwkYx4xP/Y1Uh45UCW1ni5J5pAoseroaq4cBCGbaCLCFG3rlo4a kgOlfUUwGC22G7r2ZuAFSfI2qgh/+G4MvjUmdnJ++bmF2dGw5bVm X-Google-Smtp-Source: AGHT+IGlgfBRZzajCn5Y5Wogg/58oRd7gRNxZVxxRLpYIomfORP+sEwVAUOOm5rUJH55ih3fvr55zg== X-Received: by 2002:a50:aad4:0:b0:57a:2cf9:f614 with SMTP id 4fb4d7f45d1cf-57a8b7c62c9mr3593638a12.32.1717662915078; Thu, 06 Jun 2024 01:35:15 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f7253800fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f725:3800:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aadf9e99asm701338a12.17.2024.06.06.01.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:35:14 -0700 (PDT) From: Johannes Thumshirn Date: Thu, 06 Jun 2024 10:35:02 +0200 Subject: [PATCH v2 4/6] btrfs: don't pass fs_info to describe_relocation Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240606-reloc-cleanups-v2-4-5172a6926f62@kernel.org> References: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> In-Reply-To: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1582; i=jth@kernel.org; h=from:subject:message-id; bh=culQ18XDuWJUFEIEtoeM+ju8fL06zumM9YtkfGAAe1I=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQllux9XtU8wXups3fqPTXXRpHYW23i9mdy97pVvHxeG tu/UiWpo5SFQYyLQVZMkeV4qO1+CdMj7FMOvTaDmcPKBDKEgYtTACbCx87w36NPfsbCk3q+84IM 3248usY9fee3Hx+2L5wmnL2LjS1A/zgjw56/XzisH061PNt86t6pWIYVZ9f3TJt3ZsuOhrV3V5U lvOYHAA== X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn In describe_relocation() the fs_info is only needed for printing information via btrfs_info() and can easily be accessed via the passed in 'struct btrfs_block_group'. So we can savely remove the fs_info parameter. Signed-off-by: Johannes Thumshirn Reviewed-by: Josef Bacik Reviewed-by: David Sterba --- fs/btrfs/relocation.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index a43118a70916..df3f7c11cfce 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4005,15 +4005,13 @@ static void free_reloc_control(struct reloc_control *rc) /* * Print the block group being relocated */ -static void describe_relocation(struct btrfs_fs_info *fs_info, - struct btrfs_block_group *block_group) +static void describe_relocation(struct btrfs_block_group *block_group) { char buf[128] = {'\0'}; btrfs_describe_block_groups(block_group->flags, buf, sizeof(buf)); - btrfs_info(fs_info, - "relocating block group %llu flags %s", + btrfs_info(block_group->fs_info, "relocating block group %llu flags %s", block_group->start, buf); } @@ -4121,7 +4119,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) goto out; } - describe_relocation(fs_info, rc->block_group); + describe_relocation(rc->block_group); btrfs_wait_block_group_reservations(rc->block_group); btrfs_wait_nocow_writers(rc->block_group); From patchwork Thu Jun 6 08:35:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13688017 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 B4A5C13D888; Thu, 6 Jun 2024 08:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662919; cv=none; b=TgNXOceuKN6Q89Jm/njKAnCkXiubiKjWS1WmAwkXarI7jmsVpwKZyAItVx/vmeQd+8gmroDCOg0Nn8Y/eN5e67RkMK3dQx/zEHSh0imXWZMkfBVHq+R8+En3lmmcePrUJkGyWeKcVSmv681jRDfn9Ilsk/hlB8VF5c54XroeZsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662919; c=relaxed/simple; bh=4EgHnCnCZBWyU8y4mAAudkfLZu9Xg18u3Qjnrsf39+Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=thBLXazjqjKKU3FKrah6Cg+XoGFZLagtqj7a7grRZFg+6MT/IP5m4XxCzKVS7AQ2Uczku/AC4UwQ7Z5WM0EVk7IBPhQ4M1vyLIiOG7OJjZMb5FjXzUdKOMJaIAnFHqsYr4b0kFyQpamvhxns3TzW6WPma/Acph61CN2aZtoGnfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-57a4ce82f30so825349a12.0; Thu, 06 Jun 2024 01:35:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662916; x=1718267716; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JiqL69v9uVtNAEuAaU0jUGyaKWnPKhWYpM5RlEKZEUc=; b=Jv6Um6LnvQZdP7B9N0zanqXHnMHYgzE1x2OPSblkWMTTHznC0H7jcbyXNipq/Ji67W 8Jvou7tuvHDuLXPiD6Xz2qFiTNynOBB/eLFCf9auFxjRix0dI75XxgDTTq862eDl63Hb rRZJQpQMy9KNHKENN3rKTMu6iHAQuT8LE2CtNMSxrhmFkc2M3ujfXJio3u7hJZNNkfcF jPzC//78jl3bP7nDX1ReN5oONiKnm9WFogr7tV7UE8tD0qud485VFtAs4XQhA7U5jitT GOC9byUv48ODwShWrA+I1BLHe/l1vN8q/m8+pJosm8xK560QQBuuGcpkKl7MZ4gK3oUJ 5OVg== X-Forwarded-Encrypted: i=1; AJvYcCUoRRPEBAcOO5Y8nPDO5ZYj6a6PRbB1jGGTejRY/Ark+2DAbo7Vf/DnhLIo+fWpRfVH6/Xx3TolFW4eSED7goCRiZVBmHsg5h7FHBzG X-Gm-Message-State: AOJu0YwYKovxGM0tNK62g0NSh9qM75xXakIYsxHC2MKyORuIInTno7XX ioE5dc/eSdh3HT2JWsT7s6onSf1/TDS7wkbuXZyVoh7pCd2JYnzS X-Google-Smtp-Source: AGHT+IE+dWyIw170U4msbpz+yh6wjuWlYVjD4QfdjAQZDZ20Wu1wnFBP1QSyW4mIAUmScL7+7X+hHg== X-Received: by 2002:a50:d754:0:b0:57a:2475:6a16 with SMTP id 4fb4d7f45d1cf-57a8b6aa19emr4316627a12.11.1717662915975; Thu, 06 Jun 2024 01:35:15 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f7253800fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f725:3800:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aadf9e99asm701338a12.17.2024.06.06.01.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:35:15 -0700 (PDT) From: Johannes Thumshirn Date: Thu, 06 Jun 2024 10:35:03 +0200 Subject: [PATCH v2 5/6] btrfs: pass a struct reloc_control to prealloc_file_extent_cluster Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240606-reloc-cleanups-v2-5-5172a6926f62@kernel.org> References: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> In-Reply-To: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1239; i=jth@kernel.org; h=from:subject:message-id; bh=oSzfDVy/RzBr71CWX+7fbNO0PgrhkhfGwxnrxQxIe24=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlluxzO7S4wtG1ftqPhJrcq1d3XQhslqr5fvLa77za+ RtMLVg2dJSyMIhxMciKKbIcD7XdL2F6hH3KoddmMHNYmUCGMHBxCsBEslUZGb5bW3y2ZTQquLgt Z56LRGHNVt0I5vc7BNWyHlyaJtq6fwkjw8sLq5dJCnvHri0qCj4+r42b6/MXxgvFDfJKzHtNrq/ 4wgwA X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Pass a 'struct reloc_control' to prealloc_file_extent_cluster() instead of passing its members 'data_inode' and 'cluster' on their own. Signed-off-by: Johannes Thumshirn Reviewed-by: Josef Bacik --- fs/btrfs/relocation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index df3f7c11cfce..c138d08cce76 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2790,10 +2790,10 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, return ret; } -static noinline_for_stack int prealloc_file_extent_cluster( - struct btrfs_inode *inode, - const struct file_extent_cluster *cluster) +static noinline_for_stack int prealloc_file_extent_cluster(struct reloc_control *rc) { + const struct file_extent_cluster *cluster = &rc->cluster; + struct btrfs_inode *inode = BTRFS_I(rc->data_inode); u64 alloc_hint = 0; u64 start; u64 end; @@ -3104,7 +3104,7 @@ static int relocate_file_extent_cluster(struct reloc_control *rc) if (!ra) return -ENOMEM; - ret = prealloc_file_extent_cluster(BTRFS_I(inode), cluster); + ret = prealloc_file_extent_cluster(rc); if (ret) goto out; From patchwork Thu Jun 6 08:35:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13688018 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 B018013DDBF; Thu, 6 Jun 2024 08:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662920; cv=none; b=U1pKZjvLdtXVv/mWq+JFXeY+myTjxKiHc5r+Ug1Oskiw5Sm48jJWmeoCq3HehQf/eHfndB5tKMXI/2bdKXPSSN4Jab+wewKnfpZU3OVhnf802FBZ2j8q+upb49a2QWTSkcN5ljLMl/HfvjGOkdKzw+wfVHMBxQySt+ClrzzTLqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717662920; c=relaxed/simple; bh=3pmduSBiMNsWuEWUGOxI1Upi2a10FpWxiV8qu2tjxLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ld8gY/iUR2Kz+JP4tgJYkZMPapQvQoXUBkp+QrbFuPUM8sig5tsNawh+Ib9y1CV6coZqylpzr49nntgNqSAbOatJYBj5R2BpoLeVQeRWOI+V019uQEKcr9UhsaTjJFr5D1kiUDf4JjPS6C7b0gdIVtA4kHQp1v1/Hi2ymT7zLrQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5751bcb3139so645346a12.1; Thu, 06 Jun 2024 01:35:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717662917; x=1718267717; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IgqPMyWKMKZbOFk3FEtGJsccK6vNPBLPV72bI7O2nGk=; b=KsCC+ScjdQAwnv2kbXmYfvY2IYdew4q3hASBSDZOb4maqU5JQf5lkeFpaEya0hKKWP 0aOttNKmA52El4CscxHwK7xGuOw+3vXKECml7KcDKeRK7p5/nI4vb8bIkEQ4lD0Jl0ya iSLxBEANZC+fMBbc3X8elzNVBSAvFRvVXl26FDyLf1I9o9YFLJsm7e/90O5Pa8tI8pzn T/pRKf3/7aVLFUIAlhrrBMzg1S/3cmVHFHwq5+DBFt3bAa3wjAasmcDqb0n39f3461tY U9YY2WMf0PB2mRyg0OvbeMnHJbuN4pEZ56N3slhWLcT3hBRSDTUADXFvg+bmnaIyw/W1 FvYQ== X-Forwarded-Encrypted: i=1; AJvYcCVKglt3cyesfFlR+w8Mp77mVFS6v20ID4ZJdQeAIN6lSBHwyl/24eGXuuTPmXmk5VEI7T0WtZI57Z3pbbCbF+73oWfRdH9Vm9kBNBd1 X-Gm-Message-State: AOJu0YzuJUgh+aVRze9E0KMxaJbnzLMI3nY+Qe3PSjymY3CHcTHLsgMU rDrfJDd3P1+5t6Q709SR5D2HAMztV2TKrmxoahHba/o7OHg/MTwZ X-Google-Smtp-Source: AGHT+IEgzPbpXSg6oj4xJJlxYy7SNnAuHVzjVssF7tG8XBiDGWFJK763FFPFkGPEYc5slvM9yCS3DQ== X-Received: by 2002:a50:a41b:0:b0:57a:1501:38c with SMTP id 4fb4d7f45d1cf-57a8b7c7cb3mr3072840a12.26.1717662916934; Thu, 06 Jun 2024 01:35:16 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f7253800fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f725:3800:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aadf9e99asm701338a12.17.2024.06.06.01.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:35:16 -0700 (PDT) From: Johannes Thumshirn Date: Thu, 06 Jun 2024 10:35:04 +0200 Subject: [PATCH v2 6/6] btrfs: pass reloc_control to setup_relocation_extent_mapping Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240606-reloc-cleanups-v2-6-5172a6926f62@kernel.org> References: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> In-Reply-To: <20240606-reloc-cleanups-v2-0-5172a6926f62@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2252; i=jth@kernel.org; h=from:subject:message-id; bh=Uk/h9ZXJECyqPaI91QMuPfBVGZxkVB5F+nx7U12iegY=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlluwT1PZZseVIrS3v0xPqwku7rVws8mQX5Zay+3UJx 2y3u/Kqo4SFQYyLQVZMkeV4qO1+CdMj7FMOvTaDmcPKBDKEgYtTACYidYbhm93a17u5VYxVfVoq 7b7EVy7qnNqaW3us1cNTedKenjkJDP/USnakM5+celL0/I4rvhFztxaJzTio8+J1u9mmAiO96Hh WAA== X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn All parameters passed into setup_relocation_extent_mapping() can be derived from 'struct reloc_control', so only pass in a 'struct reloc_control'. Signed-off-by: Johannes Thumshirn Reviewed-by: Josef Bacik --- fs/btrfs/relocation.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index c138d08cce76..320e4362d9cf 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2899,11 +2899,14 @@ static noinline_for_stack int prealloc_file_extent_cluster(struct reloc_control return ret; } -static noinline_for_stack int setup_relocation_extent_mapping(struct inode *inode, - u64 start, u64 end, u64 block_start) +static noinline_for_stack int setup_relocation_extent_mapping(struct reloc_control *rc) { + struct btrfs_inode *inode = BTRFS_I(rc->data_inode); struct extent_map *em; struct extent_state *cached_state = NULL; + u64 offset = inode->reloc_block_group_start; + u64 start = rc->cluster.start - offset; + u64 end = rc->cluster.end - offset; int ret = 0; em = alloc_extent_map(); @@ -2912,14 +2915,14 @@ static noinline_for_stack int setup_relocation_extent_mapping(struct inode *inod em->start = start; em->len = end + 1 - start; - em->disk_bytenr = block_start; + em->disk_bytenr = rc->cluster.start; em->disk_num_bytes = em->len; em->ram_bytes = em->len; em->flags |= EXTENT_FLAG_PINNED; - lock_extent(&BTRFS_I(inode)->io_tree, start, end, &cached_state); - ret = btrfs_replace_extent_map_range(BTRFS_I(inode), em, false); - unlock_extent(&BTRFS_I(inode)->io_tree, start, end, &cached_state); + lock_extent(&inode->io_tree, start, end, &cached_state); + ret = btrfs_replace_extent_map_range(inode, em, false); + unlock_extent(&inode->io_tree, start, end, &cached_state); free_extent_map(em); return ret; @@ -3110,8 +3113,7 @@ static int relocate_file_extent_cluster(struct reloc_control *rc) file_ra_state_init(ra, inode->i_mapping); - ret = setup_relocation_extent_mapping(inode, cluster->start - offset, - cluster->end - offset, cluster->start); + ret = setup_relocation_extent_mapping(rc); if (ret) goto out;