From patchwork Mon Jan 22 14:01:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2587486dyb; Mon, 22 Jan 2024 06:02:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IExgRmicA8BmOa10ul0RFWqboT6LMMwqQHl+IfJZgF/MFRnwpV3+oDRQfReKU8+1BvE9c58 X-Received: by 2002:a05:622a:50a:b0:42a:3d35:2f5e with SMTP id l10-20020a05622a050a00b0042a3d352f5emr2164961qtx.126.1705932171690; Mon, 22 Jan 2024 06:02:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932171; cv=pass; d=google.com; s=arc-20160816; b=hy7AIWFlT7RlDZWbU7kEMPdBxTQvOsubkqTm1d3Ot7PBqn6BF7M2sfzowBb+OIdMG5 zRXUhkrM5gbrUbuPzTMmqVJ6MSOeI1s58OOgxzxp1lcX7Xx9pAk8mXOQEGgi87PtPRR5 5hoheT/aD4hYrak7IhgFnxbEKt/jp/7jDEbq3RDWkTicf1dMqghk7Zk48vJD6elPtOVx C57hBqZiX9cW5oNdRwYMYBIXwUYzF2rDUv65BKFLgAZAOU6nSZrSLCzGya1U3FYXci1K xcMT7dJaIzub2yHH+SENN327zw/4gqmgIJLphQiebbYfy/iorAOQVnPNj1xQtaSkxnH+ 9RKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WBzi1ZtxV0Wz7ndzuxElZ9M2KGV6gvPDf2DJXynnwTQ=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=oQkSJE971vxk2EP0cyuD/2d/6j2mUQU5559Ioprs7zXpxO2IN/VEgZlD1Mra3JFLMK KP135E/MVFRkqI4r0rj4fuA/dVmM7w6i6neS9O6doplsrPatPrfXVR5y8nAlh50VF9N/ /nkTI/oldO1wke+YmSijcO9jcbkRYj+7Xvb1OZNxlP3t0B8yAo1D6n2FtKpj6GhhVw53 yiWX4q+XpLntUSdgckVdpds61AI9A2oPU6bUy9raOxIlTmdYLAfQGjYDSdec5qSUeAHf 8cMvnsytu+vzHjhUz9IfRjGicIG5ajbhXX5Mrw7i7QYFS3kWmRLgpqEZKFw8rP9TxSGL L4WQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FyduDueS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33120-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33120-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s18-20020ac85cd2000000b0042a41714691si1668844qta.666.2024.01.22.06.02.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33120-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FyduDueS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33120-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33120-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7C6561C22D2A for ; Mon, 22 Jan 2024 14:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E0AA3D55E; Mon, 22 Jan 2024 14:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FyduDueS" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 4B8383D3A5; Mon, 22 Jan 2024 14:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932135; cv=none; b=dnFm7PKqRHAZYLuJkQKE6adUKA4rE85kLIMrrQ9vBytVSvaYX65rZCS45V9JCEf347ybVOKvqYEYKTASikN1s7B3/gsQ175HZKONPL6lfiwYEhLcXti4W5glG88EPUTt/xX1NH20nPFW0TlQ9ovIDhPaaRWdidIf2HCFOnFBzrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932135; c=relaxed/simple; bh=nAMTkjMJIaXjYcOCizDe0zOvCWo33wem2AkpQiC3kwE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cdmEdcMnT0/C8RW4MkXaWV+WAy28Ab3zpPI8Zo8aPZjdpj+LD4yV+2VDFAJUZDNYyy6iLfJ3PzOOJp268oEVArqDWhtfY+IjOYLJbmTlTh+OcmISV4+XD3tIWzEdH4NhfUjwO9W5NSLTM1RMmKju/fAE1/3jVdFuNQAEczIpNSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FyduDueS; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6dac225bf42so1572554b3a.0; Mon, 22 Jan 2024 06:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932133; x=1706536933; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WBzi1ZtxV0Wz7ndzuxElZ9M2KGV6gvPDf2DJXynnwTQ=; b=FyduDueSHCYN1ACFZYchcdZrzppPqP2phGJCVzhKskSiqoINXx9Q76uXtUGEdPx+hx vdJ5crR00I5+w7hi9dp0mZcIm6/UVsz/H+9C5sgBLO0sBslTW/QWJ5otLE5y62jJ3Mdw ohph9+HI4efka5ZE/n6jXRFmeaFpf3E9otg6I/qDRjJMxNPnMjOnKT4Lv9lkA5pqCX80 pKs0z7uqMNCBQxxTdn6cS5ObpYHvdllyWvyw/72jtQI/ZNvLlTNXdO6F0twl76sB89F6 KwVT0g6lt6hWnj5QpllmhaEqTINXA+1BuAdIoWZM5DBCP+uwU6w08zAuCHxr4EMO2XW0 WArQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932133; x=1706536933; 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=WBzi1ZtxV0Wz7ndzuxElZ9M2KGV6gvPDf2DJXynnwTQ=; b=twRuRH8O7rVSJBJonRxEfP40SXwswk3kKEjBLYfVxI+QCfGx70xlz75gI6ayXuRUZK So+OqxsPfgBHYNBNrrk2+wClGVjZgjgaxyWmboqqafLBGCLP5vEB9q+Fsnob60jG1KAo AB6Rlg5n6Ox6t0Jqmi+5Fkam+EsNOYtn8CYOzzBvQPn87V/f5IvtamJnwgeudS4Nm9e9 4qIJD+FV9LTNB7UC/3XMg7L/zKqSOjFLL1CLqjlwRZZSYZzg+WPV4Ur449c2zV4hrZ6Y 8aFZIQ5/WiMsWXow0Q5ocirtAWKFbdTBra6PHlggfTfwETlNZVpoBgDZ9ClgoUfE9bUn nMGA== X-Gm-Message-State: AOJu0Ywx531KaHhbqMrFVurVvpqqmae7O25jde0fgIFbUGcpLLCTQB5W RKjE2TbgglOJ/h+AXynllfUWzMcCy3iKeLCd8REC+/g6m4L1sauu X-Received: by 2002:a05:6a00:9a2:b0:6da:dbd9:173b with SMTP id u34-20020a056a0009a200b006dadbd9173bmr1998094pfg.49.1705932132016; Mon, 22 Jan 2024 06:02:12 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:10 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/15] nilfs2: convert recovery logic to use kmap_local Date: Mon, 22 Jan 2024 23:01:48 +0900 Message-Id: <20240122140202.6950-2-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799532508801086 X-GMAIL-MSGID: 1788799532508801086 In the recovery function when mounting, nilfs_recovery_copy_block() uses the deprecated kmap_atomic(), so convert it to use kmap_local. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/recovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 0955b657938f..b86b2cfb662f 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c @@ -481,9 +481,9 @@ static int nilfs_recovery_copy_block(struct the_nilfs *nilfs, if (unlikely(!bh_org)) return -EIO; - kaddr = kmap_atomic(page); + kaddr = kmap_local_page(page); memcpy(kaddr + bh_offset(bh_org), bh_org->b_data, bh_org->b_size); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh_org); return 0; } From patchwork Mon Jan 22 14:01:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2589192dyb; Mon, 22 Jan 2024 06:04:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHR5XgC1AfQJJkdoNP738uKoiVYCxheJvx1N3Bp0qRLy3MoHHglSK2VF3ST+mRG0Jhlaohp X-Received: by 2002:a05:6808:1202:b0:3bd:77cc:c3fc with SMTP id a2-20020a056808120200b003bd77ccc3fcmr5035436oil.117.1705932282661; Mon, 22 Jan 2024 06:04:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932282; cv=pass; d=google.com; s=arc-20160816; b=o/RR8An8SEWG0kLGOhVFTHbmMF9EHJ93ItbxJKFHx1AG1zthWQHcyR8jyPoiQiBQW0 TS4AgSeBRscPvTAE50TTSoQDtvdkS7mf6DHSSumnebKRgNloWe9SS/Lavecj1+B376Zi lrVJHCxvJZUUiEGspYx6IPbbiVdTLhRQkLGq/FkywDhJiWXWe+smlY3WyYUpISFiOubI o1B/n3xJa713M24b89y+SuiBxc++mdZvjqvNpxHezCIbRvCpaXqstrpf5cgOXNkw2ev7 iiY8wtpqGBc4MzG7S4y1By1GTiHOwc5QSnzpq1fn7ILccGaW4ISVoEmu57Z9o8F84ZUb cq9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3saB5AnYd5a6SwBp3LUujaI+Q8bdmZIuksz8EpNWVpk=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=aS+dViKlDL9V1XcDBmAvEEK1iM86kUyfcxhsynGzJFVHJzOdcWdzgBcV7jLVM1PEyD 0V8lQpBmMn2TyEhNL0UTn3Xf+qMBsp3v/8rh5Van6D2lvpRwcNjBeN5NPtif1Ed5S55J wjIdlXpLZSV03gn9ltTqf2fMYLKc4Ln+iL+YOUuUsMap6jcI1WE/4F4DLnwUTvcxnt3P o/GHO50q/MzNfHaqnH4gRNyR+ppyk2q5HbSqFYWvQj3u9Hvvw1LPFEttLdpcmZ4YXXEC wTTXvYGgdGwFMvyf++nwUS617EXHTDN1YUlzLWhO0+yTB1eu/Nw7JSWuWKIL0LJliiUQ 8AcA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="hzS/xlOL"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33121-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33121-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id be2-20020a056808218200b003bd826c1a8asi3336541oib.224.2024.01.22.06.04.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:04:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33121-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="hzS/xlOL"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33121-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33121-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 909EB2881D8 for ; Mon, 22 Jan 2024 14:03:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E5253D57E; Mon, 22 Jan 2024 14:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hzS/xlOL" Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 615723D3AE; Mon, 22 Jan 2024 14:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932137; cv=none; b=LfZbLk9bytilJ9tEtIaJkwuyS5DAPXUGpNTtbiZLFmH/aUjgvfqLyOoLXzEt0y3jPEO2M5mfXYn8Al4buSiQIfKWAeFe8KaEtsNxeigpbb78aNoZRxhKXZdCXt3rpnTJ5v2eYWP6TRHE+qXD7If/VnoPtplsAURD1zuJ2Hduo80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932137; c=relaxed/simple; bh=2H4lFZS69C/XBONPgR70jIXsN2kH5j6TPru8M4UOQUo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dPRK6as0uGXFiF49gL2CTad3qx/fEgtCQkfMCDrZY4txlTRv6i2EHvBRVpxjP3a3o3JHEcD7B3MqjCVJzroL18XVaq2QHBQZyPR2scJcIPr/DkHslD3Ij4Wx2RDWF5O3LNuZPqE8WKuRmpPe5uz8BOP3KJy/I/c4m9YJQj2efq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hzS/xlOL; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6dbda9a4facso536894b3a.3; Mon, 22 Jan 2024 06:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932135; x=1706536935; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3saB5AnYd5a6SwBp3LUujaI+Q8bdmZIuksz8EpNWVpk=; b=hzS/xlOLYq1jZYZ6ihK1V70UF1jIY+qMYlHYtw+sjway6PlG4xhdOh6Fe01KJG4lK3 rru/ikZ26uOhMDFvacs3Qb9qtJ2rGYH79KX29dCVpLKvx2w7u3tfhdRAYgLBug8hSL5+ tzYcW0RKVbPb1yCIWFUisQArca2Fhn9uNdQ9twEDx7R97oiucj0Q7lucJcsWjGLHsuSR C75E8a+yeE3Fh01mYKK94FFnuD8lD7L9N6TKbK0+tRXHKx45O6YrVTK1whxekf4gKhy+ s3rj7wNOaE/DFtS4QAKtknRT4YRNkCUXvKZ4Jn3vNUK5a5G54TYGbEq0pLlKwfJVlIfL ADLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932135; x=1706536935; 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=3saB5AnYd5a6SwBp3LUujaI+Q8bdmZIuksz8EpNWVpk=; b=vYkJXlzkqB8rhWARzTWursBpT8cTnMHAdtTo3DZcxPyi3mljte1cY+vsbsEOUoyA12 vL7fefU5QRXEMdbEBkIGVvaKnz9sHCaC4CbAQSukNJOVGINyBu9EQgaFg9gKoQr2799E 61vv1Nb6yrotgVEuCa4gEC3rpgNVoLh5RUzeUsHzQqq8uzIHway/h5n68ApN0hw8NbF8 nZGvtlBzGfTbOyanD24MVPRYcybbSG4hMgkG3FBj0nDtirKS/Zh8HKmKXu9REp7Jlnbq ZfJBZBAZN6Xoi8bdAIcTACbWOoRRn8k/i9w3HBehcRWBVeqXIEq9rUtaGPzWLETmr60i 4E9g== X-Gm-Message-State: AOJu0YzUziCVrBPQoEx1hdIQLKuw/rHIKvClHGSukfMIi3RqK4GcK1Pb cuAcZhAXoinUUjgxKxDwQ4Rf5WJPIVH+5nqmrbyUdcVv1pJ2VdBd X-Received: by 2002:a05:6a00:1c9f:b0:6db:cf40:3ab8 with SMTP id y31-20020a056a001c9f00b006dbcf403ab8mr1448379pfw.21.1705932135266; Mon, 22 Jan 2024 06:02:15 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:13 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/15] nilfs2: convert segment buffer to use kmap_local Date: Mon, 22 Jan 2024 23:01:49 +0900 Message-Id: <20240122140202.6950-3-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799648963972125 X-GMAIL-MSGID: 1788799648963972125 In the segment buffer code used for log writing, a CRC calculation routine uses the deprecated kmap_atomic(), so convert it to use kmap_local. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/segbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 6e59dc19a732..dc431b4c34c9 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c @@ -220,9 +220,9 @@ static void nilfs_segbuf_fill_in_data_crc(struct nilfs_segment_buffer *segbuf, crc = crc32_le(crc, bh->b_data, bh->b_size); } list_for_each_entry(bh, &segbuf->sb_payload_buffers, b_assoc_buffers) { - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); crc = crc32_le(crc, kaddr + bh_offset(bh), bh->b_size); - kunmap_atomic(kaddr); + kunmap_local(kaddr); } raw_sum->ss_datasum = cpu_to_le32(crc); } From patchwork Mon Jan 22 14:01:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2615732dyb; Mon, 22 Jan 2024 06:44:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEf2hvje6pZ583g30WGGD7xvgasL/x5o0OT/CGAnhCve0uDm7abpHeWFv0EaWxmrXQ2VNDM X-Received: by 2002:a05:6a20:9384:b0:19c:4fc9:5432 with SMTP id x4-20020a056a20938400b0019c4fc95432mr789014pzh.18.1705934655457; Mon, 22 Jan 2024 06:44:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705934655; cv=pass; d=google.com; s=arc-20160816; b=Xj7VPpck7Gy3nGWK5vMSslvueem7MB9IVKsUc2/ImIFs0+z03D4av3neok1Qma2WSC EOT8LALAdkD1BJQD5X4aWyMspZpxawscFi2B6U/Kky+hze4Zj7kcZCagWyVLnyn2dNVJ 6DUYjNyiL51bsPrAtuRq2Aj7W2NuQFqtjGVmllhWnJ0e1Bu5N0O1mWuFPH9VMkqn99Nu j7TcsJuIcgmhxodSF7sKxbnh1hd4IY1oZ+UQ1kmkxHmUVaYLxZAaDM72bCUJbZCA6DZu W0Pwp/LHNMws1DDOHHPtPjqeNXJ4MZRt6sZJLWuxfVl9ZNZAV6n8gsCQSa1su2IKui+m 1Wig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=la+vRQhSHTIGLMc3mcFeHM8AWwBAMUAN3NmM93QvSNo=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=0KjNlgfFVC5TSGUSjezz+mrkXgX4el/rDl5+mu9WnXYixQm7MxupfYnoRFBvxyHOOI TLW6PINDpMuRFCawq3uUlVybS8K2wS3OilJztmOF+UdaIDdFkY1BLkJZHdrhemryEPCo jonEQj+5BZ5IdyRo7HD2hB5xlj4RsDPeNidloEIKCmC6whrFSVxQA5AeUWwDcQ/ClamG eP/8D7FPQWKwkVUzDMisiDc/gpdFPT/OLRcPlXsw5ypEUx05XRICmAVAdzjvpOFGqjcD /xUBut/LndzFEtsF09lZsvgEe3lyGKn8X2GWj5hR7evsiRhxXBJwJTnJ65pnXdfyrD7d o8Wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="HmTO/tUZ"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33122-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33122-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q2-20020a634302000000b005ce26be61c1si8130282pga.346.2024.01.22.06.44.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:44:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33122-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="HmTO/tUZ"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33122-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33122-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 90EC0B268DD for ; Mon, 22 Jan 2024 14:03:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F1F93D57C; Mon, 22 Jan 2024 14:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HmTO/tUZ" Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 B01333D3B7; Mon, 22 Jan 2024 14:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932139; cv=none; b=tGjWibXLqWzXqn/o8GiUyC+pma/E8eGo8Q1hKNo0qZuj/On8acy9lYWP98Iqq2/Qm26uPN4lw+czr/RqRF08pMoaMq2wUt1DjsuYmwbwR7vEECu48fjRqjjVCFGMUO7CwMF1uSKBQwKB47pNBspvWR2klT4ef8Rs10LpbKCGZaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932139; c=relaxed/simple; bh=ERbftZ3Vd+XCk1UE8noci/tViuxyTk7z6UOt+ZHs2Xs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gLhxRKHs9BzvJxLHeZvLjgYTLovlbcm1edEGJGul/BlRooz47/OTDANA3wSYadBlzEUwetGEUVcYVH67BiABqUjFk1GHCteMnpYn0xLuV0LSzHgEi3GdpY/eEx3EYf/AXuzlzvL4izRaE/rMmpMAA0pD3TjAOhMhjeLjcdrWneY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HmTO/tUZ; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6dbd7f1a300so1523259b3a.1; Mon, 22 Jan 2024 06:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932138; x=1706536938; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=la+vRQhSHTIGLMc3mcFeHM8AWwBAMUAN3NmM93QvSNo=; b=HmTO/tUZfZnGamOKh+7vE8eZjCdP6/9GG8dCth0ufrmF81EQ43xXJXuyvE+4XPkUbf ADK0fcCISS69A/lFukyWolPBckDAj+Xj9L556QVZl/alk0r9Vg0k1ghsNPUshFLGBZ52 ohhehxfGVVbBReAvkXMUcTKVTsShfm1Vm43S2cHf0pPwe+CGQJzB+tcwhh1kjnGMJfC2 MNYP8fXnu4HdIQPbQCn7LgElVaT3dxmAE1fLJ8bgoLvEvLkUZCG79+3kFkybI+4S1XLm PzYbujbKzd4JCCdXcZbM8Aq1lzoBLsHErE/H3N/MIjLeuzal47Ya8UeQdetyMJHxW6KJ T4PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932138; x=1706536938; 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=la+vRQhSHTIGLMc3mcFeHM8AWwBAMUAN3NmM93QvSNo=; b=f9C8G4PgsYIzSkJ8COIdK7PKqAhBgFiyZTeMrmVMK6ahXWRekLXaQNT1GvL15ZDSLD hp8SvLbUUb72dSc1WnD1XnGn3WZ4CIqhlm+cwIHwATVvayxjabwPi8kVt41lyLbiGng2 MWdY6MoFtkeEnd+zGn1t2FJIFS0WZPke55QGayo1iX2PZxieS33lgnc4rX80pMGQUecq 4BgMm963wfKHP8nSuZBmKO8eY+jV+bXUyZPUYfvgh19uXB0+orRESAhamvZPgwSysbU5 dGFUrLAJqGSMEj3lbUaGTbLm2ptJt91J8+f2H9NYZ1usy5BnlS9QaH2nAVdIrKM6ULQl agWw== X-Gm-Message-State: AOJu0YzSBabZquII3/Wk+4aNWRuFWz4EynDMz/Lw1r7LGbv7eyDBy+2X dtVcQAK6AgVJweGRpZeIHqZ+/czeC0nl/wfEh+vusTxtq7cw1JIIH4xdtibx X-Received: by 2002:a62:d44b:0:b0:6db:3103:a1e3 with SMTP id u11-20020a62d44b000000b006db3103a1e3mr5131122pfl.27.1705932137894; Mon, 22 Jan 2024 06:02:17 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:16 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/15] nilfs2: convert nilfs_copy_buffer() to use kmap_local Date: Mon, 22 Jan 2024 23:01:50 +0900 Message-Id: <20240122140202.6950-4-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788802137211716184 X-GMAIL-MSGID: 1788802137211716184 The routine nilfs_copy_buffer() that copies a block buffer still uses the deprecated kmap_atomic(), so convert it to use kmap_local. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/page.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 5c2eba1987bd..14e470fb8870 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -103,11 +103,11 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh) struct page *spage = sbh->b_page, *dpage = dbh->b_page; struct buffer_head *bh; - kaddr0 = kmap_atomic(spage); - kaddr1 = kmap_atomic(dpage); + kaddr0 = kmap_local_page(spage); + kaddr1 = kmap_local_page(dpage); memcpy(kaddr1 + bh_offset(dbh), kaddr0 + bh_offset(sbh), sbh->b_size); - kunmap_atomic(kaddr1); - kunmap_atomic(kaddr0); + kunmap_local(kaddr1); + kunmap_local(kaddr0); dbh->b_state = sbh->b_state & NILFS_BUFFER_INHERENT_BITS; dbh->b_blocknr = sbh->b_blocknr; From patchwork Mon Jan 22 14:01:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2588331dyb; Mon, 22 Jan 2024 06:03:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGi/UH7XAVgddVLvZ9FL/0gyykeMLg1QFDtUN2OV5XXExCRL6O4l0wk+Q5E0x/ct5wGCSAl X-Received: by 2002:a05:600c:5492:b0:40e:710d:7c1c with SMTP id iv18-20020a05600c549200b0040e710d7c1cmr2245114wmb.32.1705932229340; Mon, 22 Jan 2024 06:03:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932229; cv=pass; d=google.com; s=arc-20160816; b=u5F54/Maunew/GjqkqGlSMxjm5qjFQcTmSH0LO7xDcc7mzDrC1pmcbM55JrT9/5oyY SnEoxLxYGYl8XUE9ngZznDx3yPTogrEotsqpv/ZanGIChAEhBOq8O6BadSeiWSqmd8lH 4J9HJ7IdsioBfaHQsmOAN9J/hUAFd/0zYli+4JeZx+FfbESECH1G8tzAZDbh/IMCWLjv hSZww/NW1taJtrZYi6s9inbNRCjdrngPGQDsw5dUe/SYO47jl9QeE3k2WqL/DYZqjJKE dNeP481tyPLUL+2B+aX4SMdDo5gj4txFmr4/Ys3Mr0XramLxzMRlGOfZAB1d5+0vQLKd 9yWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GH23pe+q1rzapR4L2svxpX4qJUTePTmHiJ6zfTOcWpI=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=UPWCjy9qw/Wt4f3FSCdJxvyCd7Wq5jRTSBjfTatxA0B6SjqbtUruvtMbQxfWXZJh60 mmCGupWZom072lcE+j7ryQQQBMcsA8YPh67bE/37nqSfm0Wc3L5UldDIUjlYdAnUodCq cFzr1fAQCZnY9FWCL/UevRayPnPL7amm7uHhUtV3zylHyv6iQ8k7Iu8NdNFxnhuPUYE/ vV8Lwij2N+qz7Cz7Fim5jNMSWTXBeFUxt2f8zqne1cnF6zvP2rtgPFehsPRIBROTOCzj v47wiFoAQWMhSbiA+zQ0u6RP8RJkRQb/TBGK2is7zNHEBid3BL1mgZ8OCRBv9kdM1NfO gV1Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ch2o4LZe; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33123-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33123-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z93-20020a509e66000000b0055a3ace7996si4321377ede.137.2024.01.22.06.03.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:03:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33123-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ch2o4LZe; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33123-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33123-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1132C1F25A7F for ; Mon, 22 Jan 2024 14:03:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5AC63D991; Mon, 22 Jan 2024 14:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ch2o4LZe" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 2230B3D969; Mon, 22 Jan 2024 14:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932142; cv=none; b=EcwIeZ4xnNiTionLGhR4REEsTKFku3DajycpJBYl65JS/vVpcorT9/+Ps4JD/r+mNfyoQKKALUNgVD8OhRZ/5km/jlIZlQELFUVGPU1gCB2LU9GhqSfFsSygoSBInk6qgBd7vxa3G4IVjl/oZz5nLd5fG8WeS4Yopu5GQHRW/9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932142; c=relaxed/simple; bh=J2lcZmt5rFel9B8QGYuEavwUy0DILKVjO6Ink9T2gbo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FzuYDZ52uRcglmfzjUTTCnpNHScnn7RMKMkp3npxxoeDey8C33LWMUxLIzc86A7b99ySvrw0CBROL1rkeRlCv1ljyoNGOA0Oay2dZGFsgv9Fnl7Lj/GdULYmAKZl6t53f5b05e3NirHEu8kdEOAGTmbXwjL7MessROH94by8Y3I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ch2o4LZe; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6dbdb1cb23fso1373165b3a.3; Mon, 22 Jan 2024 06:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932140; x=1706536940; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GH23pe+q1rzapR4L2svxpX4qJUTePTmHiJ6zfTOcWpI=; b=ch2o4LZejBQKeyL8YSyYsp/IGoEu5U1CFJdSvXUdxslJ+4y6oy45SjhtECa01f5Pan ie2ulzo63Db8Q8EhvYFAr3O4ppn/E7TMznE19FUYHe055DzzSEEulnyPJd/SVv7MiqLF Vi7KpiionzT/MRAeEytuVnwicma6KPG1FR/Oit0OlKiuiaZp0qEB+taVVfEfjwc2DMEm Hvcz7Ts9a13AhCaAi6UyaRYXxjwp4kFTlLrYAwNvExHqVlCjMDLRwXqfnD4p94/FIkFD C+60zsgTFXJc89tfk1QcfachfrE0nzFtBGSCJ4kNlV6OBaIRWY4+gAD+kbqtcg15zxwp +EGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932140; x=1706536940; 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=GH23pe+q1rzapR4L2svxpX4qJUTePTmHiJ6zfTOcWpI=; b=aqBiLHTWArKea0l7URsTvPaA+1w2WuElyTXZ8tnRgDJvArT6hjI4+Sju3FhXQ46Mgr rB2o0j3vgjhq/lenh1QF6kT0fBRz91OyT7Bjq3puiFw0vyL39lS+xPMp/cu3k9eK8v6P WEIvWl5rkTItAgzd/KC/Fr+HrOk7dudMPyWbJFU2r9fyz6OksEyzntOyMTK5xlSo2kaZ uBYtog4lvO+/T59hKV4z63jCn4YWsrbAUlCHj/KCh3qY73hFtbCckY2+g/Iehq4fPYzo WEH0b7X7BqoAK0RBrp6uvPcHQjQdltY+FnG+FRa8UAv2t190He/kIws9xZM77GocEWy9 7lgA== X-Gm-Message-State: AOJu0YyEIn/y2xo2YmDdo1BjLh3q9JEatQOzuENH3X2MmKisPLq9fFGw dgmrLhbl4vkmefLHIAWyA/qL2sY9mHpc+63ZLT2KJpgep1yj6raVq9Jq/NQm X-Received: by 2002:a05:6a00:2449:b0:6db:ce4e:1035 with SMTP id d9-20020a056a00244900b006dbce4e1035mr4398440pfj.61.1705932140356; Mon, 22 Jan 2024 06:02:20 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:19 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/15] nilfs2: convert metadata file common code to use kmap_local Date: Mon, 22 Jan 2024 23:01:51 +0900 Message-Id: <20240122140202.6950-5-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799593118725173 X-GMAIL-MSGID: 1788799593118725173 In the common code of metadata files, the new block creation routine nilfs_mdt_insert_new_block() still uses the deprecated kmap_atomic(), so convert it to use kmap_local. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/mdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index e45c01a559c0..4f792a0ad0f0 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -47,12 +47,12 @@ nilfs_mdt_insert_new_block(struct inode *inode, unsigned long block, set_buffer_mapped(bh); - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); memset(kaddr + bh_offset(bh), 0, i_blocksize(inode)); if (init_block) init_block(inode, bh, kaddr); flush_dcache_page(bh->b_page); - kunmap_atomic(kaddr); + kunmap_local(kaddr); set_buffer_uptodate(bh); mark_buffer_dirty(bh); From patchwork Mon Jan 22 14:01:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2616340dyb; Mon, 22 Jan 2024 06:45:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlvGNaVNtaMIj9+PUewnObX7sDeEVRqFTaRQeyJVaveZin6/WVRTH1f47YIc+UhztMOomF X-Received: by 2002:a05:6a20:72ac:b0:19a:5b89:9d63 with SMTP id o44-20020a056a2072ac00b0019a5b899d63mr5625284pzk.12.1705934715382; Mon, 22 Jan 2024 06:45:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705934715; cv=pass; d=google.com; s=arc-20160816; b=gSe5HMEhOS5cYj7VRjZQOTyiSMH9U+DPevMizwS8byxF9wjwe3qS+yIS5bHFJG7ozc g/qieurqh3QTXn0dI4lYvNbIHXZjf4Pv+lksFTo01gbEhZCKDMb/2SnIJZVp5gj6k7kP 9S++M4fKZCHvE29vk7yhlPyOcOx842Mip7+SPJ3oRAAzNU1xlgjp0mQJZ542bVizmvPG BhWSdjZn416uB1SaWco/Zgp3BOXZzcQ6icihpjGRcO2U3GcBXeVa7hQoQO2jyF0DOxyV AS3dco8UtBnfLTbSYh+T98MbSGYvEVMYB/Y234Eya32gKFWc3BpY5au/nnflHQFTBXMP Nhqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VYkeoBVPgdA7v3QtKkZP+t5mhLWLzGQfUgZIGHOAXts=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=jC/VvmCMgyLHeIE1JU6FhKZmHvnnrPlowqrB03raz8fionZIaBRglrZgO2kVvu1kYk /Pn8nfX5ePlUcB/ONqBPOs0d9S+1TWWcSjeMF306KEPbKrwp2US9Az9kGeDnIigX8sca 1OJB7S1rHsjI2KPB76ChPIMbF3c9z2X7y3FDomaen+pTCYPAUP5dUQhn97bp8KLVA5gc NqLPLAv6Nr1og0FYPpUhOWJx7iRE+5XLjRrOMd6Eovyrz6encAGVUpkYZaNm7HTnGb+l LCA2M2PpCaBtXkGBSl5Fu0YlQVGno7N89knBnvrxohU1k4vUkLbDikbBiVT/Bx/DZnWN bT2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a6p0tElo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33124-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33124-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q2-20020a634302000000b005ce26be61c1si8130282pga.346.2024.01.22.06.45.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:45:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33124-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a6p0tElo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33124-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33124-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6DCD5B27142 for ; Mon, 22 Jan 2024 14:04:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEFF43DB96; Mon, 22 Jan 2024 14:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a6p0tElo" Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 ACEEE3D985; Mon, 22 Jan 2024 14:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932145; cv=none; b=l3xXCOVdOLFPQ6h8HLJurlt9eF03BiNiicajjLx5CMInQB+MA+mlyIG9n0TefzFQHLNYfA592giq6bMyH7NX8A0I9tzOLCdd6IV0DrT1gZTTMsfMD3D4R3oit/Fhoo9+lgxBROwveaYMJ815qCPWAwJDVXUvU7hGB2mo6dDn0zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932145; c=relaxed/simple; bh=Mp2VIsqkwD4hLiDLSGQW3qmjllga42IwY6fWlAt2/3c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SihRzpDD+jyvuWew9ppUD5sa5jxv+mW1nbJ+vPWX4GHtYZYRFXyZJb7epTSMhYPcnfwdLz8XiM4wufJP4erpO0M7l/yozjq+6lxdOsz4/HiD+e1axq8HByBkvMugsn9cPhyqa5XmWXgS3662iCHdD579Qqdz4nxlEUhHlz4tECs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a6p0tElo; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6dbcfef55dcso1694347b3a.1; Mon, 22 Jan 2024 06:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932143; x=1706536943; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VYkeoBVPgdA7v3QtKkZP+t5mhLWLzGQfUgZIGHOAXts=; b=a6p0tElolffh3YBFq1i1oha4GijDjLDne4t5sJA8o9JtuuJlGfQoO8FaKHvjHuRsXX 4QJgtaFgv4P1cvI/jVrsyTDPygadcdJb7m5qHgRhIYMBFzVxaITQhW7Xgm8b7EotADl+ 7RpzoDH+J7qeUm7zTyZ5oGjfbgWhutewJKBvQXcL6+sd1BJ4tPvWU4dkp8EvixsFrC4f w20h3HHj04W6Ghhjxna08yAkBKacbsZjsAFUXMHzZmNrNZ0aF4hmIk+qhFStkdtCgaW4 VxfvZ7WUWECBOQtjfi5pN5euMhxe56qcrv838Ya1CVnBx7cR/G7TK9UDjZQsKIIyM8Ot GZGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932143; x=1706536943; 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=VYkeoBVPgdA7v3QtKkZP+t5mhLWLzGQfUgZIGHOAXts=; b=szxZE0pOU9aNwWDlOEk2MvTP8Ga+iOzAoUzjrhv8DoQj1QZQ2YAYPQGouxFtWckPvT kDzLJ/mYMa8A2JGLhvqIaKqcGJ3jTozEg0WTgQHb3hxyIm4kAB5hjp5eZTrRIIDWxRDh cTO2ScIno1ScAJB/UwkVFKFHzx8VT0f6v1rGL3tY6NRCErbqjSO1qTsGfoqWCl9zMXVp wWR1kwiE2vH9gYFzxaI9t8HAMKtDcJq93TuworBFcaSl0By75H14cN9MNsIxPfMRzAl6 +Qi9VUPvZBpUkl6N/rG5R9SNu4V9hq2nBJpDYilzwLKiwo7dx9U3Iu51efxl1yBwDLlp icRg== X-Gm-Message-State: AOJu0YzxUHLy70kSfbxbVVZx6rL99wIEtcR+W1q+jMAnpZSUxiOBAE3Q 244/5Ka2FVfrFg7WfiwHM2+PD0iirZbfuIzqnChJGbiBRa0+mhz3jjBWbKMg X-Received: by 2002:a05:6a00:1a88:b0:6d9:b15f:8ffe with SMTP id e8-20020a056a001a8800b006d9b15f8ffemr6554426pfv.6.1705932142844; Mon, 22 Jan 2024 06:02:22 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:21 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/15] nilfs2: convert sufile to use kmap_local Date: Mon, 22 Jan 2024 23:01:52 +0900 Message-Id: <20240122140202.6950-6-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788802199755101545 X-GMAIL-MSGID: 1788802199755101545 Concerning the code of the metadata file sufile for segment management, convert all parts that uses the deprecated kmap_atomic() to use kmap_local. All transformations are directly possible here. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/sufile.c | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index 0a8119456c21..abf05dc5750c 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c @@ -107,11 +107,11 @@ static void nilfs_sufile_mod_counter(struct buffer_head *header_bh, struct nilfs_sufile_header *header; void *kaddr; - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = kaddr + bh_offset(header_bh); le64_add_cpu(&header->sh_ncleansegs, ncleanadd); le64_add_cpu(&header->sh_ndirtysegs, ndirtyadd); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(header_bh); } @@ -315,10 +315,10 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) ret = nilfs_sufile_get_header_block(sufile, &header_bh); if (ret < 0) goto out_sem; - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = kaddr + bh_offset(header_bh); last_alloc = le64_to_cpu(header->sh_last_alloc); - kunmap_atomic(kaddr); + kunmap_local(kaddr); nsegments = nilfs_sufile_get_nsegments(sufile); maxsegnum = sui->allocmax; @@ -352,7 +352,7 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) &su_bh); if (ret < 0) goto out_header; - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage( sufile, segnum, su_bh, kaddr); @@ -363,14 +363,14 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) continue; /* found a clean segment */ nilfs_segment_usage_set_dirty(su); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = kaddr + bh_offset(header_bh); le64_add_cpu(&header->sh_ncleansegs, -1); le64_add_cpu(&header->sh_ndirtysegs, 1); header->sh_last_alloc = cpu_to_le64(segnum); - kunmap_atomic(kaddr); + kunmap_local(kaddr); sui->ncleansegs--; mark_buffer_dirty(header_bh); @@ -384,7 +384,7 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) goto out_header; } - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(su_bh); } @@ -406,16 +406,16 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum, struct nilfs_segment_usage *su; void *kaddr; - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); if (unlikely(!nilfs_segment_usage_clean(su))) { nilfs_warn(sufile->i_sb, "%s: segment %llu must be clean", __func__, (unsigned long long)segnum); - kunmap_atomic(kaddr); + kunmap_local(kaddr); return; } nilfs_segment_usage_set_dirty(su); - kunmap_atomic(kaddr); + kunmap_local(kaddr); nilfs_sufile_mod_counter(header_bh, -1, 1); NILFS_SUI(sufile)->ncleansegs--; @@ -432,11 +432,11 @@ void nilfs_sufile_do_scrap(struct inode *sufile, __u64 segnum, void *kaddr; int clean, dirty; - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); if (su->su_flags == cpu_to_le32(BIT(NILFS_SEGMENT_USAGE_DIRTY)) && su->su_nblocks == cpu_to_le32(0)) { - kunmap_atomic(kaddr); + kunmap_local(kaddr); return; } clean = nilfs_segment_usage_clean(su); @@ -446,7 +446,7 @@ void nilfs_sufile_do_scrap(struct inode *sufile, __u64 segnum, su->su_lastmod = cpu_to_le64(0); su->su_nblocks = cpu_to_le32(0); su->su_flags = cpu_to_le32(BIT(NILFS_SEGMENT_USAGE_DIRTY)); - kunmap_atomic(kaddr); + kunmap_local(kaddr); nilfs_sufile_mod_counter(header_bh, clean ? (u64)-1 : 0, dirty ? 0 : 1); NILFS_SUI(sufile)->ncleansegs -= clean; @@ -463,12 +463,12 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, void *kaddr; int sudirty; - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); if (nilfs_segment_usage_clean(su)) { nilfs_warn(sufile->i_sb, "%s: segment %llu is already clean", __func__, (unsigned long long)segnum); - kunmap_atomic(kaddr); + kunmap_local(kaddr); return; } if (unlikely(nilfs_segment_usage_error(su))) @@ -481,7 +481,7 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, (unsigned long long)segnum); nilfs_segment_usage_set_clean(su); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(su_bh); nilfs_sufile_mod_counter(header_bh, 1, sudirty ? (u64)-1 : 0); @@ -509,12 +509,12 @@ int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum) if (ret) goto out_sem; - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr); if (unlikely(nilfs_segment_usage_error(su))) { struct the_nilfs *nilfs = sufile->i_sb->s_fs_info; - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); if (nilfs_segment_is_active(nilfs, segnum)) { nilfs_error(sufile->i_sb, @@ -532,7 +532,7 @@ int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum) ret = -EIO; } else { nilfs_segment_usage_set_dirty(su); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(bh); nilfs_mdt_mark_dirty(sufile); brelse(bh); @@ -562,7 +562,7 @@ int nilfs_sufile_set_segment_usage(struct inode *sufile, __u64 segnum, if (ret < 0) goto out_sem; - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr); if (modtime) { /* @@ -573,7 +573,7 @@ int nilfs_sufile_set_segment_usage(struct inode *sufile, __u64 segnum, su->su_lastmod = cpu_to_le64(modtime); } su->su_nblocks = cpu_to_le32(nblocks); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(bh); nilfs_mdt_mark_dirty(sufile); @@ -614,7 +614,7 @@ int nilfs_sufile_get_stat(struct inode *sufile, struct nilfs_sustat *sustat) if (ret < 0) goto out_sem; - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = kaddr + bh_offset(header_bh); sustat->ss_nsegs = nilfs_sufile_get_nsegments(sufile); sustat->ss_ncleansegs = le64_to_cpu(header->sh_ncleansegs); @@ -624,7 +624,7 @@ int nilfs_sufile_get_stat(struct inode *sufile, struct nilfs_sustat *sustat) spin_lock(&nilfs->ns_last_segment_lock); sustat->ss_prot_seq = nilfs->ns_prot_seq; spin_unlock(&nilfs->ns_last_segment_lock); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(header_bh); out_sem: @@ -640,15 +640,15 @@ void nilfs_sufile_do_set_error(struct inode *sufile, __u64 segnum, void *kaddr; int suclean; - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); if (nilfs_segment_usage_error(su)) { - kunmap_atomic(kaddr); + kunmap_local(kaddr); return; } suclean = nilfs_segment_usage_clean(su); nilfs_segment_usage_set_error(su); - kunmap_atomic(kaddr); + kunmap_local(kaddr); if (suclean) { nilfs_sufile_mod_counter(header_bh, -1, 0); @@ -717,7 +717,7 @@ static int nilfs_sufile_truncate_range(struct inode *sufile, /* hole */ continue; } - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage( sufile, segnum, su_bh, kaddr); su2 = su; @@ -726,7 +726,7 @@ static int nilfs_sufile_truncate_range(struct inode *sufile, ~BIT(NILFS_SEGMENT_USAGE_ERROR)) || nilfs_segment_is_active(nilfs, segnum + j)) { ret = -EBUSY; - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(su_bh); goto out_header; } @@ -738,7 +738,7 @@ static int nilfs_sufile_truncate_range(struct inode *sufile, nc++; } } - kunmap_atomic(kaddr); + kunmap_local(kaddr); if (nc > 0) { mark_buffer_dirty(su_bh); ncleaned += nc; @@ -823,10 +823,10 @@ int nilfs_sufile_resize(struct inode *sufile, __u64 newnsegs) sui->allocmin = 0; } - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = kaddr + bh_offset(header_bh); header->sh_ncleansegs = cpu_to_le64(sui->ncleansegs); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(header_bh); nilfs_mdt_mark_dirty(sufile); @@ -891,7 +891,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf, continue; } - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage( sufile, segnum, su_bh, kaddr); for (j = 0; j < n; @@ -904,7 +904,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf, si->sui_flags |= BIT(NILFS_SEGMENT_USAGE_ACTIVE); } - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(su_bh); } ret = nsegs; @@ -973,7 +973,7 @@ ssize_t nilfs_sufile_set_suinfo(struct inode *sufile, void *buf, goto out_header; for (;;) { - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); su = nilfs_sufile_block_get_segment_usage( sufile, sup->sup_segnum, bh, kaddr); @@ -1010,7 +1010,7 @@ ssize_t nilfs_sufile_set_suinfo(struct inode *sufile, void *buf, su->su_flags = cpu_to_le32(sup->sup_sui.sui_flags); } - kunmap_atomic(kaddr); + kunmap_local(kaddr); sup = (void *)sup + supsz; if (sup >= supend) @@ -1115,7 +1115,7 @@ int nilfs_sufile_trim_fs(struct inode *sufile, struct fstrim_range *range) continue; } - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); for (i = 0; i < n; ++i, ++segnum, su = (void *)su + susz) { @@ -1145,7 +1145,7 @@ int nilfs_sufile_trim_fs(struct inode *sufile, struct fstrim_range *range) } if (nblocks >= minlen) { - kunmap_atomic(kaddr); + kunmap_local(kaddr); ret = blkdev_issue_discard(nilfs->ns_bdev, start * sects_per_block, @@ -1157,7 +1157,7 @@ int nilfs_sufile_trim_fs(struct inode *sufile, struct fstrim_range *range) } ndiscarded += nblocks; - kaddr = kmap_atomic(su_bh->b_page); + kaddr = kmap_local_page(su_bh->b_page); su = nilfs_sufile_block_get_segment_usage( sufile, segnum, su_bh, kaddr); } @@ -1166,7 +1166,7 @@ int nilfs_sufile_trim_fs(struct inode *sufile, struct fstrim_range *range) start = seg_start; nblocks = seg_end - seg_start + 1; } - kunmap_atomic(kaddr); + kunmap_local(kaddr); put_bh(su_bh); } @@ -1246,10 +1246,10 @@ int nilfs_sufile_read(struct super_block *sb, size_t susize, goto failed; sui = NILFS_SUI(sufile); - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = kaddr + bh_offset(header_bh); sui->ncleansegs = le64_to_cpu(header->sh_ncleansegs); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(header_bh); sui->allocmax = nilfs_sufile_get_nsegments(sufile) - 1; From patchwork Mon Jan 22 14:01:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2588993dyb; Mon, 22 Jan 2024 06:04:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/Y9DpSEiq8jo9u55K6EzVj895+FLwfwlUiJKS3RMfXBa/ZrWn+lcbf15s0tADZNdAdN2L X-Received: by 2002:a17:906:bce4:b0:a2a:76fa:f09d with SMTP id op4-20020a170906bce400b00a2a76faf09dmr1948987ejb.73.1705932269976; Mon, 22 Jan 2024 06:04:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932269; cv=pass; d=google.com; s=arc-20160816; b=ITF5uQs9nGBYIeuV5zIbIcdhGpaH6oEYGiXLdsNRLH0p4w04xrrdInZ69vXuTLJBqm jzFuB3idHNl1hsi+xNL+/WWn/oDkM2BZ4wEhkXkLIEXXTpI/1WkcnA/W5q/tkzXvkXAb YNTm4Pvg6/I98DMYOlO/mZ4Oemf+Cd0chF3/2oZHpIcvhlPJ/kh82pQItbLqKuUJTeWA 21e/oWc9dI84fBf2FJncj4ykPdSY55bROlKWC+Oewp3aNUZ4t8yhXF/xDRkW1Mj+BPVu eET+bO0xKDre3pFW0rI76K4e48jrLAwsGkQ+0QKqKm/DYJ06FgPMsyrnGgZbzH/Qmrm3 QU2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=alZcxKZkQD4ACA9S37ZutEnmpFpfckKyvR2o/CXMERQ=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=rXcuV5lZgiG9MPoijORoV5D3nPVY0Fc2qaHlCweOmvsOPAxXva3E/uitpPRNOzHXmD lIVzodUg8v/c+9yO551KeXh4QuWIhuJHVWJkJrjhzryJKk+5rPYPC2kK5frQE2eyON0K VfEHe0O282JAYmuj/TOKZlfwGeDjPbs0uvIf4yQhC6M/G34x0WJduZ1j8B2GsY8KwVCt VNEU2DbV5rPRscHmH1vvBtRT9L5b3t6iTO6EtQb4tv5UZ5O9J3y+UOme1/jgduEROpNa Gu/K7cyAIfPhGAuac+Ng6LAFQMO8uQ3IlUFm7aqITUswMG0ShN/ahGSEL36SYNQVE/Nv nMng== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bucdMhRI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33125-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33125-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h22-20020a17090619d600b00a30798db5c9si426243ejd.146.2024.01.22.06.04.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:04:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33125-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bucdMhRI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33125-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33125-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6D46A1F24529 for ; Mon, 22 Jan 2024 14:04:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 969353DBBB; Mon, 22 Jan 2024 14:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bucdMhRI" Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 A9C693DB85; Mon, 22 Jan 2024 14:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932149; cv=none; b=Ab6DCJTUKo/CHJyC7z26676c3Tsgllk6QNpSFLiZw7TGCNOtv09W3XIbDLDankLYO76kO0J7OanRJ7dEkSJuFqCyDEu8P810QerMjqVnpOLavNvQpo+QVk7316f3nDxn++hIiZm1It8nvH1OBF7yP+FXdf6s26EPZe1eOAbzb4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932149; c=relaxed/simple; bh=IudtWyOxinWnl6LMIfCneUAvzLA9Hbbkx69DLR7GJl4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jKjQI2U+Tx71SkBkqg9sttSZyFPiFylnzahj9IHm4kzosP9kUEtgut1QugOdCRAGKeKPNK2hd5pc79v/ibzTpvvOcRXglH+nMfL18ZOUS1ala8zDujM64U/tKsySomz8T8CC+3YSawyZCzOQaWeYXnEPuj1TY+F7yLwno53hmKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bucdMhRI; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6dbd7f1a300so1523537b3a.1; Mon, 22 Jan 2024 06:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932147; x=1706536947; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=alZcxKZkQD4ACA9S37ZutEnmpFpfckKyvR2o/CXMERQ=; b=bucdMhRIo22Umco4hkh/xPFwwvax492Hk4PbxT86wYFrhMWEDKfVAIJKIHLIyL4Knt Bv6pCrFmcPu7eSvk1ARXOr7jL5KjwV3bgylNzxrKNPHa3RtS+YjeWH5HJ0jGYf5967rd k5iTKruVcI6ee4nQbbAE+QScPf0g6+6qgDSvhvXsxz415L/i7AF+6Jz7kmTZml5oXF9R iewMOmAdWQhx2195fXtmipoo6EXiBwxFmJxByQMK3EhezID3uqgRqTHFmns9L/oFS1/6 9n+dPHImwjVmhay1Nf9t3uAZl2KtEPXbTFMpYzAHNVOTuOX9/IqpV6ZMz6FJHKa3rh+M 7RdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932147; x=1706536947; 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=alZcxKZkQD4ACA9S37ZutEnmpFpfckKyvR2o/CXMERQ=; b=Q9Gw8RygFPbeGdaSjP5eDO6ije3oticD6sV+jwRTW7rWKJn5XvWvL3/PnNm0n8p8to OJ7vSIUADXj5Avb5aUbrVgBLYMltW6GxXX41mCGuOXEMQ41vKgvg3875N6r3QvfiuXkK OG2dayfcWFYyIrEHaAn2TDEHq1uXMzd86RuL3dnAWWEeGFgcqQDJXfTTgWFCvAFK+dRH CJU/MtYOpa4JI+GrdHwdTOEJB82SJ8S9Pog/LkkR55VGITV/TPoDt3GKnvpjgufKLfs/ LVu+V3BBxjVNMIGcsds2n2M0QrU1zx10jENIkx3/xW82UhDKdBx9DPXGEi9Hoidap88p ftkQ== X-Gm-Message-State: AOJu0YzsTLN9UOcdoNmp2PDOJLRMU5EnUsa4T4uw4rfkrFAyTEhXZWr1 d8cwy60Z7cb8UzMc/zxzdBq3pI4CpHcsloL1tZM1xzOiRmnwPje5JvF6fGUM X-Received: by 2002:a05:6a20:6ba6:b0:19a:d8d2:c645 with SMTP id bu38-20020a056a206ba600b0019ad8d2c645mr4510454pzb.109.1705932145406; Mon, 22 Jan 2024 06:02:25 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:24 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/15] nilfs2: convert persistent object allocator to use kmap_local Date: Mon, 22 Jan 2024 23:01:53 +0900 Message-Id: <20240122140202.6950-7-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799635562891189 X-GMAIL-MSGID: 1788799635562891189 Regarding the allocator code that is commonly used in the ondisk inode metadata file ifile and the disk address translation metadata file DAT, convert the parts that use the deprecated kmap_atomic() and kmap() to use kmap_local. Most can be converted directly, but only nilfs_palloc_prepare_alloc_entry() needs to be rewritten to change mapping sections so that multiple kmap_local/kunmap_local calls are nested and disk I/O can be avoided within the mapping sections. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/alloc.c | 91 ++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c index 7342de296ec3..89caef7513db 100644 --- a/fs/nilfs2/alloc.c +++ b/fs/nilfs2/alloc.c @@ -525,54 +525,55 @@ int nilfs_palloc_prepare_alloc_entry(struct inode *inode, ret = nilfs_palloc_get_desc_block(inode, group, 1, &desc_bh); if (ret < 0) return ret; - desc_kaddr = kmap(desc_bh->b_page); + desc_kaddr = kmap_local_page(desc_bh->b_page); desc = nilfs_palloc_block_get_group_desc( inode, group, desc_bh, desc_kaddr); n = nilfs_palloc_rest_groups_in_desc_block(inode, group, maxgroup); - for (j = 0; j < n; j++, desc++, group++) { + for (j = 0; j < n; j++, desc++, group++, group_offset = 0) { lock = nilfs_mdt_bgl_lock(inode, group); - if (nilfs_palloc_group_desc_nfrees(desc, lock) > 0) { - ret = nilfs_palloc_get_bitmap_block( - inode, group, 1, &bitmap_bh); - if (ret < 0) - goto out_desc; - bitmap_kaddr = kmap(bitmap_bh->b_page); - bitmap = bitmap_kaddr + bh_offset(bitmap_bh); - pos = nilfs_palloc_find_available_slot( - bitmap, group_offset, - entries_per_group, lock); - if (pos >= 0) { - /* found a free entry */ - nilfs_palloc_group_desc_add_entries( - desc, lock, -1); - req->pr_entry_nr = - entries_per_group * group + pos; - kunmap(desc_bh->b_page); - kunmap(bitmap_bh->b_page); - - req->pr_desc_bh = desc_bh; - req->pr_bitmap_bh = bitmap_bh; - return 0; - } - kunmap(bitmap_bh->b_page); - brelse(bitmap_bh); + if (nilfs_palloc_group_desc_nfrees(desc, lock) == 0) + continue; + + kunmap_local(desc_kaddr); + ret = nilfs_palloc_get_bitmap_block(inode, group, 1, + &bitmap_bh); + if (unlikely(ret < 0)) { + brelse(desc_bh); + return ret; } - group_offset = 0; + desc_kaddr = kmap_local_page(desc_bh->b_page); + desc = nilfs_palloc_block_get_group_desc( + inode, group, desc_bh, desc_kaddr); + + bitmap_kaddr = kmap_local_page(bitmap_bh->b_page); + bitmap = bitmap_kaddr + bh_offset(bitmap_bh); + pos = nilfs_palloc_find_available_slot( + bitmap, group_offset, entries_per_group, lock); + kunmap_local(bitmap_kaddr); + if (pos >= 0) + goto found; + + brelse(bitmap_bh); } - kunmap(desc_bh->b_page); + kunmap_local(desc_kaddr); brelse(desc_bh); } /* no entries left */ return -ENOSPC; - out_desc: - kunmap(desc_bh->b_page); - brelse(desc_bh); - return ret; +found: + /* found a free entry */ + nilfs_palloc_group_desc_add_entries(desc, lock, -1); + req->pr_entry_nr = entries_per_group * group + pos; + kunmap_local(desc_kaddr); + + req->pr_desc_bh = desc_bh; + req->pr_bitmap_bh = bitmap_bh; + return 0; } /** @@ -606,10 +607,10 @@ void nilfs_palloc_commit_free_entry(struct inode *inode, spinlock_t *lock; group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); - desc_kaddr = kmap(req->pr_desc_bh->b_page); + desc_kaddr = kmap_local_page(req->pr_desc_bh->b_page); desc = nilfs_palloc_block_get_group_desc(inode, group, req->pr_desc_bh, desc_kaddr); - bitmap_kaddr = kmap(req->pr_bitmap_bh->b_page); + bitmap_kaddr = kmap_local_page(req->pr_bitmap_bh->b_page); bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); lock = nilfs_mdt_bgl_lock(inode, group); @@ -621,8 +622,8 @@ void nilfs_palloc_commit_free_entry(struct inode *inode, else nilfs_palloc_group_desc_add_entries(desc, lock, 1); - kunmap(req->pr_bitmap_bh->b_page); - kunmap(req->pr_desc_bh->b_page); + kunmap_local(bitmap_kaddr); + kunmap_local(desc_kaddr); mark_buffer_dirty(req->pr_desc_bh); mark_buffer_dirty(req->pr_bitmap_bh); @@ -647,10 +648,10 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode, spinlock_t *lock; group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); - desc_kaddr = kmap(req->pr_desc_bh->b_page); + desc_kaddr = kmap_local_page(req->pr_desc_bh->b_page); desc = nilfs_palloc_block_get_group_desc(inode, group, req->pr_desc_bh, desc_kaddr); - bitmap_kaddr = kmap(req->pr_bitmap_bh->b_page); + bitmap_kaddr = kmap_local_page(req->pr_bitmap_bh->b_page); bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); lock = nilfs_mdt_bgl_lock(inode, group); @@ -662,8 +663,8 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode, else nilfs_palloc_group_desc_add_entries(desc, lock, 1); - kunmap(req->pr_bitmap_bh->b_page); - kunmap(req->pr_desc_bh->b_page); + kunmap_local(bitmap_kaddr); + kunmap_local(desc_kaddr); brelse(req->pr_bitmap_bh); brelse(req->pr_desc_bh); @@ -755,7 +756,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) /* Get the first entry number of the group */ group_min_nr = (__u64)group * epg; - bitmap_kaddr = kmap(bitmap_bh->b_page); + bitmap_kaddr = kmap_local_page(bitmap_bh->b_page); bitmap = bitmap_kaddr + bh_offset(bitmap_bh); lock = nilfs_mdt_bgl_lock(inode, group); @@ -801,7 +802,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) entry_start = rounddown(group_offset, epb); } while (true); - kunmap(bitmap_bh->b_page); + kunmap_local(bitmap_kaddr); mark_buffer_dirty(bitmap_bh); brelse(bitmap_bh); @@ -815,11 +816,11 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) inode->i_ino); } - desc_kaddr = kmap_atomic(desc_bh->b_page); + desc_kaddr = kmap_local_page(desc_bh->b_page); desc = nilfs_palloc_block_get_group_desc( inode, group, desc_bh, desc_kaddr); nfree = nilfs_palloc_group_desc_add_entries(desc, lock, n); - kunmap_atomic(desc_kaddr); + kunmap_local(desc_kaddr); mark_buffer_dirty(desc_bh); nilfs_mdt_mark_dirty(inode); brelse(desc_bh); From patchwork Mon Jan 22 14:01:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2589272dyb; Mon, 22 Jan 2024 06:04:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsvvG7ULj4iwaNyOHT150GYO3wNiXTlCser6DnVqDprf8rvirIcDcm1gI1ovbd/YALGMrO X-Received: by 2002:aa7:d507:0:b0:55c:382f:4776 with SMTP id y7-20020aa7d507000000b0055c382f4776mr877441edq.20.1705932287260; Mon, 22 Jan 2024 06:04:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932287; cv=pass; d=google.com; s=arc-20160816; b=T7jzdNCPRsRUX2Dgx6f/AinzYlf1ONpnKVGh+RHhccd1YfVV+5nGTiYbvLyQd9tZ/Z 15SFFg2XV1F35sWdadtxENtG6xr3hEodo3tcKRsah1/4n2Ba4+mj7VlGPjBP4a9kG4UD OWJecJqTR0ZGCgdvNb/bLSCtRretNxMlA/SAezdQFRPd+mDkegvSq7Rpp3H0xIBk8GCK 2VUh1OqlUUUSWXGmXnhmlQagQtfv4MWj3hoQFYY4TlGyLNYS0mfJaX43IrUmuX/Hrrvf AcTrttZPmKLfFVbdjamhilfyWWAe2syoNT7U8VWrr1aWjfbgw9Uk+SnyMQ9yHsnLFvqY iEhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XjPSFlgRnv/9c3guXKpp1n6ASVGkqJA5QUOIQi+tg3A=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=SDBGn06FVNXFxTcIrZc8BnABzncsfDA7fQbo7eIw5fvlDlObgi1VqmvarWQqOlrLxo te1gZYvcwN7C72pUmQ4X2aztG2gzIvxl/KopH2tL/hNwy9HjHdw/OR7iU2chdZFiBVsy RKXG9jBBhCl+OlLkUPeCny8mFWmWzD8NnP0lrUTaDQ/ntQKjRcY/i0Rwc/fw2rjZewSV jJQ0KZ4QglZNrzY4IArlNoQf54Fv2xnLlQ+UcYIaF98w30ZY8UdBGSgdF9zb72FK7X/C mf9o7H2YdLLPNKxKagU3QRVW9B1bFdt8byVSCNavNO4PcHA7TdMX1eBtil/+pGHf47Gb lUNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UgLRmAKH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33126-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33126-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c6-20020a0564021f8600b005595c517b71si7936961edc.31.2024.01.22.06.04.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33126-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UgLRmAKH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33126-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33126-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B8CB61F24D69 for ; Mon, 22 Jan 2024 14:04:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12C603E47A; Mon, 22 Jan 2024 14:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UgLRmAKH" Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 3E1693DB92; Mon, 22 Jan 2024 14:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932150; cv=none; b=EeQzC7m8h+Hvodutnw/3T4Lq+3ZT46aWv0siJEJVBtnrXvFlcf0Y0PFSu4naLHgZDEKm40rj0T4aaUrqWVIpoOCV3qU4eGzQTXwL1YKcj9gLs1LO9VanhAhwAuzU+mXy2yp+aTlxnfcHhEQseYQtUjSUObhAbzQP2whKFk2Iidc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932150; c=relaxed/simple; bh=lsO8tfbwD9AdmOWSFushpOZY+ipFK/d/A6+FIEtkRsM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m7h38Z0MOLEIQGNU8knXdrByEmytzNKYVj1wtpObTX+5vYbree+E6ZAJAB5QAzHeyt2JhvIouYGJxxbzvT1e04NxU9yz9W485R+KC1uKf+aYgI3hXRM5UQo/vuFnXBxSl61cJBTMOvL8dq0iKfaXp/4VPS/xOBHUts0mZMFU5Ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UgLRmAKH; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6db9e52bbccso1569350b3a.3; Mon, 22 Jan 2024 06:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932148; x=1706536948; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XjPSFlgRnv/9c3guXKpp1n6ASVGkqJA5QUOIQi+tg3A=; b=UgLRmAKHkX33uHUwh35fhTjXZGB+Ndd1sGSlXkv08oFh6Q01c3UHRNKk4xZRG+tqPO OzSDAa6XQVpQMY6i2LMZii6PzQfvLvuVco5E6wn2Zth5GvgKNYfz9eqnAyqFptQQdhk/ +uYAqJjLvwiFUyGvqa3vE2dPSjJJ5LWpIANlMSaQbaH6hvUF05noe8y7kQ6HurZZnnaV 5DGA6rFtIrm5rJmqn+aXK6+bJkr04sv613Ss6XurAGggHGFuh5eSCQtveLYTX7wkTaAU v6wy8/tT7u+aydWwelMlg8Y453YtCA5C6pNdrd1ghDZJX+uH7HgOo7YBPQBAWyu3tfQ2 rryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932148; x=1706536948; 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=XjPSFlgRnv/9c3guXKpp1n6ASVGkqJA5QUOIQi+tg3A=; b=lxJ+0z3RHzl+ozVgeT7hbmVz9uxEoDQTJYXPAeCczXIkr8iiEFFpz5Wk+9yhaAvMQ3 36/lsqD13OuMdIl8+V81tH2cy8jRVA1N6S510Sd9EXey1JkU2QLlb86SdhZjNkNVNtlf jGiLo+KU65XVW+wbhHlvH6d1dFtioWtfZvxZWZp4gC3oM4IQa/1MegNUeqZscf8oYclI OciTgOasm5oxudEnMrp6nL/Rs1frXtyvwEVN2aNH93PGYxT2CLUWNJrsx+z8E12DPoxs ZlHC06rIrSprRA6XO2vLWSrec5CONc76UeyqMwUeA5gxZYw7JhKPiZqhJCckIpqTfWXH uGBg== X-Gm-Message-State: AOJu0YzpAtd8YBeGFuLCt5V0rfUoYqcT5KhMaQyZwlAIo9WjzJvwgiYu k2/64Pb+McVrTEKPlhVG9NiDZJ+0S0bCfYw1gtGEyBsxSTWs+8Z7SuBRlvPJ X-Received: by 2002:a05:6a00:244e:b0:6d9:b385:26f9 with SMTP id d14-20020a056a00244e00b006d9b38526f9mr2420201pfj.2.1705932147801; Mon, 22 Jan 2024 06:02:27 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:26 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/15] nilfs2: convert DAT to use kmap_local Date: Mon, 22 Jan 2024 23:01:54 +0900 Message-Id: <20240122140202.6950-8-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799654161259887 X-GMAIL-MSGID: 1788799654161259887 Concerning the code of the metadata file DAT for disk address translation, convert all parts that use the deprecated kmap_atomic to use kmap_local. All transformations are directly possible. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/dat.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index 9cf6ba58f585..8f71f8b0e218 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c @@ -91,13 +91,13 @@ void nilfs_dat_commit_alloc(struct inode *dat, struct nilfs_palloc_req *req) struct nilfs_dat_entry *entry; void *kaddr; - kaddr = kmap_atomic(req->pr_entry_bh->b_page); + kaddr = kmap_local_page(req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, req->pr_entry_bh, kaddr); entry->de_start = cpu_to_le64(NILFS_CNO_MIN); entry->de_end = cpu_to_le64(NILFS_CNO_MAX); entry->de_blocknr = cpu_to_le64(0); - kunmap_atomic(kaddr); + kunmap_local(kaddr); nilfs_palloc_commit_alloc_entry(dat, req); nilfs_dat_commit_entry(dat, req); @@ -115,13 +115,13 @@ static void nilfs_dat_commit_free(struct inode *dat, struct nilfs_dat_entry *entry; void *kaddr; - kaddr = kmap_atomic(req->pr_entry_bh->b_page); + kaddr = kmap_local_page(req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, req->pr_entry_bh, kaddr); entry->de_start = cpu_to_le64(NILFS_CNO_MIN); entry->de_end = cpu_to_le64(NILFS_CNO_MIN); entry->de_blocknr = cpu_to_le64(0); - kunmap_atomic(kaddr); + kunmap_local(kaddr); nilfs_dat_commit_entry(dat, req); @@ -145,12 +145,12 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req, struct nilfs_dat_entry *entry; void *kaddr; - kaddr = kmap_atomic(req->pr_entry_bh->b_page); + kaddr = kmap_local_page(req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, req->pr_entry_bh, kaddr); entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat)); entry->de_blocknr = cpu_to_le64(blocknr); - kunmap_atomic(kaddr); + kunmap_local(kaddr); nilfs_dat_commit_entry(dat, req); } @@ -167,12 +167,12 @@ int nilfs_dat_prepare_end(struct inode *dat, struct nilfs_palloc_req *req) if (ret < 0) return ret; - kaddr = kmap_atomic(req->pr_entry_bh->b_page); + kaddr = kmap_local_page(req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, req->pr_entry_bh, kaddr); start = le64_to_cpu(entry->de_start); blocknr = le64_to_cpu(entry->de_blocknr); - kunmap_atomic(kaddr); + kunmap_local(kaddr); if (blocknr == 0) { ret = nilfs_palloc_prepare_free_entry(dat, req); @@ -202,7 +202,7 @@ void nilfs_dat_commit_end(struct inode *dat, struct nilfs_palloc_req *req, sector_t blocknr; void *kaddr; - kaddr = kmap_atomic(req->pr_entry_bh->b_page); + kaddr = kmap_local_page(req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, req->pr_entry_bh, kaddr); end = start = le64_to_cpu(entry->de_start); @@ -212,7 +212,7 @@ void nilfs_dat_commit_end(struct inode *dat, struct nilfs_palloc_req *req, } entry->de_end = cpu_to_le64(end); blocknr = le64_to_cpu(entry->de_blocknr); - kunmap_atomic(kaddr); + kunmap_local(kaddr); if (blocknr == 0) nilfs_dat_commit_free(dat, req); @@ -227,12 +227,12 @@ void nilfs_dat_abort_end(struct inode *dat, struct nilfs_palloc_req *req) sector_t blocknr; void *kaddr; - kaddr = kmap_atomic(req->pr_entry_bh->b_page); + kaddr = kmap_local_page(req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, req->pr_entry_bh, kaddr); start = le64_to_cpu(entry->de_start); blocknr = le64_to_cpu(entry->de_blocknr); - kunmap_atomic(kaddr); + kunmap_local(kaddr); if (start == nilfs_mdt_cno(dat) && blocknr == 0) nilfs_palloc_abort_free_entry(dat, req); @@ -362,7 +362,7 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr) } } - kaddr = kmap_atomic(entry_bh->b_page); + kaddr = kmap_local_page(entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr); if (unlikely(entry->de_blocknr == cpu_to_le64(0))) { nilfs_crit(dat->i_sb, @@ -370,13 +370,13 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr) __func__, (unsigned long long)vblocknr, (unsigned long long)le64_to_cpu(entry->de_start), (unsigned long long)le64_to_cpu(entry->de_end)); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(entry_bh); return -EINVAL; } WARN_ON(blocknr == 0); entry->de_blocknr = cpu_to_le64(blocknr); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(entry_bh); nilfs_mdt_mark_dirty(dat); @@ -426,7 +426,7 @@ int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp) } } - kaddr = kmap_atomic(entry_bh->b_page); + kaddr = kmap_local_page(entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr); blocknr = le64_to_cpu(entry->de_blocknr); if (blocknr == 0) { @@ -436,7 +436,7 @@ int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp) *blocknrp = blocknr; out: - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(entry_bh); return ret; } @@ -457,7 +457,7 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned int visz, 0, &entry_bh); if (ret < 0) return ret; - kaddr = kmap_atomic(entry_bh->b_page); + kaddr = kmap_local_page(entry_bh->b_page); /* last virtual block number in this block */ first = vinfo->vi_vblocknr; do_div(first, entries_per_block); @@ -473,7 +473,7 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned int visz, vinfo->vi_end = le64_to_cpu(entry->de_end); vinfo->vi_blocknr = le64_to_cpu(entry->de_blocknr); } - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(entry_bh); } From patchwork Mon Jan 22 14:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2590888dyb; Mon, 22 Jan 2024 06:06:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYSZrJ41pkBqKsUrNofFd0RxeusA7+zMCpifzA9WCOw9PVZjfbY6gMdq54IUINcLD0r8e4 X-Received: by 2002:a92:d7d2:0:b0:361:946b:8874 with SMTP id g18-20020a92d7d2000000b00361946b8874mr7083986ilq.18.1705932399835; Mon, 22 Jan 2024 06:06:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932399; cv=pass; d=google.com; s=arc-20160816; b=dBV/AVKgmSQICRt7yMcmJufmhG5HIK63RK09hgMprP48nFQf+FQnRhlo1QqeboBy+z Z6kCOv1ItRJhQKE2McxXNFyTNhErbdG6JsqAQ2LaRHJkW5jJRqfcu+JvAo9agexzDIG6 Cx1MrLPUG6ffHEbZoZcfYl/lSms34IOO4Al+m0bqshS265epp7rJ0IR7/fskHvVxRXt/ 7EvLU66Wbp66ev/bsCkpoE3GvJaM9dFMU5g1hQGy9zU5Z034pNmMlNo5GPmVE2L0JXVf 904j3EfWBHVKTzrjQ7+1aBOcONKpDvdqgsBzqKSMnbdH3W/caF8b5GJ+dRe9aDS4vPIG XVCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zNWHkCgMBEhzfewM0Gmi05uGlalhciGwKja6MdQzI18=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=fMOmRtyvCo7Q7fE4muEovMmCnvNslqVWj3roAbDjFtmYfgi92uUjPp7tfJ+YZOMMAs YoXSjVwKhvGlZILNHl5TWWmn7BiprLOQIynXXBVG5HzOH4E6Kmb7KKt66li8kJtE3+iS icrmXXZr6B6ooBMHdXbDnLjhAf/LlXijomLbGcNAXar4H/fCXe6jqcqSPNLSHkNucZJO qaTXZ5bTtWm84TqTgu2SjD1z8L8Knfv79B97AFDYHUnpIN0k8nZ9r5vyck2LoQl/ek+F CxJrhQolrlU956DwglCshrQHZioWI2mLl3Y/tqL5o6KthKt+QeXF8iZU4bIpQGGYx8bX 4rvg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YEgpyHNW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33127-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33127-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u8-20020a631408000000b005cecb08c45asi7889165pgl.431.2024.01.22.06.06.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33127-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YEgpyHNW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33127-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33127-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B63428AF12 for ; Mon, 22 Jan 2024 14:05:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 648D93EA6C; Mon, 22 Jan 2024 14:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YEgpyHNW" Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 471AD3DBA6; Mon, 22 Jan 2024 14:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932152; cv=none; b=lRo+kCGwQLPQqiE5IuJILTASU2e80t69XiNAdmUqOlkVRF4aI6HOBRKTTkfCZFVR9KeAQYvG0V1xEBjN3Ld0WlN+Aym8PrHrDyJIAKw7uLQM/gBjJ3WHVUuzvV0yg3V6E2gTLNrbDqkzR1VRvBuJxT9iu186885yq8T6OwoLkds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932152; c=relaxed/simple; bh=H3Bn5PBTfDQYNUBRiWoEdoIC0beHT3kL6osPczjI6nU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DUUrkvFWjNGczNJe9JlKm94bP1KK6VEaDLz58z0S+A7JzT5EwgCGnS9q0Mtg3dEiWDBCuKJSuMS5J7tJXRmkUKXkB1e6NycO5+NIy2Ymmr/dkJawjggEH4+ZkFmLOsLTPIo03MrXA8Z4UNbYtNpqBSh7Hi/2lx96ZCqIBXHUz1A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YEgpyHNW; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6dbd2e435d9so877853b3a.1; Mon, 22 Jan 2024 06:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932150; x=1706536950; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zNWHkCgMBEhzfewM0Gmi05uGlalhciGwKja6MdQzI18=; b=YEgpyHNWxfnmDqbXBUk0C2Tnt4b515nMLCkcTDUBz9/BXMdN32N5AlSyLy0in5OdnM 6KJDFONBYsyzNtFRWZ4wlfBIZAOdxGIsy2VO4nR+mQ+S26J68jYRXvPcEdrfjw0R1pPZ s1ldEdG6ZcR+2qkVAddkx3XeAu0djlxmgeLXZq3Y6lL6VIAkUbBLZmiXEifII7OqupeB fvXvytRf9ks2+OM9ITlRC+cbX9jjrRgwLegRKqeHZrrslCWHiJO1yE/FnS1LLvWCaqTF W0VjXJ+Gs+6e+oEMLKHAhvbynodVyRC2Pmtwjwqyp08zLEmyv6Bhw45dEAQEwqjeoQgO JN3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932150; x=1706536950; 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=zNWHkCgMBEhzfewM0Gmi05uGlalhciGwKja6MdQzI18=; b=nE0JVLy3Lix58DoVbwrCF/4NSooY2jsXXikF9wse5xYWcWCGlCcN2do1ixPGLsAgfx +ljpLukzt7cADFUbIO9XigYDNX3eieNWWB9Mj44wHTLCS0asdkBh/I5jaP1zlzsAPrU6 E5pbViuDARxPOsTQ1/ZCOtyR4KZ9qpJHPYT4SXUhxfLrto0G/TG5TJJig/FsL5lEacVB saCxrrSN7DymD5Gx+aYqjAB+KtR9em8WtFLGVK3R1PVGXvw2PHFjhHkGypX0eztu1Lsa 2xZbKNSj27Vl3PEzPw29gEv8RnhcOdl/GIfusadiodhmJbvRn8yPKkSg6FNtVvFvbdMr ZO9Q== X-Gm-Message-State: AOJu0YxXXGrww8Wr0Dd+nfesbcwOATrI/xzdDuUw4X9QOl3JQ7kjfBBs uKekPRVfr96k1YxcdvoaIv6KDUDpIy8EA9AGBuDa7uX7kziVmBLh65gn+vcn X-Received: by 2002:a05:6a00:298a:b0:6db:c57e:d8e0 with SMTP id cj10-20020a056a00298a00b006dbc57ed8e0mr2326253pfb.18.1705932150544; Mon, 22 Jan 2024 06:02:30 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:29 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/15] nilfs2: move nilfs_bmap_write call out of nilfs_write_inode_common Date: Mon, 22 Jan 2024 23:01:55 +0900 Message-Id: <20240122140202.6950-9-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799772306873231 X-GMAIL-MSGID: 1788799772306873231 Before converting the disk inode management metadata file ifile, the call to nilfs_bmap_write(), the i_device_code setting, and the zero-fill code for inodes on the super root block are moved from nilfs_write_inode_common() to its callers. This cleanup simplifies the role and arguments of nilfs_write_inode_common() and collects calls to nilfs_bmap_write() to the log writing code. Also, add and use a new helper nilfs_write_root_mdt_inode() to avoid code duplication in the data export routine nilfs_segctor_fill_in_super_root() to the super root block's buffer. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/inode.c | 38 +++++++++++++++--------------------- fs/nilfs2/nilfs.h | 3 ++- fs/nilfs2/segment.c | 47 +++++++++++++++++++++++++++++++++++++-------- 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 9c334c722fc1..b9d40f5e94d3 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -759,8 +759,18 @@ struct inode *nilfs_iget_for_shadow(struct inode *inode) return s_inode; } +/** + * nilfs_write_inode_common - export common inode information to on-disk inode + * @inode: inode object + * @raw_inode: on-disk inode + * + * This function writes standard information from the on-memory inode @inode + * to @raw_inode on ifile, cpfile or a super root block. Since inode bmap + * data is not exported, nilfs_bmap_write() must be called separately during + * log writing. + */ void nilfs_write_inode_common(struct inode *inode, - struct nilfs_inode *raw_inode, int has_bmap) + struct nilfs_inode *raw_inode) { struct nilfs_inode_info *ii = NILFS_I(inode); @@ -778,21 +788,6 @@ void nilfs_write_inode_common(struct inode *inode, raw_inode->i_flags = cpu_to_le32(ii->i_flags); raw_inode->i_generation = cpu_to_le32(inode->i_generation); - if (NILFS_ROOT_METADATA_FILE(inode->i_ino)) { - struct the_nilfs *nilfs = inode->i_sb->s_fs_info; - - /* zero-fill unused portion in the case of super root block */ - raw_inode->i_xattr = 0; - raw_inode->i_pad = 0; - memset((void *)raw_inode + sizeof(*raw_inode), 0, - nilfs->ns_inode_size - sizeof(*raw_inode)); - } - - if (has_bmap) - nilfs_bmap_write(ii->i_bmap, raw_inode); - else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) - raw_inode->i_device_code = - cpu_to_le64(huge_encode_dev(inode->i_rdev)); /* * When extending inode, nilfs->ns_inode_size should be checked * for substitutions of appended fields. @@ -813,12 +808,11 @@ void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags) if (flags & I_DIRTY_DATASYNC) set_bit(NILFS_I_INODE_SYNC, &ii->i_state); - nilfs_write_inode_common(inode, raw_inode, 0); - /* - * XXX: call with has_bmap = 0 is a workaround to avoid - * deadlock of bmap. This delays update of i_bmap to just - * before writing. - */ + nilfs_write_inode_common(inode, raw_inode); + + if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) + raw_inode->i_device_code = + cpu_to_le64(huge_encode_dev(inode->i_rdev)); nilfs_ifile_unmap_inode(ifile, ino, ibh); } diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 98cffaf0ac12..2e29b98ba8ba 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -256,7 +256,8 @@ extern struct inode *nilfs_new_inode(struct inode *, umode_t); extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int); extern void nilfs_set_inode_flags(struct inode *); extern int nilfs_read_inode_common(struct inode *, struct nilfs_inode *); -extern void nilfs_write_inode_common(struct inode *, struct nilfs_inode *, int); +void nilfs_write_inode_common(struct inode *inode, + struct nilfs_inode *raw_inode); struct inode *nilfs_ilookup(struct super_block *sb, struct nilfs_root *root, unsigned long ino); struct inode *nilfs_iget_locked(struct super_block *sb, struct nilfs_root *root, diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 2590a0860eab..b512e7728465 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -913,6 +913,7 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) struct the_nilfs *nilfs = sci->sc_super->s_fs_info; struct buffer_head *bh_cp; struct nilfs_checkpoint *raw_cp; + struct inode *ifile; int err; err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, @@ -941,8 +942,10 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) else nilfs_checkpoint_set_minor(raw_cp); - nilfs_write_inode_common(sci->sc_root->ifile, - &raw_cp->cp_ifile_inode, 1); + ifile = sci->sc_root->ifile; + nilfs_write_inode_common(ifile, &raw_cp->cp_ifile_inode); + nilfs_bmap_write(NILFS_I(ifile)->i_bmap, &raw_cp->cp_ifile_inode); + nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); return 0; @@ -977,6 +980,33 @@ static void nilfs_segctor_fill_in_file_bmap(struct nilfs_sc_info *sci) } } +/** + * nilfs_write_root_mdt_inode - export root metadata inode information to + * the on-disk inode + * @inode: inode object of the root metadata file + * @raw_inode: on-disk inode + * + * nilfs_write_root_mdt_inode() writes inode information and bmap data of + * @inode to the inode area of the metadata file allocated on the super root + * block created to finalize the log. Since super root blocks are configured + * each time, this function zero-fills the unused area of @raw_inode. + */ +static void nilfs_write_root_mdt_inode(struct inode *inode, + struct nilfs_inode *raw_inode) +{ + struct the_nilfs *nilfs = inode->i_sb->s_fs_info; + + nilfs_write_inode_common(inode, raw_inode); + + /* zero-fill unused portion of raw_inode */ + raw_inode->i_xattr = 0; + raw_inode->i_pad = 0; + memset((void *)raw_inode + sizeof(*raw_inode), 0, + nilfs->ns_inode_size - sizeof(*raw_inode)); + + nilfs_bmap_write(NILFS_I(inode)->i_bmap, raw_inode); +} + static void nilfs_segctor_fill_in_super_root(struct nilfs_sc_info *sci, struct the_nilfs *nilfs) { @@ -998,12 +1028,13 @@ static void nilfs_segctor_fill_in_super_root(struct nilfs_sc_info *sci, nilfs->ns_nongc_ctime : sci->sc_seg_ctime); raw_sr->sr_flags = 0; - nilfs_write_inode_common(nilfs->ns_dat, (void *)raw_sr + - NILFS_SR_DAT_OFFSET(isz), 1); - nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr + - NILFS_SR_CPFILE_OFFSET(isz), 1); - nilfs_write_inode_common(nilfs->ns_sufile, (void *)raw_sr + - NILFS_SR_SUFILE_OFFSET(isz), 1); + nilfs_write_root_mdt_inode(nilfs->ns_dat, (void *)raw_sr + + NILFS_SR_DAT_OFFSET(isz)); + nilfs_write_root_mdt_inode(nilfs->ns_cpfile, (void *)raw_sr + + NILFS_SR_CPFILE_OFFSET(isz)); + nilfs_write_root_mdt_inode(nilfs->ns_sufile, (void *)raw_sr + + NILFS_SR_SUFILE_OFFSET(isz)); + memset((void *)raw_sr + srsz, 0, nilfs->ns_blocksize - srsz); set_buffer_uptodate(bh_sr); unlock_buffer(bh_sr); From patchwork Mon Jan 22 14:01:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2591229dyb; Mon, 22 Jan 2024 06:07:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFc1m+tLkc7y60/SEKSoHoyCih73XdrURnJLtKt2RqVWEj9/6BHBNHBm4MSmDtCjmn1mYbB X-Received: by 2002:a05:6830:918:b0:6df:a4b2:8e58 with SMTP id v24-20020a056830091800b006dfa4b28e58mr5125168ott.55.1705932420125; Mon, 22 Jan 2024 06:07:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932420; cv=pass; d=google.com; s=arc-20160816; b=s7rXrRIHqDL5817rptjdJaGPCU8I+8CxOztWzybpBn+HdE8S+ba8TKwMOIKDmq019p UvFNuS1lS4H0P7Rn54JMxD5JXjy0w4i/dRkJ2rTXNfy80HI4OqKJqfXYQB5pKB+aWMDm nd/7J+iQQlGa7EFT9XZymGRFlIuiBLnLbUPRqOlEo8dQTVEawHLmKilQ6IiJDJqRQigY k+SHT9BOAaBI7T4ymHC9VPkyJk6Ge++ozXm0duHhTavhilZudh6l0R6S6IhuVEEWi7gu VIkMaZwH2BizXjIkZOAVjxkvjBBhvNeZbUi02zIuZclHDLNrc832fue3wDpmPHrpEOt/ Wacw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LvGoX9VOfmX4dn+RR4IR/9t7Alhj00s+830PV0mY3JA=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=04g/0EinZsPUTy1qBVsRUslLqce/Tany4zJyQYayFzkUB2vacZ2TnkukW5sd323/5e df0xOOSrwgpFIL7M/2b5RgGpLlh/j6gq7GKjegyzFyQoDclYUDKp5QHjar99FmmKfvK1 3JqDeeMMTLkrRqcsIbLwd9hZwk0C9JP/nt1fPKibArdDeb0oQs2UDEVQ6h/2PtMnWyg+ E0qhg/M1bQoYipmclHLy7qlMUgAe+HflntUGO88qDgqB96yNt/AciIN1Q+eAoG0ZbTp4 YaEpuDkx//XKZxwpXv5yx+W+5BOTDWp1gfIYw7K0GMwxZGvrVIIOkUcdKLe/EutlUyB/ igjg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gGSmUmXA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33129-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33129-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id by5-20020a056830608500b006d8a455abb7si3411088otb.20.2024.01.22.06.06.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:07:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33129-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gGSmUmXA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33129-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33129-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 17C7628B240 for ; Mon, 22 Jan 2024 14:05:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 333833EA9E; Mon, 22 Jan 2024 14:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gGSmUmXA" Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 6A9D03E497; Mon, 22 Jan 2024 14:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932156; cv=none; b=tihOtzA7jL0jlZ5Z8cASzra+8GXS+OWL95r2z9XoprCkqdv6Ib94kVx48DiIM64AhdwU087PO6TtfwHLSHO9ZfbztowVSSbhzbKH5CjE0fg+DoS6trySIf50p5VkjhUIXPHbHMUPeX6wl9KpBlaEf3D8rq5XhCtyaUGl7eOyqPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932156; c=relaxed/simple; bh=KBth+bbeg4R5PqQLpaKBQ2olW6SygwHEo2iHu/7IdXk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rtZmThhYJ4cmIYv0s6kbPusM6OYOY/uHqMPYW8V0ngfBSIQ8a0OquImpgNBuRltNSdYYxPRbxTAfuQqdwtfTfegVuXNsS2gWEl1sZtNC7/6PaEf8bZrPTI2A8MLuI7lqjnzMQakzgi7cLIUjj7AZXkzgtZhSisrnMHwbpLPNMQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gGSmUmXA; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6dbd56b5357so690291b3a.1; Mon, 22 Jan 2024 06:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932155; x=1706536955; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LvGoX9VOfmX4dn+RR4IR/9t7Alhj00s+830PV0mY3JA=; b=gGSmUmXAoa8zatoROYPYnHhGAMal2iYkflAdm9RTiR4+61X+MvPm60RsR5sDlK9o7w PhsLdbX3x+kRz0ewqT0Gbws5bOJz/fukGFxZ398Go4RcIjc0OMKEsjXgU/sEbk+FgFuZ qsB125ok6eMl3wH/JkSqS5upKXJvIuiwQFNa0P4zYMaLA/UTYdPq4BF+ezy6BNdKYWuT IDM9DcVEhBj8VI7SVS99ZmvHjmY9LirmMM8PvBHhFIT6ZfWx9ZG9mkqkVz7Us9ZZP4wB c8Ugl+axk4snGSZVLPfpHtuuu/tnlQVlHEkLNnSp91CI5mcbsWz8+74qG18vq+BaxT4C 8UUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932155; x=1706536955; 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=LvGoX9VOfmX4dn+RR4IR/9t7Alhj00s+830PV0mY3JA=; b=uIuDtUhmbQNSFu49P6+sGLnWAnHefiFiHrjV0qiAuohDRsjtSuExGXZmTWraMS4EXi YGODhM23ouY25S0XJG1XN/0wcDL9W+QKULBwdPdkDPF11FaSAlGUirq6Z1qhBU2V6uDW GFBoaKuXjwHVhw2uimUxEYHa6sZra8dGiGsbB3hdYaIDCtw21JiuzlVJaq4CFjLGbPHy fRUtVkh7fcYqXdKoa8ta6QjIwGRHgxjW+6IgmGOrRDxp/1IivISuVWH0bZzLiQlLOboK 6rBtxkh1iCVqrTnEuopzO/AZ2wyGqW/c6OblxPgztOq4NL7AXw0PM/MrTU9Ue6ZfqT2g iOWQ== X-Gm-Message-State: AOJu0Yw5jbkbWkY4i6ghPojvJX/+06xANM6Q0Q5o0QdmhRprLGI0oCRR NDMj8WF9R1d3v9OHCAoyc8KQb/aabbgoJgeleRbs30crjM+GOvwC X-Received: by 2002:a05:6a20:d48d:b0:19b:e6c5:2c97 with SMTP id im13-20020a056a20d48d00b0019be6c52c97mr1748589pzb.4.1705932153027; Mon, 22 Jan 2024 06:02:33 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:31 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/15] nilfs2: do not acquire rwsem in nilfs_bmap_write() Date: Mon, 22 Jan 2024 23:01:56 +0900 Message-Id: <20240122140202.6950-10-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799793511161903 X-GMAIL-MSGID: 1788799793511161903 It is now clear that nilfs_bmap_write() is only used to finalize logs written to disk. Concurrent bmap modification operations are not performed on bmaps in this context. Additionally, this function does not modify data used in read-only operations such as bmap lookups. Therefore, there is no need to acquire bmap->b_sem in nilfs_bmap_write(), so delete it. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/bmap.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 7a8f166f2c8d..383f0afa2cea 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c @@ -548,13 +548,10 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode) */ void nilfs_bmap_write(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode) { - down_write(&bmap->b_sem); memcpy(raw_inode->i_bmap, bmap->b_u.u_data, NILFS_INODE_BMAP_SIZE * sizeof(__le64)); if (bmap->b_inode->i_ino == NILFS_DAT_INO) bmap->b_last_allocated_ptr = NILFS_BMAP_NEW_PTR_INIT; - - up_write(&bmap->b_sem); } void nilfs_bmap_init_gc(struct nilfs_bmap *bmap) From patchwork Mon Jan 22 14:01:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2591544dyb; Mon, 22 Jan 2024 06:07:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFExZoJr3mxzIvx1Oh+Rh8bhh+6jJbfuXaYRKrKwunaniGe//YQwXpzhrq1XjOZplKOLz3M X-Received: by 2002:a05:6871:708:b0:210:79a6:fa38 with SMTP id f8-20020a056871070800b0021079a6fa38mr4219903oap.73.1705932439170; Mon, 22 Jan 2024 06:07:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932439; cv=pass; d=google.com; s=arc-20160816; b=Ph//SloYJAboLr7+ASFV4MyfKivvitvqtKazhaXw9jrGMjCrtCFFVsQ3HFKjMqIil9 iJLnUJw/Jc3xjC+A4zH3usjcg4MHR79MkrAgdjjQla4wcpgVkeJ1bp8wehRjb2rvyvE2 bg4ZbcHbTwHWDmlpkHNZxg2B43HhG5/i9CX5P9FK5j4OoRoH846hf2HN8RJCWiS71ZAD tAvTEi9JBMkJYoYVDCLZq68KB740pxQkoeuvBKtikbs0E2pYRzZu+jR/ujDronsp/C2z y5FH31MFwYMR3bp7ocLr2fNsxZn7HxvIdgrNhQE41PAYPVuSgbqfYiIzEC+42sH6EEeR s6Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PvBkLR1lVhjBBWSewqJTTBchTYH/kw10gm2qf5zMfKM=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=LdmJY19okXKcN8qWjudfg74Gq6u+z//FeLgP2WD5pxqIZSCzl3fciJY2HnTrWyS1As 9VB4ac/7O9jF3RiIYfKR0wY9TzGNPrtoITriAmThFG9PcwLXcgGnLtccBpa1UpaIjGV/ TIa0AP4ZE/6LTt8PCQ0/4/HYkx/FcoSAtZVZ/tti2lwbKS3Ac/A1q6sxlvkWjcXjOGSK hYqaa5hjtDmXO7tuRK5KnDBtyr1GHRAdZ+tLtGo0Bkme9IvmiOurMzblZ3rSV5+torZR +uKQd00qlSOf2Qgvd68LBb9Fp+MWVlY0DAvvEfVrW2UbN1T/IGtSkIoS6fM5eWROhMet bGQw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="g/F34LrP"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33130-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33130-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v9-20020a05687105c900b00214786130a6si109316oan.285.2024.01.22.06.07.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:07:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33130-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="g/F34LrP"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33130-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33130-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C217028A089 for ; Mon, 22 Jan 2024 14:05:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F350A3F8F2; Mon, 22 Jan 2024 14:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g/F34LrP" Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 BFFCD3EA87; Mon, 22 Jan 2024 14:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932159; cv=none; b=YyERmYLaXdpFnNZIfYjKFAWNWZRb2Pz3oF1nLbqCsF9f0qxEccNysuE3tZHlbhmcgThgmfLzX3W6vw6jnz7O+aTB8cPs6257AV6Bs8qnTJK1FTDHSqHNLEXpN0rrBBQ4R1A+QZuxUL2Dn5D+27gTzkn1hNpzY8LvlJRGKzLUZA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932159; c=relaxed/simple; bh=PXIW79wR4xxUjQK7k2LVAWHAMpl6SNEqE+BBtUMs9C4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UIXjX/6/9Xkmqb0/q+J+QCUqMg+gPklVJRL6Lt13zdZCboTCfJqIq4U710r4eOIhkzexziXO7LBriPxKnCoSNYvdatK37AbVdzByPSkiCuid7i6JE9EInOVtmdbZvLdaX5oEpaSE1oxUCHeOGKYj92p4tnIjucmWzrkVl/DEie4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g/F34LrP; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6daa89a6452so1869967b3a.2; Mon, 22 Jan 2024 06:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932157; x=1706536957; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PvBkLR1lVhjBBWSewqJTTBchTYH/kw10gm2qf5zMfKM=; b=g/F34LrPiNceVObdYdIe1y30VZys2rMq2yjd67wS7GO0JaR4Ox8jJvXyJ0qofTV6Zh TKfE5xHBhNfLe4J3KT/RzN4PywdBlXqpdvwKUdGUSEZQ3cs8NtBI2a4QbCb91SUBfW3f SmGNbSXeE5weiu9c1vzQhOlskbmfB9LZ3X87+R90zk0ABf5ZgCVCYmltTq+L+cFBsFcO qIhubf8pJJvUeU0IQE6dbf5AsbJt926/GMVRF/DQiPotlpa3FVpGdH5n74RBws/ozRS/ r8qgOBVTQgxtALyPns1Vu7X00wRubAlsJ226AkMOspq/xrZfKW/yZW5CIZWNnIAzukhT lQ/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932157; x=1706536957; 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=PvBkLR1lVhjBBWSewqJTTBchTYH/kw10gm2qf5zMfKM=; b=KGRNRAIoO7EQ1USkq/c7jihAsNUe0Ovypy0xMs87sVeX3ZWr8/PbxThK+LcYrcrCnf KvxdYj6eS8a5BUcJG90reYz47MBCwb+3rq1y5TE+QguZUlOfgGELc8X8v19BcE29IQIm O0qicr4HRKLXNilREOzJIupF4vPwUde1tZ0UT94KCglOr+BbZmP0Nh5AcJtfbrtaCuN9 6DLFUNabR5aoycYswzbyNB6aYDW1tQ1jrzaCgDWpdCyfH0+Dq6ADBlv7a1GC50vGGT0F hksTGuKMPYMEjkg9oCvQa9XNuvB5juAccIAUy5qkYx4hC2JO7NYsoYXTBKFImm3g+1HC qclA== X-Gm-Message-State: AOJu0YzGuSqZXVGr+jPIBRBabAm9jkLCfKiQDK67kG5YuylsvbdhWpB+ vL1tnuV76/fmyq4rry/Aw5uai8qPxxg+zsS4jdAgT1TwXpN/bgeo+EW9v6W+ X-Received: by 2002:a05:6a20:9e4a:b0:19c:4b98:5e7d with SMTP id mt10-20020a056a209e4a00b0019c4b985e7dmr529625pzb.54.1705932155673; Mon, 22 Jan 2024 06:02:35 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:34 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/15] nilfs2: convert ifile to use kmap_local Date: Mon, 22 Jan 2024 23:01:57 +0900 Message-Id: <20240122140202.6950-11-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799813300720391 X-GMAIL-MSGID: 1788799813300720391 Convert deprecated kmap() and kmap_atomic() to use kmap_local for the ifile metadata file used to manage disk inodes. In some usages, calls to kmap_local and kunmap_local are split into different helpers, but those usages can be safely changed to local thread kmap. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/ifile.c | 4 ++-- fs/nilfs2/ifile.h | 7 +++---- fs/nilfs2/inode.c | 6 +++--- fs/nilfs2/segment.c | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c index a8a4bc8490b4..e9538fa46ff2 100644 --- a/fs/nilfs2/ifile.c +++ b/fs/nilfs2/ifile.c @@ -115,11 +115,11 @@ int nilfs_ifile_delete_inode(struct inode *ifile, ino_t ino) return ret; } - kaddr = kmap_atomic(req.pr_entry_bh->b_page); + kaddr = kmap_local_page(req.pr_entry_bh->b_page); raw_inode = nilfs_palloc_block_get_entry(ifile, req.pr_entry_nr, req.pr_entry_bh, kaddr); raw_inode->i_flags = 0; - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(req.pr_entry_bh); brelse(req.pr_entry_bh); diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h index 35c5273f4821..b71ab0a81dc4 100644 --- a/fs/nilfs2/ifile.h +++ b/fs/nilfs2/ifile.h @@ -21,15 +21,14 @@ static inline struct nilfs_inode * nilfs_ifile_map_inode(struct inode *ifile, ino_t ino, struct buffer_head *ibh) { - void *kaddr = kmap(ibh->b_page); + void *kaddr = kmap_local_page(ibh->b_page); return nilfs_palloc_block_get_entry(ifile, ino, ibh, kaddr); } -static inline void nilfs_ifile_unmap_inode(struct inode *ifile, ino_t ino, - struct buffer_head *ibh) +static inline void nilfs_ifile_unmap_inode(struct nilfs_inode *raw_inode) { - kunmap(ibh->b_page); + kunmap_local(raw_inode); } int nilfs_ifile_create_inode(struct inode *, ino_t *, struct buffer_head **); diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index b9d40f5e94d3..a475095a5e80 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -520,7 +520,7 @@ static int __nilfs_read_inode(struct super_block *sb, inode, inode->i_mode, huge_decode_dev(le64_to_cpu(raw_inode->i_device_code))); } - nilfs_ifile_unmap_inode(root->ifile, ino, bh); + nilfs_ifile_unmap_inode(raw_inode); brelse(bh); up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem); nilfs_set_inode_flags(inode); @@ -529,7 +529,7 @@ static int __nilfs_read_inode(struct super_block *sb, return 0; failed_unmap: - nilfs_ifile_unmap_inode(root->ifile, ino, bh); + nilfs_ifile_unmap_inode(raw_inode); brelse(bh); bad_inode: @@ -814,7 +814,7 @@ void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags) raw_inode->i_device_code = cpu_to_le64(huge_encode_dev(inode->i_rdev)); - nilfs_ifile_unmap_inode(ifile, ino, ibh); + nilfs_ifile_unmap_inode(raw_inode); } #define NILFS_MAX_TRUNCATE_BLOCKS 16384 /* 64MB for 4KB block */ diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index b512e7728465..3657918328ea 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -966,7 +966,7 @@ static void nilfs_fill_in_file_bmap(struct inode *ifile, raw_inode = nilfs_ifile_map_inode(ifile, ii->vfs_inode.i_ino, ibh); nilfs_bmap_write(ii->i_bmap, raw_inode); - nilfs_ifile_unmap_inode(ifile, ii->vfs_inode.i_ino, ibh); + nilfs_ifile_unmap_inode(raw_inode); } } From patchwork Mon Jan 22 14:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2591419dyb; Mon, 22 Jan 2024 06:07:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQTIU0QcnBe4xBYOrzPY5tncIokwhzOkImdA/rhtosFGsirtsVF0WXXfV/WjgK9cC+sjhu X-Received: by 2002:a17:907:c30b:b0:a30:9eba:4da7 with SMTP id tl11-20020a170907c30b00b00a309eba4da7mr2043ejc.23.1705932428624; Mon, 22 Jan 2024 06:07:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932428; cv=pass; d=google.com; s=arc-20160816; b=AyWmc4txJs6ErN9I7XBVhuGvSYVhAVNzeIqkQhHj/uk7NJ2UBpJpWi4Vea/A5xlMzc I/8yfb1aw7KfX7UM9Vo9y6Yd+QsYH4KCY0pI0RLD51JF5M1V8RrZf1kXjI/6w1GI1X9e TRd6nYP2+n37X2bPI5zOVMV+81MN1HHX6CQBrK4FfATtWp1GsQmTXv9vm3wptQd5063Z CcFqTM+BGfqirNlUkFUqPgGILf5L6dWpVwOMZOVK8ul4+6sDOUIT19y6WofhdZkvP5ly wK4KRE6MfYw+O5Ug7ucU5f9t3DNS2W66MrQ+PgGZrHBfSanDQly6dyobkBgar0k2nSb0 YQng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+s+w/aJizGDBPVm90ztc+RWb/54sTDDL5EzZlenZ1mc=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=sPfeaCcorvpVO+HSr5xjmO6ZDyXzMNFAYxGgcdNy5ZM1eTn6dD2bQVznZ5Zd1mFKee 9io2p2DLF6gT7DUfHPTUElZVyESEtpgIYZJ4fXoi/qWlfbYV0J+C/05lIYCgZ3kZPlyL fqi47iWhsoKRmlvDXnXAITlP/128WJ6s35EOp6PzbCdbTHt2veurP8JWl0b5VrozFckL MBo5nyHQYq/tHRhTCIViZLaJ3Ar2kcEFUWSuAumtriH46t5/j5eNNgOeKZgTIT3m9a5L Aqxpzzf8NYp5LXy7s1weAva/krEpCwHQ0yuxJA0T+/kyjg+0CGc12X79Q8SofgHAzNV9 +hPg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="FAZCBw/M"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33131-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33131-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h22-20020a1709060f5600b00a2cd7bddad7si9302154ejj.698.2024.01.22.06.07.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:07:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33131-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="FAZCBw/M"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33131-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33131-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5D7521F22799 for ; Mon, 22 Jan 2024 14:06:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FEF43FB0D; Mon, 22 Jan 2024 14:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FAZCBw/M" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 89CBA3F8C7; Mon, 22 Jan 2024 14:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932160; cv=none; b=quS0DrIsvNgjr9h37H0Ew+1Ito0spsyhM6WAYmCgkxlPI58owAohQtj5BJY3UfDVCR5wzxfAGnOo7tPB0RK/XRkbAJng6JuWjhP15dYhT2Bf4tViOSJAgaH/NC/oWnKlmiW1iCLJ3tVZixcvD6fR4SBwqyY23s57boNKnbzDqOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932160; c=relaxed/simple; bh=e/iLIlcctS3PDZ091P5efHc5/xKQVjvmaKqlsDBvd1I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fug4qH/ad9j9Lt9mfjNgo+Ov6vH8sLByybZOJw2kRCdu9dGGB4HTRXGhc2g/jCh8JSXtQsLGSohjtCBZ1aMxiJkaCH0XI+sZgY/poqvP9CLR7RSGUHjq5kjIuvX5BEbAGQyZbKprcQoszV8zlISC6QWCH4xWu9eSsS3/IWXRpP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FAZCBw/M; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6d9b13fe9e9so2523891b3a.2; Mon, 22 Jan 2024 06:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932159; x=1706536959; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+s+w/aJizGDBPVm90ztc+RWb/54sTDDL5EzZlenZ1mc=; b=FAZCBw/MOjUiX1SZDkYx1wxJb+I5KDZIE8cf7wnQjqse869G+Snx+XIocmDrEmCrho GgjphfyIjQgFr+6xk0rctcaBzVhBtP15mraxArn257FBHCthI8HnMIoTjpL8Kxdceq4/ WzH4E4m5zYA75H2igBBo+MIfV52vvCwDO3OpSNAzgVUBJ0JJV6ZPTazAcNVxZ0HZTjWD 4fmbNnEvpGh6v8A5Yv8td0Q/iUJP6hr5WsCIjWDi58mwQo+EgLpAGH55WQaN3aE9ECyX aUOVrioqDis1BLKZasTROHgO/kOg06N124yHjUWZm6AeSn+qIcNMQEriM7JlmZMTWSDi TFxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932159; x=1706536959; 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=+s+w/aJizGDBPVm90ztc+RWb/54sTDDL5EzZlenZ1mc=; b=xVTNHs2mXH52CpIoc8hzdeFwLVwccyJuad1z37gYiTMWnwXkzOtenB2jU/aa5Prhul eYeYQpNH3SOHJiV+qbeMOKgo6bZGFlKG2onuLvTJJW6rrA3JxZFc/e8WF2EqKI29G3e7 ymucw0kZoYlZ5XOSoIc38zRhMDbbNZhml4tEykbBDuttSmbVEiJFoDsx1lrxjisD0CcH wyNzbrjk6AslzGExZrUsz2pkYdTI9qh2ab74qhKdLH1pn8Gi+MgLnBgOjsqf4ebQyfPq eNM9jg26LRZECqbzoly51gqWoW8YiXb9D8hPNdZFVaQzc6rJJvCQMyEYYO31WMdqxsu1 JJDQ== X-Gm-Message-State: AOJu0Yxz4qUj6svdfF2mDLgetKhxt+XNCFezvdmWwx6malesJ2zaG04C UB5rTUZUlatxCou39nsCKk0mT/qxWf9/yVyUrrGrgvXZiRtEZNa3M7TFgM3x X-Received: by 2002:a05:6a00:23d6:b0:6db:cb94:e8d3 with SMTP id g22-20020a056a0023d600b006dbcb94e8d3mr6146035pfc.23.1705932158820; Mon, 22 Jan 2024 06:02:38 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:36 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/15] nilfs2: localize highmem mapping for checkpoint creation within cpfile Date: Mon, 22 Jan 2024 23:01:58 +0900 Message-Id: <20240122140202.6950-12-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799802138839230 X-GMAIL-MSGID: 1788799802138839230 In order to convert kmap() used in cpfile to kmap_local, first move the checkpoint creation routine, which is one of the places where kmap is used, to the cpfile side and make the page mapping local and temporary. And use kmap_local instead of kmap to access the checkpoint entry page (and header block page) when generating a checkpoint. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/cpfile.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ fs/nilfs2/cpfile.h | 1 + fs/nilfs2/segment.c | 31 ++----------------- 3 files changed, 77 insertions(+), 29 deletions(-) diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 39136637f715..f62da80e530a 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c @@ -272,6 +272,80 @@ int nilfs_cpfile_get_checkpoint(struct inode *cpfile, return ret; } +/** + * nilfs_cpfile_create_checkpoint - create a checkpoint entry on cpfile + * @cpfile: checkpoint file inode + * @cno: number of checkpoint to set up + * + * This function creates a checkpoint with the number specified by @cno on + * cpfile. If the specified checkpoint entry already exists due to a past + * failure, it will be reused without returning an error. + * In either case, the buffer of the block containing the checkpoint entry + * and the cpfile inode are made dirty for inclusion in the write log. + * + * Return: 0 on success, or the following negative error code on failure. + * * %-ENOMEM - Insufficient memory available. + * * %-EIO - I/O error (including metadata corruption). + * * %-EROFS - Read only filesystem + */ +int nilfs_cpfile_create_checkpoint(struct inode *cpfile, __u64 cno) +{ + struct buffer_head *header_bh, *cp_bh; + struct nilfs_cpfile_header *header; + struct nilfs_checkpoint *cp; + void *kaddr; + int ret; + + if (WARN_ON_ONCE(cno < 1)) + return -EIO; + + down_write(&NILFS_MDT(cpfile)->mi_sem); + ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); + if (unlikely(ret < 0)) { + if (ret == -ENOENT) { + nilfs_error(cpfile->i_sb, + "checkpoint creation failed due to metadata corruption."); + ret = -EIO; + } + goto out_sem; + } + ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 1, &cp_bh); + if (unlikely(ret < 0)) + goto out_header; + + kaddr = kmap_local_page(cp_bh->b_page); + cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); + if (nilfs_checkpoint_invalid(cp)) { + /* a newly-created checkpoint */ + nilfs_checkpoint_clear_invalid(cp); + if (!nilfs_cpfile_is_in_first(cpfile, cno)) + nilfs_cpfile_block_add_valid_checkpoints(cpfile, cp_bh, + kaddr, 1); + kunmap_local(kaddr); + + kaddr = kmap_local_page(header_bh->b_page); + header = nilfs_cpfile_block_get_header(cpfile, header_bh, + kaddr); + le64_add_cpu(&header->ch_ncheckpoints, 1); + kunmap_local(kaddr); + mark_buffer_dirty(header_bh); + } else { + kunmap_local(kaddr); + } + + /* Force the buffer and the inode to become dirty */ + mark_buffer_dirty(cp_bh); + brelse(cp_bh); + nilfs_mdt_mark_dirty(cpfile); + +out_header: + brelse(header_bh); + +out_sem: + up_write(&NILFS_MDT(cpfile)->mi_sem); + return ret; +} + /** * nilfs_cpfile_put_checkpoint - put a checkpoint * @cpfile: inode of checkpoint file diff --git a/fs/nilfs2/cpfile.h b/fs/nilfs2/cpfile.h index edabb2dc5756..fcb1a94097b3 100644 --- a/fs/nilfs2/cpfile.h +++ b/fs/nilfs2/cpfile.h @@ -19,6 +19,7 @@ int nilfs_cpfile_get_checkpoint(struct inode *, __u64, int, struct nilfs_checkpoint **, struct buffer_head **); +int nilfs_cpfile_create_checkpoint(struct inode *cpfile, __u64 cno); void nilfs_cpfile_put_checkpoint(struct inode *, __u64, struct buffer_head *); int nilfs_cpfile_delete_checkpoints(struct inode *, __u64, __u64); int nilfs_cpfile_delete_checkpoint(struct inode *, __u64); diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 3657918328ea..37d06eacec63 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -880,34 +880,6 @@ static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci) nilfs_mdt_clear_dirty(nilfs->ns_dat); } -static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci) -{ - struct the_nilfs *nilfs = sci->sc_super->s_fs_info; - struct buffer_head *bh_cp; - struct nilfs_checkpoint *raw_cp; - int err; - - /* XXX: this interface will be changed */ - err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 1, - &raw_cp, &bh_cp); - if (likely(!err)) { - /* - * The following code is duplicated with cpfile. But, it is - * needed to collect the checkpoint even if it was not newly - * created. - */ - mark_buffer_dirty(bh_cp); - nilfs_mdt_mark_dirty(nilfs->ns_cpfile); - nilfs_cpfile_put_checkpoint( - nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); - } else if (err == -EINVAL || err == -ENOENT) { - nilfs_error(sci->sc_super, - "checkpoint creation failed due to metadata corruption."); - err = -EIO; - } - return err; -} - static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) { struct the_nilfs *nilfs = sci->sc_super->s_fs_info; @@ -1261,7 +1233,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode) break; nilfs_sc_cstage_inc(sci); /* Creating a checkpoint */ - err = nilfs_segctor_create_checkpoint(sci); + err = nilfs_cpfile_create_checkpoint(nilfs->ns_cpfile, + nilfs->ns_cno); if (unlikely(err)) break; fallthrough; From patchwork Mon Jan 22 14:01:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2591835dyb; Mon, 22 Jan 2024 06:07:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiMlWr8zXTTy/Bl43MKP4h4BRhbf9f+asgjzZgMWYSZKZqrX++LzLh6lhXcT8FWRpHWPtE X-Received: by 2002:a05:6122:3626:b0:4b7:2382:b4 with SMTP id du6-20020a056122362600b004b7238200b4mr2636025vkb.6.1705932461959; Mon, 22 Jan 2024 06:07:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932461; cv=pass; d=google.com; s=arc-20160816; b=Xct5qRsk30soQ4jNoqCFbZ0Ll1/a7Phf67Dk80jJebPmYWAkCeZys+UWVPNHdEQ8nX EEDj3F55ZPw0i7TZmpmQuydL+5ljk8BkcrzPpaswQfsq1+FE6gCL8jugzDQg0f7wI/+v 1vzED3QgMbfpXUe3tC5kTS0uJJBIZuqQIpxU43HTanQSbin4WFKC/Eib7h9KH91IA6Zc NL4tmyqymONAGvJiwftjCq9bJlKsqj0XW2ujnBIGQkHGzp5IEi3Vfa2uLpB8NyF6grDS BSs/7iTuIcULAMIQEE76lFN9L6/mEnaW61qMglr8eOnE0eTbi+tLZg1CCo3cX8jjEohm Mokw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SwcnEI8d06MKkzqOiryGzrgEAR3rkNftR1wOMkqp6nU=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=XBfxCG9sRs1ggJOdXsDvhZONnia0bAMOW0p1Z5GJpV3k56d1C4UEt88c3g13m9uQOy lbK5PEV/bNIv3eKhFL5lMNq1wSELNuzefX7gySi8oEdMionrdXDpZNjxkV/KP518MOTj +1Z51A2LyJe9SuVn7A8F6a0OskSLwMhPxwC38izhT0dtLTZdeqHdIQRFTYjPTfh1Rbmq BCDsdKyOILeoEGRartjR1comwsC3yy7Y7Lr8qvEToGyIv6Y6MEbHld25kzMCR34XG/0m XC+k9Mxpmn+ncih9niQlenbDSj3DxJyLDTLA+1e7QJO4vkvSaYvKbwxSzGEA1jYvTNWy MXqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ITwtnguZ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33132-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33132-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bc12-20020a0561220d8c00b004b755faf62bsi2856297vkb.270.2024.01.22.06.07.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33132-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ITwtnguZ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33132-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33132-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F3CA91C24411 for ; Mon, 22 Jan 2024 14:06:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B99403FB28; Mon, 22 Jan 2024 14:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ITwtnguZ" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 E82583F8F0; Mon, 22 Jan 2024 14:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932163; cv=none; b=E3xqaWJao2V/PRct4P803EQu58SwZUmzGNs7gusEmQcv19WV4KmUbjIvXlgIg5p18LWhFTYZ1kCjX1yTbUtW8IZOaQHXyUaI1WXp2Zti+HQEHJRCC+TP/34UwswD/7dNiEovaDyuT3JzdWlhMaoCL5Sm4Aqk3xT6uCGKkPRqcgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932163; c=relaxed/simple; bh=p/yd1EZVbBYz8Cn1Wm0AFG+QOuhgUVMQeApB8P/8MYc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ehDu/hKp9qqhYTkWsKh7IyDV58MIAU0iqHqBN21De2VZUwvmppx8KBJKL99lGawMa+FkP/xfM7/C+SHrsLnTrMw8fFUQWd1m4DuOjufJ6pdTl8snurvf2YwXFvN9tWkzB9yqvrrxNRWLdGwUbIVpslpakAvhZlCvBfYIQ+2bvhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ITwtnguZ; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6dbb003be79so2814924b3a.0; Mon, 22 Jan 2024 06:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932161; x=1706536961; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SwcnEI8d06MKkzqOiryGzrgEAR3rkNftR1wOMkqp6nU=; b=ITwtnguZSd9VQREgCvWunsoRh9MqtFx4w3Z8gL3mui1pHGsKpq8vv4nxeDATkkvOEq 2591Ie3Gc0KdnMPj3ZMOYjQKuS8Nc0qt7XuXEPpRqz2H70iDglmhNrtAxf/o67ltEqMW Mgj4Bolj37kw6IbAWPEpBcm7ykWbMQOM92GCYisl4XVis0Jiyr76TuybNLPqQMgJUoF9 p6mCxI5T4GqPZyH8c10S9QZQMrQx6B6doOe+SLwutfXdbRcg9JWZL7OWgqZB9pjWv2K6 3Oam8efbXd2ktkd4CviBrH5NXsfnZQQlXNMs5EUZErUaiZVz9nmGfRYHwZ3jeAgnYgOr j8nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932161; x=1706536961; 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=SwcnEI8d06MKkzqOiryGzrgEAR3rkNftR1wOMkqp6nU=; b=cWcql9TAXg5bQOq5ZhOnsQP3hqHYWXuT/kGeT71wv4ca5Vdv7dWDRzsvM2iKPh1En/ oebqIqXbXPAUeSrMIdkPWR4zXsz0HyJu89Qx5G0lnjDpJHjp1vF66W3smEtDRpRQfjDp x1PLNi/VL8tXB6qhuUXBs8xwhwYVYzJZ/+kizQjbiLBWTj/4ZqCUqSVKoFGiwLXmR7/Z XlJhAIYUW8PC8ya+BMqFmfLgL2zf6q9xiHVBSeon9I7gpjmdsJBmbn4k344D8FFXUHh+ VBLG2iWvKl0AUhqKJvi7p5V9nNZS+oQn9F/bJbyaua8LhvngV5qiy986R2Y2I195qqNT +iDA== X-Gm-Message-State: AOJu0Yw1F56XtfeMMi/fhHHKlS6+/BNAT9zsDOFqCnwmUE2lgcHlnnbh YkjCsULfyCgFi8RcJYxquLz4+KgQMBy9soa1R9JLI2LoHFLcV58wEtBEWqCG X-Received: by 2002:a05:6a20:72a9:b0:19c:4d16:4d3c with SMTP id o41-20020a056a2072a900b0019c4d164d3cmr1163931pzk.29.1705932161296; Mon, 22 Jan 2024 06:02:41 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:40 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/15] nilfs2: localize highmem mapping for checkpoint finalization within cpfile Date: Mon, 22 Jan 2024 23:01:59 +0900 Message-Id: <20240122140202.6950-13-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799836887333263 X-GMAIL-MSGID: 1788799836887333263 Move the checkpoint finalization routine to the cpfile side, and make the page mapping local and temporary. And use kmap_local instead of kmap to access the checkpoint entry page when finalizing a checkpoint. In this conversion, some of the information on the checkpoint entry being rewritten is passed through the arguments of the newly added method nilfs_cpfile_finalize_checkpoint(). Signed-off-by: Ryusuke Konishi --- fs/nilfs2/cpfile.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ fs/nilfs2/cpfile.h | 3 ++ fs/nilfs2/segment.c | 51 +++---------------------------- 3 files changed, 82 insertions(+), 46 deletions(-) diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index f62da80e530a..3af77252e081 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c @@ -363,6 +363,80 @@ void nilfs_cpfile_put_checkpoint(struct inode *cpfile, __u64 cno, brelse(bh); } +/** + * nilfs_cpfile_finalize_checkpoint - fill in a checkpoint entry in cpfile + * @cpfile: checkpoint file inode + * @cno: checkpoint number + * @root: nilfs root object + * @blkinc: number of blocks added by this checkpoint + * @ctime: checkpoint creation time + * @minor: minor checkpoint flag + * + * This function completes the checkpoint entry numbered by @cno in the + * cpfile with the data given by the arguments @root, @blkinc, @ctime, and + * @minor. + * + * Return: 0 on success, or the following negative error code on failure. + * * %-ENOMEM - Insufficient memory available. + * * %-EIO - I/O error (including metadata corruption). + */ +int nilfs_cpfile_finalize_checkpoint(struct inode *cpfile, __u64 cno, + struct nilfs_root *root, __u64 blkinc, + time64_t ctime, bool minor) +{ + struct buffer_head *cp_bh; + struct nilfs_checkpoint *cp; + void *kaddr; + int ret; + + if (WARN_ON_ONCE(cno < 1)) + return -EIO; + + down_write(&NILFS_MDT(cpfile)->mi_sem); + ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); + if (unlikely(ret < 0)) { + if (ret == -ENOENT) + goto error; + goto out_sem; + } + + kaddr = kmap_local_page(cp_bh->b_page); + cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); + if (unlikely(nilfs_checkpoint_invalid(cp))) { + kunmap_local(kaddr); + brelse(cp_bh); + goto error; + } + + cp->cp_snapshot_list.ssl_next = 0; + cp->cp_snapshot_list.ssl_prev = 0; + cp->cp_inodes_count = cpu_to_le64(atomic64_read(&root->inodes_count)); + cp->cp_blocks_count = cpu_to_le64(atomic64_read(&root->blocks_count)); + cp->cp_nblk_inc = cpu_to_le64(blkinc); + cp->cp_create = cpu_to_le64(ctime); + cp->cp_cno = cpu_to_le64(cno); + + if (minor) + nilfs_checkpoint_set_minor(cp); + else + nilfs_checkpoint_clear_minor(cp); + + nilfs_write_inode_common(root->ifile, &cp->cp_ifile_inode); + nilfs_bmap_write(NILFS_I(root->ifile)->i_bmap, &cp->cp_ifile_inode); + + kunmap_local(kaddr); + brelse(cp_bh); +out_sem: + up_write(&NILFS_MDT(cpfile)->mi_sem); + return ret; + +error: + nilfs_error(cpfile->i_sb, + "checkpoint finalization failed due to metadata corruption."); + ret = -EIO; + goto out_sem; +} + /** * nilfs_cpfile_delete_checkpoints - delete checkpoints * @cpfile: inode of checkpoint file diff --git a/fs/nilfs2/cpfile.h b/fs/nilfs2/cpfile.h index fcb1a94097b3..aa1408a3af01 100644 --- a/fs/nilfs2/cpfile.h +++ b/fs/nilfs2/cpfile.h @@ -21,6 +21,9 @@ int nilfs_cpfile_get_checkpoint(struct inode *, __u64, int, struct buffer_head **); int nilfs_cpfile_create_checkpoint(struct inode *cpfile, __u64 cno); void nilfs_cpfile_put_checkpoint(struct inode *, __u64, struct buffer_head *); +int nilfs_cpfile_finalize_checkpoint(struct inode *cpfile, __u64 cno, + struct nilfs_root *root, __u64 blkinc, + time64_t ctime, bool minor); int nilfs_cpfile_delete_checkpoints(struct inode *, __u64, __u64); int nilfs_cpfile_delete_checkpoint(struct inode *, __u64); int nilfs_cpfile_change_cpmode(struct inode *, __u64, int); diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 37d06eacec63..ecf778f44bbc 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -880,51 +880,6 @@ static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci) nilfs_mdt_clear_dirty(nilfs->ns_dat); } -static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) -{ - struct the_nilfs *nilfs = sci->sc_super->s_fs_info; - struct buffer_head *bh_cp; - struct nilfs_checkpoint *raw_cp; - struct inode *ifile; - int err; - - err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, - &raw_cp, &bh_cp); - if (unlikely(err)) { - if (err == -EINVAL || err == -ENOENT) { - nilfs_error(sci->sc_super, - "checkpoint finalization failed due to metadata corruption."); - err = -EIO; - } - goto failed_ibh; - } - raw_cp->cp_snapshot_list.ssl_next = 0; - raw_cp->cp_snapshot_list.ssl_prev = 0; - raw_cp->cp_inodes_count = - cpu_to_le64(atomic64_read(&sci->sc_root->inodes_count)); - raw_cp->cp_blocks_count = - cpu_to_le64(atomic64_read(&sci->sc_root->blocks_count)); - raw_cp->cp_nblk_inc = - cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); - raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); - raw_cp->cp_cno = cpu_to_le64(nilfs->ns_cno); - - if (test_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags)) - nilfs_checkpoint_clear_minor(raw_cp); - else - nilfs_checkpoint_set_minor(raw_cp); - - ifile = sci->sc_root->ifile; - nilfs_write_inode_common(ifile, &raw_cp->cp_ifile_inode); - nilfs_bmap_write(NILFS_I(ifile)->i_bmap, &raw_cp->cp_ifile_inode); - - nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); - return 0; - - failed_ibh: - return err; -} - static void nilfs_fill_in_file_bmap(struct inode *ifile, struct nilfs_inode_info *ii) @@ -2103,7 +2058,11 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode) if (mode == SC_LSEG_SR && nilfs_sc_cstage_get(sci) >= NILFS_ST_CPFILE) { - err = nilfs_segctor_fill_in_checkpoint(sci); + err = nilfs_cpfile_finalize_checkpoint( + nilfs->ns_cpfile, nilfs->ns_cno, sci->sc_root, + sci->sc_nblk_inc + sci->sc_nblk_this_inc, + sci->sc_seg_ctime, + !test_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags)); if (unlikely(err)) goto failed_to_write; From patchwork Mon Jan 22 14:02:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2592150dyb; Mon, 22 Jan 2024 06:08:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZR8jBGvNuwbicIwR2XKJBHIIEYH8DZfEvbcLUdh+SQ0CepY3ZguVvHdPuZwUwaCPBu/1W X-Received: by 2002:a17:902:e803:b0:1d7:3ea0:afa5 with SMTP id u3-20020a170902e80300b001d73ea0afa5mr4211719plg.47.1705932484743; Mon, 22 Jan 2024 06:08:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932484; cv=pass; d=google.com; s=arc-20160816; b=Hgas+DVKIRMaWeX/3raR7OH7tMoJu8Oh2eVAE/2xfqCiSnjJ+HwP99Q/diChRk5mG6 dsDb+bpEH5bquDvKArhdY6D23oKTDNfklhV21RoWxddEq14rj7dyV/6jp7Hvzjmcd7MX Qrb5prshl4VKCMfMFLMkCFv2UUs6N3HcYLojhg0HkBLLJmd8W/jJVV3BfjAkMfqwVuBR X0Jspp+xxgxIUv+NGnrPXzkW3AX0gk6mSEH2gdELh8FegQhsIHevyITIcqqs+byzIxjO 6DfnVnmmsTEo7/R5MQrVBYNvvZVpeHwRBSIHGQeqDT2ZNfbrBcwgrH73Zwvv42am6ohi tunQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=toceYKuZw57Tb3AnyUgBAG/I6VP3Dk2Ys2J2hjEm8Zk=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=Rxqr91tvl1bAj/+MUFb/rmAUae0heuT82kWxjUF1DCI0OUb1gBMNmj9aW1lO2uFAEY 97dEQ1AF3wOSDD9sqGf5nOBGL/rvuwxyhh3pg79KwrWTKSx/BL5Rkd3w6qgVL7fXRBNk S11wi4Ifh1TM+BPwYVYVviXNtiZDAx+X/q/V7aU6+RTTkF6MFAFaMsXPvAwIF1CvBcSb DSRbp7v5E118S6QqTyqCVQ3t4LuqLb3v97oVBoLiEVVaSfKFrmPK9P6CGDEl5DFhAEDc T6R/xZE7f38iNjaHABRMOUkfp8ueBD8/CTdRRSyKRDrVFiQs/reATx5ylVi+NzqPNyim AnuA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WfVDWldh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33133-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33133-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e18-20020a17090301d200b001d40906a0d5si8457583plh.502.2024.01.22.06.08.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:08:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33133-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WfVDWldh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33133-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33133-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E31D428EA3D for ; Mon, 22 Jan 2024 14:06:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE0C23FE28; Mon, 22 Jan 2024 14:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WfVDWldh" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 A08613FB15; Mon, 22 Jan 2024 14:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932166; cv=none; b=GMuh+fPvQEnugdzpZx7FvQRsZxdoDXRtmU1SjbQzqI778170o2vTuDhSTm7bQ2HHsilbeTdCjJEm5i+HVcBDCQFx6AKnby+SORUTbMcwf+MOd5OUKGOlHQAijHdL0sXHlL9CDxczzvrqbBf8ncPGTQF4Mr94y2pdLPaoF7Aup60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932166; c=relaxed/simple; bh=RvX1yH3PhG5hvyZ0xNP55eRwWEtASwgMOXVneFnR+f0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=soeDS0Re3FU9YEzO4BG7QGzJVYwSc/GmSYBxkrf4N23JObfE4pdLSgx1EMuoXxeOp3IwpflCjHk1b1aouBqj4L95Nk+yR937/tkEqbH+z0d4/ARUcrmorE6FZ2v9KVtNTQhPN8JCAuKYZ1rzLB8fwnUH9MsUo/KH91WXngxEn8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WfVDWldh; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6dbd7f1a300so1523927b3a.1; Mon, 22 Jan 2024 06:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932164; x=1706536964; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=toceYKuZw57Tb3AnyUgBAG/I6VP3Dk2Ys2J2hjEm8Zk=; b=WfVDWldhhlDfZYfUeGTP0eJhhrGLxemibp/KzYV9CwwB7OTHIfJq2vfM3XBppQ8ru+ uA1D8s0YwX0lao/a3KuflsXbQnUbNhAPJymsc9nYJ0cljuBhJi79BpL0mja6+SdHtdVb B57GUcSlBetGCP1x6a67AnMpaahuXI9oeBN6lgnPluZEWHZG+Eh2wyEgsn2hP/cP8wMo SX7etFP85xYEolSo0j26AqXCAHkoU5b6ojzlZ1+o8bqaUEOLgtpImU4J4e3LJxBy981C W89JGQlbMT6HdcAI7lvWfcjfytwIyZooVgU0bl2JS2RwlvOm/Tpt1jrOtzg35JNeCRte ClNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932164; x=1706536964; 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=toceYKuZw57Tb3AnyUgBAG/I6VP3Dk2Ys2J2hjEm8Zk=; b=TwmlBNLbmV0955VVr1+kRldVTsAdx5nc5IrnU88NWh/mcxmGi2g2T1IykP9yi9mRU9 qM5hHLDdSy93ZGI8mGPty8fAIbZlcjSGnowkRp3mYYx8I78iEGh4gyhq8yj3OrWz55X6 vogm6ZFhHrE8dVtkOTizFFqyo7kPYfv+o0F12D0Vi3F1068kC8/j9vrKyN2hQNoHpZ8l OeTgtxF7y63i+CMHpigqYjVW3IwGVc9/Qdai8TKgFxCG7TrPOp2WAGhIKwJoiqI/Ybmn sqxdD3h2s3tecS3alc/8incRGvE7IJCX5Wf1cgy37L7JfuJ5X+1RbOlDtr11emJQ5Po3 C+mA== X-Gm-Message-State: AOJu0Yx18VFqEgANqN+l/RAYAhQQjXxbAbclbGkP3+FGABCyZ7ZQz4bA QJzcrsFZ9ofOlkRULhrRtS9tIeTiR30u6zBmZ2OQcP9T4ml+A5Uiq+nsV1+I X-Received: by 2002:a05:6a20:7fa0:b0:19b:5f7:e142 with SMTP id d32-20020a056a207fa000b0019b05f7e142mr5930524pzj.30.1705932163878; Mon, 22 Jan 2024 06:02:43 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:42 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/15] nilfs2: localize highmem mapping for checkpoint reading within cpfile Date: Mon, 22 Jan 2024 23:02:00 +0900 Message-Id: <20240122140202.6950-14-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799861209893754 X-GMAIL-MSGID: 1788799861209893754 Move the code for reading from a checkpoint entry that is performed in nilfs_attach_checkpoint() to the cpfile side, and make the page mapping local and temporary. And use kmap_local instead of kmap to access the checkpoint entry page. In order to load the ifile inode information included in the checkpoint entry within the inode lock section of nilfs_ifile_read(), the newly added checkpoint reading method nilfs_cpfile_read_checkpoint() is called indirectly via nilfs_ifile_read() instead of from nilfs_attach_checkpoint(). Signed-off-by: Ryusuke Konishi --- fs/nilfs2/cpfile.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++ fs/nilfs2/cpfile.h | 2 ++ fs/nilfs2/ifile.c | 17 ++++++++---- fs/nilfs2/ifile.h | 3 +- fs/nilfs2/super.c | 31 ++++----------------- 5 files changed, 87 insertions(+), 34 deletions(-) diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 3af77252e081..56e38843536b 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c @@ -186,6 +186,74 @@ static inline int nilfs_cpfile_delete_checkpoint_block(struct inode *cpfile, nilfs_cpfile_get_blkoff(cpfile, cno)); } +/** + * nilfs_cpfile_read_checkpoint - read a checkpoint entry in cpfile + * @cpfile: checkpoint file inode + * @cno: number of checkpoint entry to read + * @root: nilfs root object + * @ifile: ifile's inode to read and attach to @root + * + * This function imports checkpoint information from the checkpoint file and + * stores it to the inode file given by @ifile and the nilfs root object + * given by @root. + * + * Return: 0 on success, or the following negative error code on failure. + * * %-EINVAL - Invalid checkpoint. + * * %-ENOMEM - Insufficient memory available. + * * %-EIO - I/O error (including metadata corruption). + */ +int nilfs_cpfile_read_checkpoint(struct inode *cpfile, __u64 cno, + struct nilfs_root *root, struct inode *ifile) +{ + struct buffer_head *cp_bh; + struct nilfs_checkpoint *cp; + void *kaddr; + int ret; + + if (cno < 1 || cno > nilfs_mdt_cno(cpfile)) + return -EINVAL; + + down_read(&NILFS_MDT(cpfile)->mi_sem); + ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); + if (unlikely(ret < 0)) { + if (ret == -ENOENT) + ret = -EINVAL; + goto out_sem; + } + + kaddr = kmap_local_page(cp_bh->b_page); + cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); + if (nilfs_checkpoint_invalid(cp)) { + ret = -EINVAL; + goto put_cp; + } + + ret = nilfs_read_inode_common(ifile, &cp->cp_ifile_inode); + if (unlikely(ret)) { + /* + * Since this inode is on a checkpoint entry, treat errors + * as metadata corruption. + */ + nilfs_err(cpfile->i_sb, + "ifile inode (checkpoint number=%llu) corrupted", + (unsigned long long)cno); + ret = -EIO; + goto put_cp; + } + + /* Configure the nilfs root object */ + atomic64_set(&root->inodes_count, le64_to_cpu(cp->cp_inodes_count)); + atomic64_set(&root->blocks_count, le64_to_cpu(cp->cp_blocks_count)); + root->ifile = ifile; + +put_cp: + kunmap_local(kaddr); + brelse(cp_bh); +out_sem: + up_read(&NILFS_MDT(cpfile)->mi_sem); + return ret; +} + /** * nilfs_cpfile_get_checkpoint - get a checkpoint * @cpfile: inode of checkpoint file diff --git a/fs/nilfs2/cpfile.h b/fs/nilfs2/cpfile.h index aa1408a3af01..2cfa14011bc8 100644 --- a/fs/nilfs2/cpfile.h +++ b/fs/nilfs2/cpfile.h @@ -19,6 +19,8 @@ int nilfs_cpfile_get_checkpoint(struct inode *, __u64, int, struct nilfs_checkpoint **, struct buffer_head **); +int nilfs_cpfile_read_checkpoint(struct inode *cpfile, __u64 cno, + struct nilfs_root *root, struct inode *ifile); int nilfs_cpfile_create_checkpoint(struct inode *cpfile, __u64 cno); void nilfs_cpfile_put_checkpoint(struct inode *, __u64, struct buffer_head *); int nilfs_cpfile_finalize_checkpoint(struct inode *cpfile, __u64 cno, diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c index e9538fa46ff2..612e609158b5 100644 --- a/fs/nilfs2/ifile.c +++ b/fs/nilfs2/ifile.c @@ -15,6 +15,7 @@ #include "mdt.h" #include "alloc.h" #include "ifile.h" +#include "cpfile.h" /** * struct nilfs_ifile_info - on-memory private data of ifile @@ -173,14 +174,18 @@ int nilfs_ifile_count_free_inodes(struct inode *ifile, * nilfs_ifile_read - read or get ifile inode * @sb: super block instance * @root: root object + * @cno: number of checkpoint entry to read * @inode_size: size of an inode - * @raw_inode: on-disk ifile inode - * @inodep: buffer to store the inode + * + * Return: 0 on success, or the following negative error code on failure. + * * %-EINVAL - Invalid checkpoint. + * * %-ENOMEM - Insufficient memory available. + * * %-EIO - I/O error (including metadata corruption). */ int nilfs_ifile_read(struct super_block *sb, struct nilfs_root *root, - size_t inode_size, struct nilfs_inode *raw_inode, - struct inode **inodep) + __u64 cno, size_t inode_size) { + struct the_nilfs *nilfs; struct inode *ifile; int err; @@ -201,13 +206,13 @@ int nilfs_ifile_read(struct super_block *sb, struct nilfs_root *root, nilfs_palloc_setup_cache(ifile, &NILFS_IFILE_I(ifile)->palloc_cache); - err = nilfs_read_inode_common(ifile, raw_inode); + nilfs = sb->s_fs_info; + err = nilfs_cpfile_read_checkpoint(nilfs->ns_cpfile, cno, root, ifile); if (err) goto failed; unlock_new_inode(ifile); out: - *inodep = ifile; return 0; failed: iget_failed(ifile); diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h index b71ab0a81dc4..625545cc2a98 100644 --- a/fs/nilfs2/ifile.h +++ b/fs/nilfs2/ifile.h @@ -38,7 +38,6 @@ int nilfs_ifile_get_inode_block(struct inode *, ino_t, struct buffer_head **); int nilfs_ifile_count_free_inodes(struct inode *, u64 *, u64 *); int nilfs_ifile_read(struct super_block *sb, struct nilfs_root *root, - size_t inode_size, struct nilfs_inode *raw_inode, - struct inode **inodep); + __u64 cno, size_t inode_size); #endif /* _NILFS_IFILE_H */ diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index df8674173b22..5e630c179a1e 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -544,8 +544,6 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, { struct the_nilfs *nilfs = sb->s_fs_info; struct nilfs_root *root; - struct nilfs_checkpoint *raw_cp; - struct buffer_head *bh_cp; int err = -ENOMEM; root = nilfs_find_or_create_root( @@ -557,38 +555,19 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, goto reuse; /* already attached checkpoint */ down_read(&nilfs->ns_segctor_sem); - err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, - &bh_cp); + err = nilfs_ifile_read(sb, root, cno, nilfs->ns_inode_size); up_read(&nilfs->ns_segctor_sem); - if (unlikely(err)) { - if (err == -ENOENT || err == -EINVAL) { - nilfs_err(sb, - "Invalid checkpoint (checkpoint number=%llu)", - (unsigned long long)cno); - err = -EINVAL; - } + if (unlikely(err)) goto failed; - } - - err = nilfs_ifile_read(sb, root, nilfs->ns_inode_size, - &raw_cp->cp_ifile_inode, &root->ifile); - if (err) - goto failed_bh; - - atomic64_set(&root->inodes_count, - le64_to_cpu(raw_cp->cp_inodes_count)); - atomic64_set(&root->blocks_count, - le64_to_cpu(raw_cp->cp_blocks_count)); - - nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); reuse: *rootp = root; return 0; - failed_bh: - nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); failed: + if (err == -EINVAL) + nilfs_err(sb, "Invalid checkpoint (checkpoint number=%llu)", + (unsigned long long)cno); nilfs_put_root(root); return err; From patchwork Mon Jan 22 14:02:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2592091dyb; Mon, 22 Jan 2024 06:07:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGO8avibIsofWTOfu6sYje6a13T5kLHeM7tZXQmeUDJzHyvT4U3uqL0vnq2ty2MaJUgjBq X-Received: by 2002:a05:622a:5d1:b0:42a:1437:fff2 with SMTP id d17-20020a05622a05d100b0042a1437fff2mr8311143qtb.22.1705932479387; Mon, 22 Jan 2024 06:07:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932479; cv=pass; d=google.com; s=arc-20160816; b=XaKxY2KeiDIACqoKGfAgaVlQd0g4m/FAdggdRakfES5OZY+AVU4LtgpCYm1BCILeuB MQcF7p2Ii0crheRcV1vx3z2xTJ9y9bdrl5X4Sc3advplhPz0DaA9ptrPRNUSdAUSVSsx zakTn9bxZ6gqQnA1JaTqrmrKA/y+z7o7l4XWgjjNCtc8V4lGfeKgWT0s19+4zkq5zt84 G+O8B69UKQzK5OJleaf0PFMWNBSDz8dOfQAVZV3mdORBA02K447lXv2ARoqfdybetcs3 zTKfT4h0wWr3yS0Ran/7vhlA4IBz4R4vL0iZccXOeIAsWeQDKcpALXGGzIQBAJVUqtfJ Zr5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qNNrnAa4IIXxXXOYnbFPbhlz1T+5lQN7PRlkG9jiVX0=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=ggM8jTGMuIgUZhQVNTANHQeJRG0pRIDhu2zCtfs117JL02G3KbMffhbTg9kAeGTLuX OGqVl/gKD0IQV7LXaaCFkNfsq4lXJvEJ1/1AutKWMB+boQpCQQvkPPm055SSgs1D6Ou6 KGDYPFhKnDmVvswPq1EJtk2fi6F4zXdJ46XhMcrEmWnDtH+nLalipPnsOkiOUKAd7H1A powc09oWQAm44frx9LeaQsf6OdbhZQido93Z48Ck3qklZXRFFTZPkNWmhGqv45KdOkfS 8VSu5RMzeES1h98m1flIi+XFRu0mVKJejSUK27mg40u0A2qG99EMFoRylALiUPzUT1Kd ppRQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CaeiRGNl; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33134-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33134-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o1-20020a05622a008100b0042a44f71dfdsi949366qtw.512.2024.01.22.06.07.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:07:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33134-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CaeiRGNl; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33134-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33134-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 041F51C24F47 for ; Mon, 22 Jan 2024 14:06:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1A183FE3E; Mon, 22 Jan 2024 14:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CaeiRGNl" Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 5C3A93D554; Mon, 22 Jan 2024 14:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932168; cv=none; b=cVKO/wyrSn+dyxZWDipzlpPViKp/cq+0KCkfzxq2TyH7/cgqkojP5j3+3rUd7/Y0064ffzK3bHIhl/ePQ8NFzkv1B9njVWvMdm2MLrgxO4kjb70dHyZwfmR6A34M3s8CxlmsQf74VSr5eL9dYGJl+DbM1UFPAB786Q5IkflDvo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932168; c=relaxed/simple; bh=jaYmqoq66caysu4SfR8va6WDVPxCLAXCEaDObkNOASo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r2PsCSzsTPE1JuPUqTiWa3kOCmo6OpF41LVwvwP3CNGVcX21lC5W5ME3VWvhwHHZZQzWLqseJ+DK8MwpvfbV1hwigfTEXEKWoVk4kQO7XSjHKsRGq4fO23oDvadnQP7q8plsfqNC79TApWNmWqD6C6zlk3C8wZNIp6QdH4eSoK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CaeiRGNl; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6dbc9dab55dso1751199b3a.0; Mon, 22 Jan 2024 06:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932167; x=1706536967; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qNNrnAa4IIXxXXOYnbFPbhlz1T+5lQN7PRlkG9jiVX0=; b=CaeiRGNl/ujYZuhIEsndpsNoa4ruhMksbKoH6ju7nHFmhXkW09XGcaHROBTBMvQO7l KwOLeKFZt55zZLvAIcNxEF6lOvC6aZnINBMO7IUJiQcaNyzjktmHT3GMXoQ5w38BsVJT sq7l+6IVoZ9IDpKYm8/jDUYYSFyRnbceG3HDm+pKML+u5GdYeOGRyYazogycUsEgBMun kXxTRJdf6+jk3X6ISiA/wSAHSB3osGXcGT/ufChhtjPD4kCbWQ1PwyH+Vbk+vLpNfGTc NWF1AQUx0Hnt9pv96ut5+MPo78FVplDN2MsLekYpZKeG+SUBfx+HTQRh4K9kvll+gOdT jNrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932167; x=1706536967; 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=qNNrnAa4IIXxXXOYnbFPbhlz1T+5lQN7PRlkG9jiVX0=; b=BmLTM6lUGOYpjkhd4/jWmGOc/1yw490ftCIhpYAWv1DGBo3BJqgyZHsDZHhaCEmK9u CUXrVvTltB72rKdg17eDYCfPtxBkgwNn1/YMYbzpS+lXv1qBQrdWTZ3Wi6yn7O7pRp7Z 7bbFkccToWBJDWxUEoLushBtrLWojLfrQC7P5lqHWrvsbQOM2jxjauoxC3oro106keDd 3DCLas42+mjdk3nSIyxfhvPFOoPNuhv/yRbMQf4ZLgRylmXRsTsXaVTWZu2AG+dr8oTs ON10T9Eyoc3UrIHC02zfV8Mj9IL9+8kjo8k2UZWmD8/l3QNGT+JKuNZDe7DrDLu65Gl0 AytA== X-Gm-Message-State: AOJu0YyFoW5IkOsOC0dWR5CpJi5OVa99Haa+id+l+6+7fscPHXEDIJaX qV1Ktk+P7vO0NtS+gvF0gUUpWMwlu9fyiuzIPcu2bFlpWC3gkXF2 X-Received: by 2002:a05:6a00:98e:b0:6db:f87:2237 with SMTP id u14-20020a056a00098e00b006db0f872237mr6234852pfg.21.1705932166566; Mon, 22 Jan 2024 06:02:46 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:45 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/15] nilfs2: remove nilfs_cpfile_{get,put}_checkpoint() Date: Mon, 22 Jan 2024 23:02:01 +0900 Message-Id: <20240122140202.6950-15-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799855204806260 X-GMAIL-MSGID: 1788799855204806260 All calls to nilfs_cpfile_get_checkpoint() and nilfs_cpfile_put_checkpoint() that call kmap() and kunmap() separately are now gone, so remove these methods. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/cpfile.c | 103 --------------------------------------------- fs/nilfs2/cpfile.h | 4 -- 2 files changed, 107 deletions(-) diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 56e38843536b..b5bad332d630 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c @@ -254,92 +254,6 @@ int nilfs_cpfile_read_checkpoint(struct inode *cpfile, __u64 cno, return ret; } -/** - * nilfs_cpfile_get_checkpoint - get a checkpoint - * @cpfile: inode of checkpoint file - * @cno: checkpoint number - * @create: create flag - * @cpp: pointer to a checkpoint - * @bhp: pointer to a buffer head - * - * Description: nilfs_cpfile_get_checkpoint() acquires the checkpoint - * specified by @cno. A new checkpoint will be created if @cno is the current - * checkpoint number and @create is nonzero. - * - * Return Value: On success, 0 is returned, and the checkpoint and the - * buffer head of the buffer on which the checkpoint is located are stored in - * the place pointed by @cpp and @bhp, respectively. On error, one of the - * following negative error codes is returned. - * - * %-EIO - I/O error. - * - * %-ENOMEM - Insufficient amount of memory available. - * - * %-ENOENT - No such checkpoint. - * - * %-EINVAL - invalid checkpoint. - */ -int nilfs_cpfile_get_checkpoint(struct inode *cpfile, - __u64 cno, - int create, - struct nilfs_checkpoint **cpp, - struct buffer_head **bhp) -{ - struct buffer_head *header_bh, *cp_bh; - struct nilfs_cpfile_header *header; - struct nilfs_checkpoint *cp; - void *kaddr; - int ret; - - if (unlikely(cno < 1 || cno > nilfs_mdt_cno(cpfile) || - (cno < nilfs_mdt_cno(cpfile) && create))) - return -EINVAL; - - down_write(&NILFS_MDT(cpfile)->mi_sem); - - ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); - if (ret < 0) - goto out_sem; - ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, create, &cp_bh); - if (ret < 0) - goto out_header; - kaddr = kmap(cp_bh->b_page); - cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); - if (nilfs_checkpoint_invalid(cp)) { - if (!create) { - kunmap(cp_bh->b_page); - brelse(cp_bh); - ret = -ENOENT; - goto out_header; - } - /* a newly-created checkpoint */ - nilfs_checkpoint_clear_invalid(cp); - if (!nilfs_cpfile_is_in_first(cpfile, cno)) - nilfs_cpfile_block_add_valid_checkpoints(cpfile, cp_bh, - kaddr, 1); - mark_buffer_dirty(cp_bh); - - kaddr = kmap_atomic(header_bh->b_page); - header = nilfs_cpfile_block_get_header(cpfile, header_bh, - kaddr); - le64_add_cpu(&header->ch_ncheckpoints, 1); - kunmap_atomic(kaddr); - mark_buffer_dirty(header_bh); - nilfs_mdt_mark_dirty(cpfile); - } - - if (cpp != NULL) - *cpp = cp; - *bhp = cp_bh; - - out_header: - brelse(header_bh); - - out_sem: - up_write(&NILFS_MDT(cpfile)->mi_sem); - return ret; -} - /** * nilfs_cpfile_create_checkpoint - create a checkpoint entry on cpfile * @cpfile: checkpoint file inode @@ -414,23 +328,6 @@ int nilfs_cpfile_create_checkpoint(struct inode *cpfile, __u64 cno) return ret; } -/** - * nilfs_cpfile_put_checkpoint - put a checkpoint - * @cpfile: inode of checkpoint file - * @cno: checkpoint number - * @bh: buffer head - * - * Description: nilfs_cpfile_put_checkpoint() releases the checkpoint - * specified by @cno. @bh must be the buffer head which has been returned by - * a previous call to nilfs_cpfile_get_checkpoint() with @cno. - */ -void nilfs_cpfile_put_checkpoint(struct inode *cpfile, __u64 cno, - struct buffer_head *bh) -{ - kunmap(bh->b_page); - brelse(bh); -} - /** * nilfs_cpfile_finalize_checkpoint - fill in a checkpoint entry in cpfile * @cpfile: checkpoint file inode diff --git a/fs/nilfs2/cpfile.h b/fs/nilfs2/cpfile.h index 2cfa14011bc8..f5b1d59289eb 100644 --- a/fs/nilfs2/cpfile.h +++ b/fs/nilfs2/cpfile.h @@ -16,13 +16,9 @@ #include /* nilfs_inode, nilfs_checkpoint */ -int nilfs_cpfile_get_checkpoint(struct inode *, __u64, int, - struct nilfs_checkpoint **, - struct buffer_head **); int nilfs_cpfile_read_checkpoint(struct inode *cpfile, __u64 cno, struct nilfs_root *root, struct inode *ifile); int nilfs_cpfile_create_checkpoint(struct inode *cpfile, __u64 cno); -void nilfs_cpfile_put_checkpoint(struct inode *, __u64, struct buffer_head *); int nilfs_cpfile_finalize_checkpoint(struct inode *cpfile, __u64 cno, struct nilfs_root *root, __u64 blkinc, time64_t ctime, bool minor); From patchwork Mon Jan 22 14:02:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 190184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2593761dyb; Mon, 22 Jan 2024 06:09:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFi9kmBc3zu4idbkuIwhBrxfZIYNiV2eKRhlplkIwgHPO/LeyE1RaaA+vcjGUpcKEXOhSDb X-Received: by 2002:a17:90a:fc91:b0:28e:849c:cb81 with SMTP id ci17-20020a17090afc9100b0028e849ccb81mr1257573pjb.46.1705932599295; Mon, 22 Jan 2024 06:09:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932599; cv=pass; d=google.com; s=arc-20160816; b=glbPTIFiCpwh7SX7OZ5PUxEvlT/q3HRbuGov+FWFxv5/hw+TZF7hLOZkg9br207D6b BWJKkkydzYYqmOkNIsEQeHz/b24h3MUdKv24dxT+TKsmnk35lgRBbn95yWfAR4QzCHjn 6Rt7RYddESuzol1k1W5i70BrFb/oCYDCVEr8YtVP0+oLHO7byCvj+06UNXKjfol40mbO /UKU3UCqQ1dWaYmN6e6MTMpCeWFrdZbZAGN1gcsTnXt0pfTVBgH6zur2rDRTfhV+ucgB +I3dUXGZsx5I4xEeLLPNEsd8cVMJ7dCwxN1TdEdguDOUu2tzwnp4en6mzmTBWvy+7zLC a7Gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yx6Eqp/Z/8D4++HfhzHbL5OppGmVQ8YzvKDGo+VO4iI=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=cKZEf8aEnsBK6LUH0EwEXKO/nzbS1FFtZr2uOr807YeEqJPUG7YjMucnRpwlD7NGNw ACfbNuuPfI8+/pcBkrT9f7fMGMDZ7KYbYc7+0dwwo00ig36NqfNWJs63y19CYrxauIOU 8aSJb71N6+AZVYLsknAm7HbA4V0bbQGUswalQ23RenpHRfRvfl+2ouuyDVi1IFmnxQCE hLaxkz4942X7YBX+t0wYHBAlaE1dYTtyI40hlOd6ZCxOsN+wD8OoXrLHS+LRGuVF+zf3 My2YeBwMzQefmPALel6ODLH57IGxQHQHB+blBfZZ9bb45zERD0wJ/cPGXR4bMZ+unz4f ef7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gpV+HH09; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33135-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w9-20020a17090aea0900b0028e69509986si8060189pjy.68.2024.01.22.06.09.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:09:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33135-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gpV+HH09; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33135-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 991B82897B5 for ; Mon, 22 Jan 2024 14:07:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77C7E3FE58; Mon, 22 Jan 2024 14:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gpV+HH09" Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 DA6283FE26; Mon, 22 Jan 2024 14:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932171; cv=none; b=MPDuAhDhc+ba9WIjamG1As012cqX/BwT1x/ONspEJNsOW/wUBdw9SgE0HYKwWWqxFabt6UOC8LbyJ9XL782cPzd1JK/2gfbtEP0JVqT9/WAJX9gyRZacJHzXRUBVG/eW4AEH5rYdHiUh+nXHzbU77R3tZ2wiq4mAdTyfrtSshPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705932171; c=relaxed/simple; bh=abVJlLCiIaNc5QIF/gaRMd8qQILBr2IIg2RhhVvxzXY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s7+Y0WwDEQpr6geIXgIBGzoTxSE4Rr4zvFRdjuzUsIkcfK7rE8OfFSqQE7GVPzKNNJeTow0hVnm3N1TjR081akkfB82XsMpwoh+2Hw6fNt0sEKnvVv7jdWurDiJ7EqAzX4HQwPJMyL1b3r5DKb/Y5O0TMz7kgb+gMhRBiq0qOnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gpV+HH09; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6dbda9a4facso537883b3a.3; Mon, 22 Jan 2024 06:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705932169; x=1706536969; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yx6Eqp/Z/8D4++HfhzHbL5OppGmVQ8YzvKDGo+VO4iI=; b=gpV+HH09eBpA25ybrWKaXM5fSZVcWrl2TM90eoffxD2WWqRBezDzjdmmBR5RedL1es 2bFJxAbnwoMtrxqtNxLlRICIe9gTynXGaQKPbUqDtw6G8yGl+WBPiJ97oEDwcyyjQuo/ Iutl0kW9xFJQcEmfYrTBG4d6Ppsdci/mpxZi8ObqZURGMGjN4z9V+bEw76Yk+gcNnRpT qL5/830OGxx9nGlvHtGh0OtZOhLTyu90by2uQoxfydSOjfilr02WSRMUySyvIY1l7SmC uyKFl8CWzOufBoX50/1Lg+39dqJXdtBWNcd1+ZB64fMJrY4QlX2IdDo38m2H+parVwu8 jujg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705932169; x=1706536969; 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=yx6Eqp/Z/8D4++HfhzHbL5OppGmVQ8YzvKDGo+VO4iI=; b=Srtk18scNMSu/clojzYN20nlPc3myUh79UFPM9mNSdM195SfP3uGIlhaz/wz96G0pT kJ88GtD11LoivjWakWbUWvoPt8rT6s4FDWoUhUcc877T5NYb5IGHO2a80OeX7sd2fHkp 1bobrlZq3xHm0aEwxWFO2TRV3oOfAV0dIY32iS0OfoEZXhlCXHQ1nV2rREoLR3dfckXO R1PRlW69b+UxmDmZnnpO0mV2quKdShwaVUcXW1Gys+pne1MzXnVs01BEQ9C/bMQNNRD5 NsE9KszxP3O/7dzmoKoOUojIvp+DBIuq5zKLttgq3AtX/wuxbbkz4fdIC/cEmfahfUew XLjg== X-Gm-Message-State: AOJu0YxYMX4mKCHKMJM1UTowerM/fLHFY+RMYizNwg7jdSJ3dA3whXI+ 0FiIKHBs79VbIpBoxfep70/kNcJP7cQy8ERrathVvi9AwYn8Y01ntzfu4E+5 X-Received: by 2002:a05:6a20:92a3:b0:19a:46b8:fd1e with SMTP id q35-20020a056a2092a300b0019a46b8fd1emr1461254pzg.43.1705932169128; Mon, 22 Jan 2024 06:02:49 -0800 (PST) Received: from carrot.. (i223-218-154-72.s42.a014.ap.plala.or.jp. [223.218.154.72]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b006da2aad58adsm9901913pff.176.2024.01.22.06.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:02:47 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/15] nilfs2: convert cpfile to use kmap_local Date: Mon, 22 Jan 2024 23:02:02 +0900 Message-Id: <20240122140202.6950-16-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com> References: <20240122140202.6950-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788799980870522600 X-GMAIL-MSGID: 1788799980870522600 Convert all remaining usages of kmap_atomic in cpfile to kmap_local. Signed-off-by: Ryusuke Konishi --- fs/nilfs2/cpfile.c | 90 +++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index b5bad332d630..2c57132584de 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c @@ -460,7 +460,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, continue; } - kaddr = kmap_atomic(cp_bh->b_page); + kaddr = kmap_local_page(cp_bh->b_page); cp = nilfs_cpfile_block_get_checkpoint( cpfile, cno, cp_bh, kaddr); nicps = 0; @@ -482,7 +482,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, cpfile, cp_bh, kaddr, nicps); if (count == 0) { /* make hole */ - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(cp_bh); ret = nilfs_cpfile_delete_checkpoint_block( @@ -497,18 +497,18 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, } } - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(cp_bh); } if (tnicps > 0) { - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); le64_add_cpu(&header->ch_ncheckpoints, -(u64)tnicps); mark_buffer_dirty(header_bh); nilfs_mdt_mark_dirty(cpfile); - kunmap_atomic(kaddr); + kunmap_local(kaddr); } brelse(header_bh); @@ -560,7 +560,7 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop, } ncps = nilfs_cpfile_checkpoints_in_block(cpfile, cno, cur_cno); - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr); for (i = 0; i < ncps && n < nci; i++, cp = (void *)cp + cpsz) { if (!nilfs_checkpoint_invalid(cp)) { @@ -570,7 +570,7 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop, n++; } } - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); } @@ -604,10 +604,10 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, ret = nilfs_cpfile_get_header_block(cpfile, &bh); if (ret < 0) goto out; - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); header = nilfs_cpfile_block_get_header(cpfile, bh, kaddr); curr = le64_to_cpu(header->ch_snapshot_list.ssl_next); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); if (curr == 0) { ret = 0; @@ -625,7 +625,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, ret = 0; /* No snapshots (started from a hole block) */ goto out; } - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); while (n < nci) { cp = nilfs_cpfile_block_get_checkpoint(cpfile, curr, bh, kaddr); curr = ~(__u64)0; /* Terminator */ @@ -641,7 +641,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, next_blkoff = nilfs_cpfile_get_blkoff(cpfile, next); if (curr_blkoff != next_blkoff) { - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); ret = nilfs_cpfile_get_checkpoint_block(cpfile, next, 0, &bh); @@ -649,12 +649,12 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, WARN_ON(ret == -ENOENT); goto out; } - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); } curr = next; curr_blkoff = next_blkoff; } - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); *cnop = curr; ret = n; @@ -763,24 +763,24 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); if (ret < 0) goto out_sem; - kaddr = kmap_atomic(cp_bh->b_page); + kaddr = kmap_local_page(cp_bh->b_page); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); if (nilfs_checkpoint_invalid(cp)) { ret = -ENOENT; - kunmap_atomic(kaddr); + kunmap_local(kaddr); goto out_cp; } if (nilfs_checkpoint_snapshot(cp)) { ret = 0; - kunmap_atomic(kaddr); + kunmap_local(kaddr); goto out_cp; } - kunmap_atomic(kaddr); + kunmap_local(kaddr); ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); if (ret < 0) goto out_cp; - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); list = &header->ch_snapshot_list; curr_bh = header_bh; @@ -792,13 +792,13 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) prev_blkoff = nilfs_cpfile_get_blkoff(cpfile, prev); curr = prev; if (curr_blkoff != prev_blkoff) { - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(curr_bh); ret = nilfs_cpfile_get_checkpoint_block(cpfile, curr, 0, &curr_bh); if (ret < 0) goto out_header; - kaddr = kmap_atomic(curr_bh->b_page); + kaddr = kmap_local_page(curr_bh->b_page); } curr_blkoff = prev_blkoff; cp = nilfs_cpfile_block_get_checkpoint( @@ -806,7 +806,7 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) list = &cp->cp_snapshot_list; prev = le64_to_cpu(list->ssl_prev); } - kunmap_atomic(kaddr); + kunmap_local(kaddr); if (prev != 0) { ret = nilfs_cpfile_get_checkpoint_block(cpfile, prev, 0, @@ -818,29 +818,29 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) get_bh(prev_bh); } - kaddr = kmap_atomic(curr_bh->b_page); + kaddr = kmap_local_page(curr_bh->b_page); list = nilfs_cpfile_block_get_snapshot_list( cpfile, curr, curr_bh, kaddr); list->ssl_prev = cpu_to_le64(cno); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(cp_bh->b_page); + kaddr = kmap_local_page(cp_bh->b_page); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); cp->cp_snapshot_list.ssl_next = cpu_to_le64(curr); cp->cp_snapshot_list.ssl_prev = cpu_to_le64(prev); nilfs_checkpoint_set_snapshot(cp); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(prev_bh->b_page); + kaddr = kmap_local_page(prev_bh->b_page); list = nilfs_cpfile_block_get_snapshot_list( cpfile, prev, prev_bh, kaddr); list->ssl_next = cpu_to_le64(cno); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); le64_add_cpu(&header->ch_nsnapshots, 1); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(prev_bh); mark_buffer_dirty(curr_bh); @@ -881,23 +881,23 @@ static int nilfs_cpfile_clear_snapshot(struct inode *cpfile, __u64 cno) ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); if (ret < 0) goto out_sem; - kaddr = kmap_atomic(cp_bh->b_page); + kaddr = kmap_local_page(cp_bh->b_page); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); if (nilfs_checkpoint_invalid(cp)) { ret = -ENOENT; - kunmap_atomic(kaddr); + kunmap_local(kaddr); goto out_cp; } if (!nilfs_checkpoint_snapshot(cp)) { ret = 0; - kunmap_atomic(kaddr); + kunmap_local(kaddr); goto out_cp; } list = &cp->cp_snapshot_list; next = le64_to_cpu(list->ssl_next); prev = le64_to_cpu(list->ssl_prev); - kunmap_atomic(kaddr); + kunmap_local(kaddr); ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); if (ret < 0) @@ -921,29 +921,29 @@ static int nilfs_cpfile_clear_snapshot(struct inode *cpfile, __u64 cno) get_bh(prev_bh); } - kaddr = kmap_atomic(next_bh->b_page); + kaddr = kmap_local_page(next_bh->b_page); list = nilfs_cpfile_block_get_snapshot_list( cpfile, next, next_bh, kaddr); list->ssl_prev = cpu_to_le64(prev); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(prev_bh->b_page); + kaddr = kmap_local_page(prev_bh->b_page); list = nilfs_cpfile_block_get_snapshot_list( cpfile, prev, prev_bh, kaddr); list->ssl_next = cpu_to_le64(next); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(cp_bh->b_page); + kaddr = kmap_local_page(cp_bh->b_page); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); cp->cp_snapshot_list.ssl_next = cpu_to_le64(0); cp->cp_snapshot_list.ssl_prev = cpu_to_le64(0); nilfs_checkpoint_clear_snapshot(cp); - kunmap_atomic(kaddr); + kunmap_local(kaddr); - kaddr = kmap_atomic(header_bh->b_page); + kaddr = kmap_local_page(header_bh->b_page); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); le64_add_cpu(&header->ch_nsnapshots, -1); - kunmap_atomic(kaddr); + kunmap_local(kaddr); mark_buffer_dirty(next_bh); mark_buffer_dirty(prev_bh); @@ -1002,13 +1002,13 @@ int nilfs_cpfile_is_snapshot(struct inode *cpfile, __u64 cno) ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &bh); if (ret < 0) goto out; - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr); if (nilfs_checkpoint_invalid(cp)) ret = -ENOENT; else ret = nilfs_checkpoint_snapshot(cp); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); out: @@ -1085,12 +1085,12 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat) ret = nilfs_cpfile_get_header_block(cpfile, &bh); if (ret < 0) goto out_sem; - kaddr = kmap_atomic(bh->b_page); + kaddr = kmap_local_page(bh->b_page); header = nilfs_cpfile_block_get_header(cpfile, bh, kaddr); cpstat->cs_cno = nilfs_mdt_cno(cpfile); cpstat->cs_ncps = le64_to_cpu(header->ch_ncheckpoints); cpstat->cs_nsss = le64_to_cpu(header->ch_nsnapshots); - kunmap_atomic(kaddr); + kunmap_local(kaddr); brelse(bh); out_sem: