Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2653300rwb; Fri, 2 Dec 2022 12:59:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5bhng7gnSwpA4ZroAAi87we73Dv303EKmfQV/8Bx7VxVYtEghq+zfuGCHe5PQ0nDznOnio X-Received: by 2002:a63:f211:0:b0:477:def7:58a3 with SMTP id v17-20020a63f211000000b00477def758a3mr33367552pgh.423.1670014774329; Fri, 02 Dec 2022 12:59:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670014774; cv=none; d=google.com; s=arc-20160816; b=pIHZtpDxxjrJJ3nMUGAQkpk+d6nmuElcCjC/XFRkkiWEVyWWDcaY1PwZ/xVApAlTBY LnTfTlQrOavVIOaKipzWH+8HlhqgPk6zqAohuGc66eyEIICkcLnx0JB+hZpnS/EZ5HXP pXODayZqD2lO0zXMat9y8vgkz3aSj07vKeT2fXyMYlURNp7HIVTVv8p6kTmSV9pPFDqc uhOZwniZbfrVW+NZM9fFpmKTct8QFD+xQdUlQuQO0PcCcrLCrqmYohTRHYtocbjZEtWW 72lx9dBQbo+O189AjX0X1+vEPExoBmEVXxqSAej2FkBuvnCp6qguAa7sseRPGcWXBPEj UJdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=dQlj9HGrsyP2WPLSgTrrVAGkMnbcrGEG/P9iHXwo1w8=; b=BNSvvsNi6h2LeqYbxg7ip56C65TaN9uPvehO+UtdfX8lBrX9RwhqOYF+hvmHB8m/9n Ayzj45xYQkSmmW44XxB5CMpb7PHlEhvUo7cPn2D9/X+ufjzgKt7MqzcVpyesBPVcIY14 XslnCoj5GXJj0JpiU+4nW9vdzW8Utj6L9Wz1ot8iCDt9yqOG8ZiUb7iKe83LrN3MW86t P4rtFjRoZRo6WmYykNNsnG5R3SV0WoONtQQatcNI16afIVt77b1txnkcgkQMEALVxITZ BmyreDGaUTcWT6AS6E5u7r3TdIrx9stra2fDHVHfpljXISjM+m62FiAd2Zf00JucX5Q2 fzAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="Qiy/Rz8B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a170902da8700b00189abdd3fcbsi8169118plx.263.2022.12.02.12.59.23; Fri, 02 Dec 2022 12:59:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="Qiy/Rz8B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234874AbiLBUSE (ORCPT + 83 others); Fri, 2 Dec 2022 15:18:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234878AbiLBUSD (ORCPT ); Fri, 2 Dec 2022 15:18:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 469D4317CE; Fri, 2 Dec 2022 12:18:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7E96623B2; Fri, 2 Dec 2022 20:18:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0366EC433C1; Fri, 2 Dec 2022 20:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1670012281; bh=vzzVaosh6o8JL4+OzaJBhy3ljlqNHLgnYfdJDBqdxdM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Qiy/Rz8BpdMFrfatVnHWOKxqNt2djdf4PTkeB4ZV0Tyn/Jb62vwuneHFMPvFBOLkw w+r2SMd4NOzTl+0auLMbL5P9Ju/DUFPVUf9f6PpA331zT7i0awPSCxDvrLwf3LVuOZ 5NfKJOs/ikde+UrvqNcQBJIVEwVlRSMNBkhNHLXY= Date: Fri, 2 Dec 2022 12:18:00 -0800 From: Andrew Morton To: Shiyang Ruan Cc: , , , , , , Subject: Re: [PATCH v2.1 1/8] fsdax: introduce page->share for fsdax in reflink mode Message-Id: <20221202121800.598afc7a5124561069f91014@linux-foundation.org> In-Reply-To: <1669972991-246-1-git-send-email-ruansy.fnst@fujitsu.com> References: <1669908538-55-2-git-send-email-ruansy.fnst@fujitsu.com> <1669972991-246-1-git-send-email-ruansy.fnst@fujitsu.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2 Dec 2022 09:23:11 +0000 Shiyang Ruan wrote: > fsdax page is used not only when CoW, but also mapread. To make the it > easily understood, use 'share' to indicate that the dax page is shared > by more than one extent. And add helper functions to use it. > > Also, the flag needs to be renamed to PAGE_MAPPING_DAX_SHARED. > For those who are wondering what changed, I queued the below incremental patch. From: Shiyang Ruan Subject: fsdax: introduce page->share for fsdax in reflink mode Date: Fri, 2 Dec 2022 09:23:11 +0000 rename several functions Link: https://lkml.kernel.org/r/1669972991-246-1-git-send-email-ruansy.fnst@fujitsu.com Signed-off-by: Shiyang Ruan Cc: Alistair Popple Cc: Dan Williams Cc: Darrick J. Wong Cc: Dave Chinner Cc: Jason Gunthorpe Cc: John Hubbard Signed-off-by: Andrew Morton --- fs/dax.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/fs/dax.c~fsdax-introduce-page-share-for-fsdax-in-reflink-mode-fix +++ a/fs/dax.c @@ -334,7 +334,7 @@ static unsigned long dax_end_pfn(void *e for (pfn = dax_to_pfn(entry); \ pfn < dax_end_pfn(entry); pfn++) -static inline bool dax_mapping_is_shared(struct page *page) +static inline bool dax_page_is_shared(struct page *page) { return (unsigned long)page->mapping == PAGE_MAPPING_DAX_SHARED; } @@ -343,7 +343,7 @@ static inline bool dax_mapping_is_shared * Set the page->mapping with PAGE_MAPPING_DAX_SHARED flag, increase the * refcount. */ -static inline void dax_mapping_set_shared(struct page *page) +static inline void dax_page_bump_sharing(struct page *page) { if ((uintptr_t)page->mapping != PAGE_MAPPING_DAX_SHARED) { /* @@ -357,7 +357,7 @@ static inline void dax_mapping_set_share page->share++; } -static inline unsigned long dax_mapping_decrease_shared(struct page *page) +static inline unsigned long dax_page_drop_sharing(struct page *page) { return --page->share; } @@ -381,7 +381,7 @@ static void dax_associate_entry(void *en struct page *page = pfn_to_page(pfn); if (shared) { - dax_mapping_set_shared(page); + dax_page_bump_sharing(page); } else { WARN_ON_ONCE(page->mapping); page->mapping = mapping; @@ -402,9 +402,9 @@ static void dax_disassociate_entry(void struct page *page = pfn_to_page(pfn); WARN_ON_ONCE(trunc && page_ref_count(page) > 1); - if (dax_mapping_is_shared(page)) { + if (dax_page_is_shared(page)) { /* keep the shared flag if this page is still shared */ - if (dax_mapping_decrease_shared(page) > 0) + if (dax_page_drop_sharing(page) > 0) continue; } else WARN_ON_ONCE(page->mapping && page->mapping != mapping); _