From patchwork Wed Jun 5 13:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13686893 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 6C8B4196445; Wed, 5 Jun 2024 13:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593478; cv=none; b=bUhqSs98hr1M0qqClB/VG1+pXxeANDJ80afeG0YA2qbA9n7fmrUk/QVvzBGhxP6R8A30oLWjlRtFP4E6kibU4OVf+LQYp2pgxOIn0eqyAGci3IoVnrJkNXZQBXLJLHd3pj/kkDUQWLqUK1nD4camJ466NNgwFOP6VY3cf6rWc/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593478; c=relaxed/simple; bh=wER0C23IRM3B+E0P+tpoGLwjN+qlq9Cy5JPJ+jUloxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FcCZRIc5M6xfG4oypASA2t2aaeN2Rh9vUS68QG+MSd01Yd7Xk+wrLp0mZJh2kAtYrlz88oYvs+Lnu/CHFBZ0W2M+UkHBcsdCJ7A/QCy7SulIUa2W9J1Kb58setvsp+6izVMpq8bhiVl+HPpv7Qnyg0Q9ZVKbMP39QZ44vABmcsQ= 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.45 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-f45.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63947so6533257a12.1; Wed, 05 Jun 2024 06:17:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717593475; x=1718198275; 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=FpJSm0J1jEQQpUDbW+K2aiD8E8N7vnXDBGJYZC8h09g=; b=UdAA/dAFrI+YzRfm6Xjj9Cak8EuZfQ2BrKgBIDNfcZiKYdktt+lZs7iRJI+NhfkgRQ NZBa/YS64QOVz21gRbm+F1GHs/JdLnpAKUXMNCsZg6oolv66oqK/43dBqSZM/Yo5CVzF zXA5idaq8THnzt7Y+Kx+iK119bX9DCn+dB4wqyAWz3Qtv9h9KXIfY0lJodObpxmRAtRN yAX7/rcj34MwQ+G3tV3fPdl4rRuVeuGOYgUrzyHdSeCr86oH6NcOWk6+jZiS2lgNDzRK yxrt5C+xvCu3knGCi514ycrM50BSjMknEpVEJlnnvjQdUS5oTuiPE0E6wzfxE97I1DDh CYUA== X-Forwarded-Encrypted: i=1; AJvYcCXeN6QsEVokIxbgq5azOqpdrXGe97QGF865o2nQLkg1V1wmp8+rVw1XlaUX6Bu/0ngxa5Ii57F3KKHi05OktMXQM7GaoLRc9u7f0vxm X-Gm-Message-State: AOJu0YwRQzppsDrSmLp0NCkTQaqMWnU9FDqPnQC51T+FM8o8jDHbtU9E 9FH1k5IcxmvFWnurPZEhPpipHXOLgUYHqVzwvJK8ckpEU8TWFr5npvM6NA== X-Google-Smtp-Source: AGHT+IGAur4Ev+ZM31k28Uig0lFNnOas4f30gruofQ1oTGENNLGMxP9PJpe6VOR/7wpGCPdU/ADFXA== X-Received: by 2002:a50:d497:0:b0:578:6198:d6ff with SMTP id 4fb4d7f45d1cf-57a8bca263cmr1707847a12.33.1717593474403; Wed, 05 Jun 2024 06:17:54 -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-57a31b99a3fsm9266913a12.9.2024.06.05.06.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:17:54 -0700 (PDT) From: Johannes Thumshirn Date: Wed, 05 Jun 2024 15:17:49 +0200 Subject: [PATCH 1/4] 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: <20240605-reloc-cleanups-v1-1-9e4a4c47e067@kernel.org> References: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@kernel.org> In-Reply-To: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@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=1410; i=jth@kernel.org; h=from:subject:message-id; bh=YSsr1EzQHpx+x5w2OEIUfA+J6YfsAt/3JAEdrkSu0zg=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlpNbbTX+if43R9qXCzn3eoSZ7iiKlynyvPDw11WH2W zn/DZemdpSyMIhxMciKKbIcD7XdL2F6hH3KoddmMHNYmUCGMHBxCsBEJkox/K/Ju1Wx6tzvCwW5 c07IlwZu+aCScchXqnhl/rsj1XeZd55j+O/4aeveIqFkz1OntbVcp52xzosOmnl3eW3YzTTDWW5 G51gB 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 --- 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 Wed Jun 5 13:17:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13686894 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 40749197A8F; Wed, 5 Jun 2024 13:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593478; cv=none; b=WSTVBylD/mIpqgtF9O9IxgAabAzxpzyalfUZ6BYLRfSeIZjBKzyOzeZLNM8x7ilzcmd6fHygZWYG+e63E3tVamBTW6MZORopCIXcs/hGcI1MnfZce3d0CsJht6gso5PzDdiAmR3gYh9xeUo6/TG6ds+DMdNgrH/H9UsA9+PdGkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593478; c=relaxed/simple; bh=WDUz7fG6FfIJIZkudiSnKmkmX/Ia1bOQENtWWLof9SY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KS6X+SMCM0Di/YRtBFEi5ot1SCABGo2jF/Kmp/ScOZP15O7ubwh++WGt7IKkhwssZdz1KIy3wqLTtVxK7oWPmVdm1Ua7x8sjwI6bnp0DVD5oO4prKP++m4JdTwajsr9xCLSxKSipLlYDoTNVgW4IqMUZofoI1QT1I/21v+FjIeE= 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.45 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-f45.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63a96so6559548a12.0; Wed, 05 Jun 2024 06:17:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717593475; x=1718198275; 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=lIYhLPhDACS5S3WiEv4gpp9ka+wmTQUeOJx3H2AvDpY=; b=w+SwiKz/abeX1C45N+M8aVkYaaQcg6bKclGzad12YoX7deOMtkqbO/JSJPZA4Il347 BA7jYK3nAFjxURHk+0Ic2EM42rrjuxw7NvkJAMBR6E1OC7PVNxd1Pc2GCd+oXutZF2eh SQrjVBuYyBp+kVVQdA9/MCR+2LG3kmLaX9bAH/2zkwO75M7lNe7oVflfTntpNatcBVMx 0nK+XqxoOvfxZKsIhhoYlGl/0gPGGQKJ5l2Jqh6a/x+PmhW6M7Urdff2MRbrh5Shffh9 dWYX3T13HkNMvdiZ1/z+rfL53L+8Gwb2qeKJDGelm4GZscvm3PM11yWF1i5k+o8PU+ns H6Bg== X-Forwarded-Encrypted: i=1; AJvYcCUURfm7RjXjJl+Xo83q1CNed8ZL6C/ouMge+0LE17gs8nyJVDE9eZCkzC8wvQEkLGFGLHGbhZ0TH8wbV2LgzEDZBxG4BF0zaOu0Zk6S X-Gm-Message-State: AOJu0Yw8rD2wFY+wtZQZcsHiFXF6KMDP0pAz+CKKfotynRDq82XwiHwq Tdh8uwVP+b2pIhyXBZQscVE572gMgedilPV6V8+j7m68WPLPq/pv X-Google-Smtp-Source: AGHT+IGGxN/ZriO44OeX3cspPv797GsM3IAm/GNPtkSuYA4xbXWMGbnQdDUE4hbUCoSsUXoCcLQ8kQ== X-Received: by 2002:a50:aac4:0:b0:57a:2417:5ef4 with SMTP id 4fb4d7f45d1cf-57a8b6aa068mr1677660a12.17.1717593475378; Wed, 05 Jun 2024 06:17:55 -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-57a31b99a3fsm9266913a12.9.2024.06.05.06.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:17:55 -0700 (PDT) From: Johannes Thumshirn Date: Wed, 05 Jun 2024 15:17:50 +0200 Subject: [PATCH 2/4] 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: <20240605-reloc-cleanups-v1-2-9e4a4c47e067@kernel.org> References: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@kernel.org> In-Reply-To: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@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=2313; i=jth@kernel.org; h=from:subject:message-id; bh=80TgFMM98ydJfyyVXKV8pIHBUC0TTeyzRxVisoduFMI=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlpDYYrqvLMJD/1Lqr19ncdTvPxY4CezsloUyvXR5Zh f5H/dZ2lLIwiHExyIopshwPtd0vYXqEfcqh12Ywc1iZQIYwcHEKwETSbRn+J4a/j769nenTmXud AufnrgoRFCwQcVnZf2mdvq9z5pzCSIb/8b8F3Zt+bY6/c5Wna5+LUGW+b5/EnflOezlusIpmzNP hAQA= 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 --- 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 Wed Jun 5 13:17:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13686895 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 83483199393; Wed, 5 Jun 2024 13:17:59 +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=1717593481; cv=none; b=WCVgGCXwEz/pY+S3CQSUT3f3ynTVSkCicwsXjtIc5J2zH/lqWzq05WW7IOk7nvGUeKGWjKokywP5inZ8U7t3LX+Gy7odPlF1HrTkvXspxXkBcmBalxD7PhwAESxrPskIhdV8bbFeKHq82iqADMGUtX9/HpEtGLLim0Fcd11DqR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593481; c=relaxed/simple; bh=LQWaXCkks8QFeGC4yzq3v/pe/w3ygDZxLK1b8dLJQE8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pqrrS9v1k8MNudVDw3d0jdBSrmcfAXo2SrqaymiF4pJAgJhEzpDtZXytXRBBG23XToPzIwqufNBhhY582wEN7GqzHKF5WQMWG8K/9mj5Q6KtSDXk0B63iBTg7HKsvluBCpJs6t5gtwZ10orKiGGYNok+3PpSjYChxTXn4FWR3zs= 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-57a5bcfb2d3so1877662a12.3; Wed, 05 Jun 2024 06:17:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717593478; x=1718198278; 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=NabLomXctzJfOIf9JUgsvOd5nDkBFJ6nfLfOkmNQ+vw=; b=YUjrsFOBDsGsX/Yn0HgMSCXx2FPAO881rynJoKIuINqX47dbIAMA5cZDDWcP8imLpY YGUxDK4fVyiCeM8Uzh8xUEAMHdKfEh92mcdBBsBo2ilIvposdv/Gi8Xq4PsQuRDxe5Wa HtupKsWK7s8G02ZaR8B1SwtWIG7TORGsgX48CMg5Pn923/wUOHwShTFAw0F0X6uxE9Zf gCxC44hkGsI64pHyYrCnaE7IAxILIQaRDD2m18BqicWaSnnB/cpYu1Hx/4cUMDRWyNrD OG4mui6rcwPZxTxPxREU8CJdtNhw7YVNiB5uTEFcGpBcAxTqvFpmyM9afesBADhW3Oi5 5Gdw== X-Forwarded-Encrypted: i=1; AJvYcCXWeuCBKZxIfWL4l3naMxMPzOaXdWDuJHiYOl0mii3KBhYx+KhIOHWNjOLmmtcMom+71X7A6E6/bwB599wAFmQKQPR/I7QQ53xtoUQH X-Gm-Message-State: AOJu0YySNObihnhSb3EtntUpbMkPiALvmOqYt8x7BUFcNhvKcVdHnq92 E6QJVuCRmH9dkzzp10ruwXqX8lqBQ7zEHZxvvQ4pDvtSH/K7WzwY X-Google-Smtp-Source: AGHT+IGqVBSF4s5bgsGUc0mjR0HxgVNarc4CZk5fAfx94W4rYtI0583sFWS7gHYt8+k8edQKszgRZQ== X-Received: by 2002:a50:9509:0:b0:57a:3046:1cd8 with SMTP id 4fb4d7f45d1cf-57a8b697867mr2205252a12.7.1717593477784; Wed, 05 Jun 2024 06:17:57 -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-57a31b99a3fsm9266913a12.9.2024.06.05.06.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:17:56 -0700 (PDT) From: Johannes Thumshirn Date: Wed, 05 Jun 2024 15:17:51 +0200 Subject: [PATCH 3/4] 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: <20240605-reloc-cleanups-v1-3-9e4a4c47e067@kernel.org> References: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@kernel.org> In-Reply-To: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@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=1655; i=jth@kernel.org; h=from:subject:message-id; bh=ndZzlF5EeEbH1BXyLDy/6frtitIBCl8R/yHkFE8Tgs0=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlpDbMq45vlXY35lr/X/3ymbUfW20vMBnHvBZZv+YQi 9UimdrTHaUsDGJcDLJiiizHQ233S5geYZ9y6LUZzBxWJpAhDFycAjCRugZGhmt7ONws7Zru/VjN GL4/VyZ4edzH/n1fr3Q/31uomCKXv4Phn/7nWzMbZcM+P2osuD1d70jk7yur5lpMKp37fv590cO ThZkA 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 --- 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 Wed Jun 5 13:17:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13686896 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 738381993AE; Wed, 5 Jun 2024 13:18:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593482; cv=none; b=D1Eynh5e8BazLnsqcO1E1mNFnIrmauN24k7hLiTaaUH6Cx1vEAmLhKu2oL1sZ1HRt/CPLBJzfEmqKNjgXRrT5VD08CilkCtK2BZnxaXb8rPlxpDgiARa1WXiYooXEVdTvOsaphZpMFDSQVxShnQTYawrusHglzx42pqQ1AOJwgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593482; c=relaxed/simple; bh=zKvIhxSqqT9FqJeBjcPR8uWxWYQnQKPGnUrKxRgCKQE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l7TzNSH37vEXUo4CDsMnFKKQrW+LI6WurxEdjkGh223jUqkhqr1bm3Q9pLl/TUZEalhT2yRRxuc41/4pdmxpwjpRRundNZm5ZV7bDDzce4vEOgvyeztKuJUsPe0lzu0YWjpxdVrc7UzGn06W61t4aosJIA/R0HpaR8WjaDaNk2w= 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.49 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-f49.google.com with SMTP id 4fb4d7f45d1cf-57a31d63b6bso3086204a12.0; Wed, 05 Jun 2024 06:18:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717593479; x=1718198279; 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=Z0UO6kXD+1YYvRaIqQUVf1oJgFoVApkH9Bfb2EMD7Mg=; b=AoGy4C3U8T1aheX6q7BW0ypDRHcM/crKpyr2k70c4H4ECodhBqAzeNw16dFJs5XgWw zzwE+cLHqxQKlALtM6RmBe33avL76dI3Qfaf7NNx5+MaxdqsT4BnqoqfZ8uV2tDdJMau DK8AG/tgMUvuCH3eteXZoZ/D/a1BZx8AbtEfILjaj6VwTUZxTgVrBbGek+OAqKEqLAXy x3SjGIc2OTDV7F3otV2syW89wmju7e7BlnzE9kinS9d+AwZBbs/xPWZppXKv1PPTPx2X 11yNONKevExXsDx27vT/FV8qjM35n4PLOGnGKiVFQFoCDzXlbFSEYgTbX5uDxB862yEw H08Q== X-Forwarded-Encrypted: i=1; AJvYcCUXqwmR8MHf2vvEjycyRFbDyFSuuxaUp2CIzMYv6HD/ZL05BBdeuyPs3t0UzjLyEc94Daf9B1M71ZTpSlVK3BUDozm/U/WR2JbiuuZe X-Gm-Message-State: AOJu0Yx0zapQYX436hc2ClQpRrLSbRxd8K/CdUhvTp2zWlfZtVuMMDNV ogm1GEZ11ttWH6tFbdy1EAMBwRpAOKto0FuWVfHPeVrt5bkmaNsL X-Google-Smtp-Source: AGHT+IHg3k02UXOhdyZHB6aIK2ubKiZI0k4sBYhtcpPHPogQwpj9d5yc9KJK7KzgGw+S0sIJfca1bA== X-Received: by 2002:a50:875c:0:b0:57a:4af6:319e with SMTP id 4fb4d7f45d1cf-57a8b69d02amr1739160a12.1.1717593478760; Wed, 05 Jun 2024 06:17:58 -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-57a31b99a3fsm9266913a12.9.2024.06.05.06.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:17:58 -0700 (PDT) From: Johannes Thumshirn Date: Wed, 05 Jun 2024 15:17:52 +0200 Subject: [PATCH 4/4] 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: <20240605-reloc-cleanups-v1-4-9e4a4c47e067@kernel.org> References: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@kernel.org> In-Reply-To: <20240605-reloc-cleanups-v1-0-9e4a4c47e067@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=1487; i=jth@kernel.org; h=from:subject:message-id; bh=2s+AQcPtYn/L37Kl21F6nhewozdhJbQniXadYahR2ws=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaQlpDbM97wqVr6wgoft2a4XLjvMxJWMt4bJ8D69dFCN8 eYkn9XpHaUsDGJcDLJiiizHQ233S5geYZ9y6LUZzBxWJpAhDFycAjCRWUqMDFP6l8iZfGZqnmV4 7VCFhkiwmTvHoiA+j8fWe+Ye5Gtdmszw35F5VhMfQ0NycRBvi1bmm3nW13bvaGWNVY5dsojncNt tVgA= 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 --- 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);