Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp343951rdb; Mon, 22 Jan 2024 06:08:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgbmhsMkezPWSqv8XLA2MSvXqOz9+k+SKuv62RJa3BX5pu5U285jmzak1TeCI90MzPe38t X-Received: by 2002:a17:902:aa49:b0:1d7:3adf:350e with SMTP id c9-20020a170902aa4900b001d73adf350emr3361505plr.34.1705932482915; Mon, 22 Jan 2024 06:08:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705932482; cv=pass; d=google.com; s=arc-20160816; b=GvPGpQuYJgEIRMR+wHxHoXKYNzN05M63phBAX3szpT7L10dP/wvj7XaN9tXeTG/CnB OfdPB8QVjVYSoQWO4+GJIvpnHghFoLVo74MWMwjga6R9Jn442UN9xMW77+O6dpGrSJW7 XUY3kfbMMtaWgI0wU6Ce0/BoP4rX4bdiX4zoscI+tFFoYY9BRiDbGMq1vYmomK8rOTtp +DsFSfnx2DnqUbtQXcpx/WbfqHkvZj4ZOw3SQ3i/lKNr7fRIFS9H6p804GpmNvU+cNx1 o6xOzo+JdG+xsAmbytetRWAOg+ALWNPL8djnjTS29/EeR71wCjxInZsDNMKbdHWiBt+I XALw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33134-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i18-20020a170902eb5200b001d719dbfd91si6489985pli.332.2024.01.22.06.08.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 06:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33134-linux.lists.archive=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=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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33134-linux.lists.archive=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 B78D628AAD0 for ; Mon, 22 Jan 2024 14:06:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8D993FE22; 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="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 Content-Transfer-Encoding: 8bit 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); -- 2.34.1