Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp717655lqs; Fri, 14 Jun 2024 03:50:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXawHEDthrvUQAVHDMko+kolHroq1ivwdSTpTteoorc6KVbtfDm9SR/s07HPOyjpDgCbJRKV6/+p2gtXi5ZBBIjo/4CEKn2svRQRsI99Q== X-Google-Smtp-Source: AGHT+IHfz+dehkjdfh01cYKuG+q8BuzGnTHiH3S3oThJBwhCH642oLImLWeVO7ZxTs3Jx3tq2PDm X-Received: by 2002:a05:620a:2903:b0:795:502d:f138 with SMTP id af79cd13be357-798d24222f1mr225429285a.24.1718362259317; Fri, 14 Jun 2024 03:50:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718362259; cv=pass; d=google.com; s=arc-20160816; b=knt+dQvJqhlJQ5MhsYmmMlxIKpRRoekPi9HhROpYFGYBoR7yIsK8PCcgd2ocqAZSsp 6BI5fEuitkWgmMUT4FEV79CvRyGb7AtquO+lUPkB9ZKDl/tgLRkC4y4AOj5QFgTiiQ9I G4Sa+p6+B2n2zqH14rjCdbskzYyWLmX+qaypzHOtFUu1Lrf1N+2G8KQFiE4AyfT+GDCv wc/KUavlduRjht5bpuO0PmUcTIxLye3G+ON+BO28n25ae74HTc9KvuyBzZfCCY55ICEC WcYCp5iSvsiW2MLvTFKqjATQFlr93fYIUHba+X8vCjlhXM4OIQdv4wm/pwRBWHDz9LIx 22DQ== 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=h9XKge9NpIpH1b33RjGZCWwlvvg3NKJI45iOzjHUY7w=; fh=P0iqb8nWt3LG5d71f7oTg2nvp+hp9ZVVIWQyZBNms5c=; b=PJ3Uv7P2l3AmbrsRAgQr60p6Y8bXek7kbwk7kO4LTw8YDDK8FEzTwtCgjYA+z/07/K x+PiAemr1V5OCutLG41WXIT1RCOjVE3BzjS0YHL36bnanXvdSCQvfyRyv5roZl+ylgoD EnPnGCRHHvuCth2ZCEMbKVcJaU+l89zabPzpZWDWXXDlmKvyGnQbNPsEFgCX+/c87uQb iabmV96MN8X7qHLpRJr3QqxPGx5d4JEAEPQbwQOThEvI0qfMykrwXxyAkdSROUz6PQPL ZONd6mlt0PDZozf7f/JZDDmoELtWiaEiNP36vRqtFOsDwheFmqEQvQT+uuHka5TUUU05 xvXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=fcuZWeS0; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-214818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798ac08f32dsi332814785a.766.2024.06.14.03.50.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 03:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214818-linux.lists.archive=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=@pankajraghav.com header.s=MBO0001 header.b=fcuZWeS0; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-214818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.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 0B7281C21ECF for ; Fri, 14 Jun 2024 10:50:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAA43195F0C; Fri, 14 Jun 2024 10:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="fcuZWeS0" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09A431957E4; Fri, 14 Jun 2024 10:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718362241; cv=none; b=jbapkq8+tMNiU4qPCodHwBhpIZjWLKefvYdT6i3/pyiM5EhxHg4KuHwrT8hMH6srmBH3D+YLmNTQbsGaF4PbCx/TifP/sACXRdm/ad9ipAXGlZhtKi6AYaVmWIvit99rkX+S9txQvzZNzJ965kwvpyC1NLQltB7tD+xS/pT2NJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718362241; c=relaxed/simple; bh=6pfJoYioiO6yA1+m6X4mMuZKZchxbko/MzEz7P3kvic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XHpS3rgDAHIuUues/ABXDt31FiSJoXRV1Hb4g4hEXLIWMAyN6KEVGam76zuwhIGjJCWHU1QlgkTSA+6yyAm7YLi3GXB+KR4/+wfBN8/u8215ajbqxM6y1bliatJ1Zyy3gDD+M/AyVopmpbCnKHr0hUX+1/S/YeQHFHaNMLw85AA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=fcuZWeS0; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4W0wzb2c3Hz9tWv; Fri, 14 Jun 2024 12:50:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1718362235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h9XKge9NpIpH1b33RjGZCWwlvvg3NKJI45iOzjHUY7w=; b=fcuZWeS03H+xn4nyFh2EdSFXGZj3IwNSTmI/lrAcWiXWtYElNMSFGl5YiyVNDgpWoC8aVL UfPUK46C5Pdp6EsuE4NbWTnFaNggiHtVS3lkCPZaI/6aHFXziTi/0bffdjBdYayyccAS0s haMMgf5jO1eO3W/MkwyUb9i3rorWhktujASBpoehLFZvWAAIlDBgyJ8lLhMDo/IZCiIEZx 19EniWiQtk4i/f2RBh+1HR5s2kb94qrOrdWWQKGHuu7Klcl0rUgEuHmj6BkXrNfhw0TgrX Nk9lhKQXKHxrUldkR6ZxhhCAfDrp7fDCu4l49F7fGXYTxy/IaX31qqOh5/YxYA== From: "Pankaj Raghav (Samsung)" To: Brian Foster , Kent Overstreet Cc: linux-bcachefs@vger.kernel.org, willy@infradead.org, linux-kernel@vger.kernel.org, Pankaj Raghav Subject: [PATCH 1/2] bcachefs: use FGP_WRITEBEGIN instead of combining individual flags Date: Fri, 14 Jun 2024 10:50:30 +0000 Message-ID: <20240614105031.57032-2-kernel@pankajraghav.com> In-Reply-To: <20240614105031.57032-1-kernel@pankajraghav.com> References: <20240614105031.57032-1-kernel@pankajraghav.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 From: Pankaj Raghav Use FGP_WRITEBEGIN to avoid repeating the individual FGP flags before starting a buffered write. Signed-off-by: Pankaj Raghav --- fs/bcachefs/fs-io-buffered.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c index 54873ecc635c..865691dd0173 100644 --- a/fs/bcachefs/fs-io-buffered.c +++ b/fs/bcachefs/fs-io-buffered.c @@ -677,9 +677,8 @@ int bch2_write_begin(struct file *file, struct address_space *mapping, bch2_pagecache_add_get(inode); - folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, - FGP_LOCK|FGP_WRITE|FGP_CREAT|FGP_STABLE, - mapping_gfp_mask(mapping)); + folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, FGP_WRITEBEGIN, + mapping_gfp_mask(mapping)); if (IS_ERR_OR_NULL(folio)) goto err_unlock; @@ -820,9 +819,8 @@ static int __bch2_buffered_write(struct bch_inode_info *inode, darray_init(&fs); ret = bch2_filemap_get_contig_folios_d(mapping, pos, end, - FGP_LOCK|FGP_WRITE|FGP_STABLE|FGP_CREAT, - mapping_gfp_mask(mapping), - &fs); + FGP_WRITEBEGIN, + mapping_gfp_mask(mapping), &fs); if (ret) goto out; -- 2.44.1