Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2259336ybz; Sun, 26 Apr 2020 14:51:44 -0700 (PDT) X-Google-Smtp-Source: APiQypKdcjLfkR1WgzhhSJpZQu0gVPrYVsulGZ9ays7upHsepouRsv4HzqHct66MSnCGXWv+kuCV X-Received: by 2002:a17:906:38c:: with SMTP id b12mr16623792eja.332.1587937904384; Sun, 26 Apr 2020 14:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587937904; cv=none; d=google.com; s=arc-20160816; b=uvZxTzHpVkwIwwtTB0ONGIw4Wra9NBZwMUSossXGQ9CfgiFKxY1SYckX2bS7TqEzjV DBSR1WHcihNULtMH6cyeqQzIzkjkTlLHCk5C6fP90MiRaUFlRLUOGMfd4VcjjK3/5dpD 3SIzCdFiwLghoKH1IrVTViV57BWtQEc4HnPd+Y7iMFRP0WBbR3vzr+r27k8Tck3Io6q/ BjqpUErwLf3vRXG/iA8qytqMnaUn+1c6a50YgUmFq2PSK5vaRNgyJ9/6K9Rvfi3fl+CU kElCY+ytQ8XeBe7TRY7hq/fyGWGh5NqeTv8mhHXkPgzXu/nwHTkZnOPfhVnR3bllVwpO NFRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=je11VssEqcRjDcQQUY7TMs+S/p8Pe+y4zVJlfwO1AIY=; b=R45EN4RKkxGUWxbF9AeZdSt0/UYuyHFeeKvaVfT2QdQ8o2vWeVeTjs+dsahp+Mari3 gGXkN9jdgeqmbfVmI+Rq/+59StS5/E946d65zgQce5Uf4mL5GqWHw6cUbB0UohvT1/97 AdUgTQsALjo6ubF0iKRSXZ62hnAn7Eb2Muz4rht4pVyLJTiKwrIitptfGTmaxm3YJ8rH 4xX8hcWgPrFALyLzaIrMWDcAtQZUyGfZtJ89eJ7EaJG260zwh+6bTOiTLPw+dIgaIVHz hKmyoqyN9Jii0XU62+CWfpg1lDv0xcDX2Cmrg+TR9bhBIA6SU5rTc4CELR2VnRlybWek XSzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=OwNMupnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by8si7464513ejb.525.2020.04.26.14.51.21; Sun, 26 Apr 2020 14:51:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=OwNMupnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbgDZVt6 (ORCPT + 99 others); Sun, 26 Apr 2020 17:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbgDZVty (ORCPT ); Sun, 26 Apr 2020 17:49:54 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E55C09B054 for ; Sun, 26 Apr 2020 14:49:53 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id p16so11993911edm.10 for ; Sun, 26 Apr 2020 14:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=je11VssEqcRjDcQQUY7TMs+S/p8Pe+y4zVJlfwO1AIY=; b=OwNMupnSJkBuaJfMXeCgM1rYXjTmzIAla+tSBp7FYda6Z0do31Tv6/LqXGLMcBBWhG nqjIhBJEalueOvj9V2LZ+TuLLeFNIXzVb6OK45n66rzci+x/eJxewCUOYOo06dTayDKj B5iJ94emWcTjwQbgVlPIpz9Lz++7r/aQF//fpjSxu2/XNpEhrL+lHBErqiCynz5SbjB2 iW4ERClUfrgtnD0QmDonsDibcZjmNyxtpI2M/DaGWxbm7W5qNx0fPMGF44KjexJ6P8/1 2LGOGXLbZT3PVyAX3yAvtCf/8vJUr85wyASdWC+0wMGkNwBqVxwGJ+99/wys6z7wxDo+ YYVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=je11VssEqcRjDcQQUY7TMs+S/p8Pe+y4zVJlfwO1AIY=; b=HyV8IovVgT0t7aD2QRnv7h9fcxLz4jKHsEpwU23y2ypSYXmfK9235OkE1zmC+FxYgl iGzxuMqqgmZJr98sQZzlKXtuSJvtchXpv7Ng9HPt92OHfXQGddbRyQOIBmxthemi1LdE ppK9RxZhIjbO10vYfMkFzhBDwtN6W5UMuw/j8KBeersA3D69yxUJrHhALirzuXON/bWf 93s2OFVfcvdDQLLE4JZx7LMGpQhNcjIeRWca5deyROtbXMPpHxZGQf0kPywY7H3XAOzs rM/If+xyny8gXbNQHNN3Nmqa4QIhU1UafAMUTL4WNhqCbGpEQzqNteO73vHavH/7v4yz TA6g== X-Gm-Message-State: AGi0PuZUtGLn3/26skEaBP3QWUHF+R8puoXSfjtiLYdiwmQhKmRbObZD ABKrQgBkWo50Ph3XqhLY1fFWeg== X-Received: by 2002:a50:99c4:: with SMTP id n4mr16930973edb.187.1587937792458; Sun, 26 Apr 2020 14:49:52 -0700 (PDT) Received: from ls00508.pb.local ([2001:1438:4010:2540:fab1:56ff:feab:56b1]) by smtp.gmail.com with ESMTPSA id ce18sm2270108ejb.61.2020.04.26.14.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2020 14:49:51 -0700 (PDT) From: Guoqing Jiang To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: hch@infradead.org, david@fromorbit.com, willy@infradead.org, Guoqing Jiang , "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [RFC PATCH 6/9] iomap: use set/clear_fs_page_private Date: Sun, 26 Apr 2020 23:49:22 +0200 Message-Id: <20200426214925.10970-7-guoqing.jiang@cloud.ionos.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200426214925.10970-1-guoqing.jiang@cloud.ionos.com> References: <20200426214925.10970-1-guoqing.jiang@cloud.ionos.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the new pair function is introduced, we can call them to clean the code in iomap. Cc: Christoph Hellwig Cc: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org Signed-off-by: Guoqing Jiang --- fs/iomap/buffered-io.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 89e21961d1ad..cc48bf4f1193 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -59,24 +59,18 @@ iomap_page_create(struct inode *inode, struct page *page) * migrate_page_move_mapping() assumes that pages with private data have * their count elevated by 1. */ - get_page(page); - set_page_private(page, (unsigned long)iop); - SetPagePrivate(page); - return iop; + return (struct iomap_page *)set_fs_page_private(page, iop); } static void iomap_page_release(struct page *page) { - struct iomap_page *iop = to_iomap_page(page); + struct iomap_page *iop = clear_fs_page_private(page); if (!iop) return; WARN_ON_ONCE(atomic_read(&iop->read_count)); WARN_ON_ONCE(atomic_read(&iop->write_count)); - ClearPagePrivate(page); - set_page_private(page, 0); - put_page(page); kfree(iop); } @@ -556,11 +550,9 @@ iomap_migrate_page(struct address_space *mapping, struct page *newpage, if (page_has_private(page)) { ClearPagePrivate(page); - get_page(newpage); - set_page_private(newpage, page_private(page)); + set_fs_page_private(newpage, (void *)page_private(page)); set_page_private(page, 0); put_page(page); - SetPagePrivate(newpage); } if (mode != MIGRATE_SYNC_NO_COPY) -- 2.17.1