From patchwork Fri Jan 22 17:51:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 368710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 142E6C433E0 for ; Fri, 22 Jan 2021 17:59:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D269223ACA for ; Fri, 22 Jan 2021 17:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729629AbhAVR6a (ORCPT ); Fri, 22 Jan 2021 12:58:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:53842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729466AbhAVRwD (ORCPT ); Fri, 22 Jan 2021 12:52:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7486723A9C; Fri, 22 Jan 2021 17:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611337883; bh=x1lJQGM04EP7vdDpOg3XZRh7p/S7qixcDsgKzeM7VHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgeYi17BYaz72pJfJRzXo5B8FqtZCB7ZgIWCKtkxGYlhLd4ecVOMeSpzWpQov/w7Q 2g5dp/aQ1Q3YXFu0mRH6SaSqo5/hVN5LY21FCbTJbT7lWWPco8GRYp2dYAtqiNMgS5 r3vP4aivhAT59DjBigNLlSPz9DYrhe+szb8xHs83tKQ6/cboaeNPChs3LuVf4WrE0K oTe9+2nW97R614lf9C71NBjcori4PijInVwyXZd4sYKUXyTWtLs2b16dQgAW22u7Om 2XZfA0OTD2XTqyd1515vuUxGX4KiXwMyHrLpbiF9QoSyDTw6rSwTQX5PLu44Y8PtXe xvIWzKp3r95OQ== From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, dhowells@redhat.com, willy@infradead.org, linux-cachefs@redhat.com, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/6] ceph: rework PageFsCache handling Date: Fri, 22 Jan 2021 12:51:14 -0500 Message-Id: <20210122175119.364381-3-jlayton@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210122175119.364381-1-jlayton@kernel.org> References: <20210122175119.364381-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org With the new fscache API, the PageFsCache bit now indicates that the page is being written to the cache and shouldn't be modified or released until it's finished. Change releasepage and invalidatepage to wait on that bit before returning. Signed-off-by: Jeff Layton --- fs/ceph/addr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index e267aa60c8b6..f554667e1e91 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -166,13 +166,19 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset, ceph_put_snap_context(snapc); page->private = 0; ClearPagePrivate(page); + wait_on_page_fscache(page); } -static int ceph_releasepage(struct page *page, gfp_t g) +static int ceph_releasepage(struct page *page, gfp_t gfp_flags) { dout("%p releasepage %p idx %lu (%sdirty)\n", page->mapping->host, page, page->index, PageDirty(page) ? "" : "not "); + if (PageFsCache(page)) { + if (!(gfp_flags & __GFP_DIRECT_RECLAIM) || !(gfp_flags & __GFP_FS)) + return 0; + wait_on_page_fscache(page); + } return !PagePrivate(page); }